document uv python package manager command for ansible setup - minor fixes in playbook
This commit is contained in:
1
.python-version
Normal file
1
.python-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.12
|
||||||
@@ -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;
|
ANSIBLE_VAULT_PASSWORD_FILE=~/.local/bin/read-vault-key.sh;
|
||||||
mkdir -p `dirname $ANSIBLE_VAULT_PASSWORD_FILE`; set +o histexpand;
|
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;
|
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)
|
### 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]\",' ') }}"
|
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
|
#### Install UV
|
||||||
- `pipx runpip ansible-core install dnspython`
|
|
||||||
|
`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
|
||||||
|
|
||||||
|
```
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
gitea_version: 1.23.3
|
gitea_version: 1.24.3
|
||||||
|
|
||||||
gitea_partition: |-
|
gitea_partition: |-
|
||||||
{{
|
{{
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ local:
|
|||||||
hosts:
|
hosts:
|
||||||
localhost:
|
localhost:
|
||||||
ansible_connection: local
|
ansible_connection: local
|
||||||
ansible_python_interpreter: /Users/gabrielradureau/.local/pipx/venvs/ansible-core/bin/python
|
|
||||||
pi1:
|
pi1:
|
||||||
pi2:
|
pi2:
|
||||||
pi3:
|
pi3:
|
||||||
|
|||||||
@@ -54,6 +54,6 @@
|
|||||||
'deleted' if gitea_token_delete else
|
'deleted' if gitea_token_delete else
|
||||||
(
|
(
|
||||||
(gitea_api_token_cmd.rc == 0)
|
(gitea_api_token_cmd.rc == 0)
|
||||||
| ternary(gitea_api_token_cmd.stdout, gitea_api_token_cmd_bis.stdout)
|
| ternary(gitea_api_token_cmd.stdout, gitea_api_token_cmd_bis.stdout | default(''))
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
Reference in New Issue
Block a user