ansible/playbooks/dependencies/01-setup-deps.yaml

22 lines
647 B
YAML
Raw Normal View History

2024-10-10 23:30:37 +02:00
---
- name: Setup ansible python dependencies
2024-10-09 22:53:35 +02:00
hosts: servers
2024-10-10 23:55:47 +02:00
gather_facts: false
2024-10-09 22:53:35 +02:00
tasks:
2024-10-10 23:30:37 +02:00
- name: Install system deps
2024-10-09 22:53:35 +02:00
become: true
2024-10-10 23:30:37 +02:00
ansible.builtin.apt:
2024-10-09 22:53:35 +02:00
pkg:
- python3-venv
2024-10-10 23:30:37 +02:00
- name: Setup venv
# github3.py required by the goatcounter playbook
2024-10-10 23:30:37 +02:00
ansible.builtin.shell: |
2024-10-09 23:14:00 +02:00
if [ -x /tmp/ansible/bin/python ]; then exit 123; fi
2024-10-09 22:53:35 +02:00
/usr/bin/python3 -m venv /tmp/ansible
/tmp/ansible/bin/pip install --upgrade 'github3.py >= 1.0.0a3'
args:
executable: /bin/bash
2024-10-09 23:14:00 +02:00
register: venv
2024-10-10 23:30:37 +02:00
changed_when: venv.rc != 123
failed_when: venv.rc != 0 and venv.rc != 123