add clean dependencies playbook

This commit is contained in:
Gabriel Augendre 2024-10-09 23:14:00 +02:00
parent 559c75c762
commit 191a09a137
2 changed files with 11 additions and 1 deletions

View file

@ -0,0 +1,7 @@
- name: clean ansible venv
hosts: servers
tasks:
- name: remove virtualenv
file:
path: /tmp/ansible
state: absent

View file

@ -8,8 +8,11 @@
- python3-venv - python3-venv
- name: setup venv - name: setup venv
shell: | shell: |
if [ -x /tmp/ansible/bin/python ]; then rm -rf /tmp/ansible; fi if [ -x /tmp/ansible/bin/python ]; then exit 123; fi
/usr/bin/python3 -m venv /tmp/ansible /usr/bin/python3 -m venv /tmp/ansible
/tmp/ansible/bin/pip install --upgrade 'github3.py >= 1.0.0a3' /tmp/ansible/bin/pip install --upgrade 'github3.py >= 1.0.0a3'
args: args:
executable: /bin/bash executable: /bin/bash
register: venv
changed_when: "venv.rc != 123"
failed_when: "venv.rc != 0 and venv.rc != 123"