Snel.com Ansible Playbooks - Installation --- ## Install requirements on macOS ```zsh brew install \ ansible \ ansible-lint \ packer \ jq \ siderolabs/talos/talosctl \ kubernetes-cli \ helm \ bitwarden-cli \ velero helm plugin install https://github.com/databus23/helm-diff python3 -m pip install --upgrade --requirement ./requirements.txt ansible-galaxy install --force --role-file ./requirements.yml grep 'OBJC_DISABLE_INITIALIZE_FORK_SAFETY' ~/.zshrc || echo "OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" >> ~/.zshrc source ~/.zshrc ``` ## Install requirements on Linux (non-root) ```bash mkdir -p "${HOME}/bin" if [[ "${PATH}" != *"${HOME}/.local/bin"* ]]; then echo 'PATH="${HOME}/.local/bin:${PATH}"' >> ~/.bash_profile; source ~/.bash_profile; fi if [[ "${PATH}" != *"${HOME}/bin"* ]]; then echo 'PATH="${HOME}/bin:${PATH}"' >> ~/.bash_profile; source ~/.bash_profile; fi curl -L "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -o "${HOME}/bin/kubectl" curl -L "https://github.com/siderolabs/talos/releases/download/latest/talosctl-linux-amd64" -o "${HOME}/bin/talosctl" curl -L "https://get.helm.sh/helm-$(curl -s https://api.github.com/repos/helm/helm/releases/latest | jq -r '.tag_name' )-linux-amd64.tar.gz" | tar -C "${HOME}/bin" -xpzf - linux-amd64/helm --strip-components 1 curl -sL "https://vault.bitwarden.com/download/?app=cli&platform=linux" | unzip -o -d "${HOME}/bin" - bw chmod +x "${HOME}/bin/"* python3 -m pip --version ``` ## Clone repo ```zsh mkdir -m750 -p ~/repos cd ~/repos git clone --recurse-submodules git@git.snel.com:snelcom-ansible/snel.ansible.git snel.ansible git config pull.rebase true git config core.hooksPath .githooks git -C playbooks/snel.kubernetes-cluster config pull.rebase true git -C playbooks/snel.kubernetes-cluster config core.hooksPath .githooks cd ~/repos/snel.ansible python3 -m pip install --upgrade --requirement ./requirements.txt ansible-galaxy install --force --role-file ./requirements.yml ``` ## Vaultwarden ### First time login on Vaultwarden: ```zsh bw config server 'https://pw.snel.com/' bw login ``` ## Vault password - Copy the vault password from the [Vaultwarden Item](https://pw.snel.com/#/vault?itemId=7f1b6fd8-f519-43ef-bc4f-108f9f39b75a&cipherId=261e5eb5-8118-4c7f-84c5-101793ede911) ```bash cd ~/repos/snel.ansible mkdir -m700 -p .ansible echo -n '__THE_PASSWORD__' > .ansible/vault_pass chmod 600 .ansible/vault_pass ```