|
17 | 17 | ansible.builtin.set_fact: |
18 | 18 | ansible_python_interpreter: /usr/bin/python3 |
19 | 19 | when: |
20 | | - - ansible_distribution == 'Debian' |
21 | | - - ansible_distribution_major_version|int >= 11 |
| 20 | + - ansible_facts.distribution == 'Debian' |
| 21 | + - ansible_facts.distribution_major_version|int >= 11 |
22 | 22 |
|
23 | 23 | - name: Use Python 3 on Suse |
24 | 24 | ansible.builtin.set_fact: |
25 | 25 | ansible_python_interpreter: /usr/bin/python3 |
26 | 26 | when: |
27 | | - - ansible_os_family == 'Suse' |
| 27 | + - ansible_facts.os_family == 'Suse' |
28 | 28 |
|
29 | 29 | - name: Run the equivalent of "apt-get update && apt-get upgrade" |
30 | 30 | ansible.builtin.apt: |
31 | 31 | upgrade: safe |
32 | 32 | update_cache: true |
33 | | - when: ansible_os_family == 'Debian' |
| 33 | + when: ansible_facts.os_family == 'Debian' |
34 | 34 |
|
35 | 35 | - name: Install required python packages on Suse |
36 | 36 | ansible.builtin.command: zypper -n install python311-rpm python311-PyMySQL |
37 | 37 | changed_when: false |
38 | | - when: ansible_os_family == 'Suse' |
| 38 | + when: ansible_facts.os_family == 'Suse' |
39 | 39 |
|
40 | 40 | - name: Create missing directory |
41 | 41 | ansible.builtin.file: |
|
48 | 48 | mysql_python_package_debian: python3-pymysql |
49 | 49 | when: |
50 | 50 | - mysql_python_package_debian is not defined |
51 | | - - ansible_distribution == "Ubuntu" |
52 | | - - ansible_distribution_major_version|int > 19 |
| 51 | + - ansible_facts.distribution == "Ubuntu" |
| 52 | + - ansible_facts.distribution_major_version|int > 19 |
53 | 53 |
|
54 | 54 | - name: Determine required MySQL Python libraries. |
55 | 55 | ansible.builtin.set_fact: |
56 | 56 | mysql_python_package_debian: "{% if 'python3' in ansible_python_interpreter | default('') %}python3-mysqldb{% else %}python-mysqldb{% endif %}" |
57 | 57 | when: |
58 | 58 | - mysql_python_package_debian is not defined |
59 | | - - ansible_distribution != "Ubuntu" |
60 | | - - ansible_distribution_major_version|int < 20 |
| 59 | + - ansible_facts.distribution != "Ubuntu" |
| 60 | + - ansible_facts.distribution_major_version|int < 20 |
61 | 61 |
|
62 | 62 | - name: Install required MySQL Python libraries on RHEL |
63 | 63 | ansible.builtin.dnf: |
64 | 64 | name: "{% if 'python3' in ansible_python_interpreter | default('') %}python36-PyMySQL{% else %}python2-PyMySQL{% endif %}" |
65 | 65 | when: |
66 | | - - ansible_os_family == "RedHat" |
67 | | - - ansible_distribution_major_version == "7" |
| 66 | + - ansible_facts.os_family == "RedHat" |
| 67 | + - ansible_facts.distribution_major_version == "7" |
68 | 68 |
|
69 | 69 | - name: Install mysql with a generic Ansible role |
70 | 70 | ansible.builtin.include_role: |
|
0 commit comments