snel.ansible/INSTALL.md

2.5 KiB

Snel.com Ansible Playbooks - Installation

Install requirements on macOS

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)

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

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:

bw  config  server  'https://pw.snel.com/'
bw  login

Vault password

cd ~/repos/snel.ansible
mkdir -m700 -p .ansible
echo -n '__THE_PASSWORD__' > .ansible/vault_pass
chmod 600 .ansible/vault_pass