26 lines
956 B
YAML
26 lines
956 B
YAML
---
|
|
- name: Check if python3 is installed
|
|
ansible.builtin.raw: which python3 || echo "missing"
|
|
register: python_check
|
|
changed_when: false
|
|
|
|
- name: Check OS type for bootstrap
|
|
ansible.builtin.raw: cat /etc/os-release | grep ^ID= | cut -d= -f2 | tr -d '"'
|
|
register: os_id
|
|
changed_when: false
|
|
|
|
- name: Install python3 on Alpine
|
|
ansible.builtin.raw: apk add --no-cache python3
|
|
when: "'missing' in python_check.stdout and 'alpine' in os_id.stdout"
|
|
changed_when: true
|
|
|
|
- name: Install python3 on Debian/Ubuntu
|
|
ansible.builtin.raw: apt-get install -y python3
|
|
when: "'missing' in python_check.stdout and ('debian' in os_id.stdout or 'ubuntu' in os_id.stdout)"
|
|
changed_when: true
|
|
|
|
- name: Install python3 on RHEL/CentOS
|
|
ansible.builtin.raw: dnf install -y python3 || yum install -y python3
|
|
when: "'missing' in python_check.stdout and ('rhel' in os_id.stdout or 'centos' in os_id.stdout or 'fedora' in os_id.stdout)"
|
|
changed_when: true
|