|
|
|
|
@@ -38,7 +38,8 @@ ansible-playbook ansible/arcodange/factory/playbooks/03_cicd.yml -i ansible/arco
|
|
|
|
|
ANSIBLE_VAULT_PASSWORD_FILE=~/.local/bin/read-vault-key.sh;
|
|
|
|
|
mkdir -p `dirname $ANSIBLE_VAULT_PASSWORD_FILE`; set +o histexpand;
|
|
|
|
|
echo -e "#!/bin/bash\nkubectl get secret -n kube-system arcodange-ansible-vault --template='{{index .data.pass | base64decode}}'" > $ANSIBLE_VAULT_PASSWORD_FILE;
|
|
|
|
|
set -o histexpand; chmod +x $ANSIBLE_VAULT_PASSWORD_FILE; echo "export ANSIBLE_VAULT_PASSWORD_FILE=$ANSIBLE_VAULT_PASSWORD_FILE" >> `find ~ -maxdepth 1 -type f -name '\.*profile' -or -name '\.bashrc' | head -n1`
|
|
|
|
|
set -o histexpand; chmod +x $ANSIBLE_VAULT_PASSWORD_FILE; echo "export ANSIBLE_VAULT_PASSWORD_FILE=$ANSIBLE_VAULT_PASSWORD_FILE" >> `find ~ -maxdepth 1 -type f -name '\.*profile' -or -name '\.bashrc' -or -name '\.zshenv' | head -n1`
|
|
|
|
|
export ANSIBLE_VAULT_PASSWORD_FILE
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### a tool to reuse a ssh agent (not required)
|
|
|
|
|
@@ -64,7 +65,33 @@ ssh-add ~/.ssh/id_rsa
|
|
|
|
|
ansible -i ,localhost -c local localhost -m raw -a "echo hello world {{ inventory_hostname }} : {{ hostvars | to_nice_json | regex_replace(\"['\n]\",' ') }}"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### local python environment with pipx
|
|
|
|
|
### local python environment with uv
|
|
|
|
|
|
|
|
|
|
#### add dependency
|
|
|
|
|
- `pipx runpip ansible-core install dnspython`
|
|
|
|
|
#### Install UV
|
|
|
|
|
|
|
|
|
|
`python3 -m pip install uv`
|
|
|
|
|
`python3 -m uv python install 3.10 3.11 3.12`
|
|
|
|
|
`echo "export PATH=\"$(find ~/Library/Python/*/bin/uv | xargs dirname)\"" >> ~/.zshenv`
|
|
|
|
|
`echo 'export PATH="~/.local/bin:$PATH"' >> ~/.zshenv`
|
|
|
|
|
|
|
|
|
|
#### Set python version to 3.12
|
|
|
|
|
|
|
|
|
|
`uv python pin 3.12` (edit .python-version file)
|
|
|
|
|
|
|
|
|
|
#### Install ansible
|
|
|
|
|
|
|
|
|
|
`uv tool install ansible-core --with dnspython`
|
|
|
|
|
`echo 'export PATH="~/.local/share/uv/tools/ansible-core/bin:$PATH"' >> ~/.zshenv`
|
|
|
|
|
|
|
|
|
|
#### Install this project depedencies
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
ansible-galaxy collection install --token 11bebd8fd1ad4009f700bdedbeb80b19743ce3d3 -r ansible/requirements.yml # token is used by a rate limiter and can be sensitive
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Run
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
ansible-galaxy collection install ./ansible/arcodange/factory -f
|
|
|
|
|
|
|
|
|
|
```
|