From 6acba3c5d646abeeb0783fa063e5fe6f14bd271d Mon Sep 17 00:00:00 2001 From: Vitaliy Kukharik Date: Tue, 11 Jan 2022 15:28:00 +0300 Subject: [PATCH] add the "always" tag to include_vars and also fix the condition Doc: https://docs.ansible.com/ansible/2.9/user_guide/playbooks_tags.html#special-tags issue #140 --- add_balancer.yml | 2 ++ add_pgnode.yml | 18 ++++++++++++------ balancers.yml | 2 ++ deploy_pgcluster.yml | 18 ++++++++++++------ etcd_cluster.yml | 2 ++ 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/add_balancer.yml b/add_balancer.yml index 564d7ed62..727d8f200 100644 --- a/add_balancer.yml +++ b/add_balancer.yml @@ -17,12 +17,14 @@ - name: Include OS-specific variables include_vars: "vars/{{ ansible_os_family }}.yml" when: not ansible_os_family == 'Rocky' and not ansible_os_family == 'AlmaLinux' + tags: always # For compatibility with Ansible old versions # (support for RockyLinux and AlmaLinux has been added to Ansible 2.11) - name: Include OS-specific variables include_vars: "vars/RedHat.yml" when: ansible_os_family == 'Rocky' or ansible_os_family == 'AlmaLinux' + tags: always - name: Checking Linux distribution fail: diff --git a/add_pgnode.yml b/add_pgnode.yml index 80523859e..fe1026848 100644 --- a/add_pgnode.yml +++ b/add_pgnode.yml @@ -15,12 +15,14 @@ - name: Include OS-specific variables include_vars: "vars/{{ ansible_os_family }}.yml" when: not ansible_os_family == 'Rocky' and not ansible_os_family == 'AlmaLinux' + tags: always # For compatibility with Ansible old versions # (support for RockyLinux and AlmaLinux has been added to Ansible 2.11) - name: Include OS-specific variables include_vars: "vars/RedHat.yml" when: ansible_os_family == 'Rocky' or ansible_os_family == 'AlmaLinux' + tags: always - name: Checking Linux distribution fail: @@ -96,13 +98,15 @@ pre_tasks: - name: Include OS-specific variables include_vars: "vars/{{ ansible_os_family }}.yml" - when: not ansible_os_family == 'Rocky' + when: not ansible_os_family == 'Rocky' and not ansible_os_family == 'AlmaLinux' + tags: always # For compatibility with Ansible old versions - # (support for Rocky Linux has been added to Ansible 2.11) + # (support for RockyLinux and AlmaLinux has been added to Ansible 2.11) - name: Include OS-specific variables include_vars: "vars/RedHat.yml" - when: ansible_os_family == 'Rocky' + when: ansible_os_family == 'Rocky' or ansible_os_family == 'AlmaLinux' + tags: always roles: - role: pgbackrest when: pgbackrest_install|bool @@ -121,13 +125,15 @@ pre_tasks: - name: Include OS-specific variables include_vars: "vars/{{ ansible_os_family }}.yml" - when: not ansible_os_family == 'Rocky' + when: not ansible_os_family == 'Rocky' and not ansible_os_family == 'AlmaLinux' + tags: always # For compatibility with Ansible old versions - # (support for Rocky Linux has been added to Ansible 2.11) + # (support for RockyLinux and AlmaLinux has been added to Ansible 2.11) - name: Include OS-specific variables include_vars: "vars/RedHat.yml" - when: ansible_os_family == 'Rocky' + when: ansible_os_family == 'Rocky' or ansible_os_family == 'AlmaLinux' + tags: always roles: - role: wal-g diff --git a/balancers.yml b/balancers.yml index cd45a8a04..64882e7e8 100644 --- a/balancers.yml +++ b/balancers.yml @@ -16,12 +16,14 @@ - name: Include OS-specific variables include_vars: "vars/{{ ansible_os_family }}.yml" when: not ansible_os_family == 'Rocky' and not ansible_os_family == 'AlmaLinux' + tags: always # For compatibility with Ansible old versions # (support for RockyLinux and AlmaLinux has been added to Ansible 2.11) - name: Include OS-specific variables include_vars: "vars/RedHat.yml" when: ansible_os_family == 'Rocky' or ansible_os_family == 'AlmaLinux' + tags: always - name: Checking Linux distribution fail: diff --git a/deploy_pgcluster.yml b/deploy_pgcluster.yml index 1ad342c01..37ddd1185 100644 --- a/deploy_pgcluster.yml +++ b/deploy_pgcluster.yml @@ -31,12 +31,14 @@ - name: Include OS-specific variables include_vars: "vars/{{ ansible_os_family }}.yml" when: not ansible_os_family == 'Rocky' and not ansible_os_family == 'AlmaLinux' + tags: always # For compatibility with Ansible old versions # (support for RockyLinux and AlmaLinux has been added to Ansible 2.11) - name: Include OS-specific variables include_vars: "vars/RedHat.yml" when: ansible_os_family == 'Rocky' or ansible_os_family == 'AlmaLinux' + tags: always - name: Checking Linux distribution fail: @@ -118,13 +120,15 @@ pre_tasks: - name: Include OS-specific variables include_vars: "vars/{{ ansible_os_family }}.yml" - when: not ansible_os_family == 'Rocky' + when: not ansible_os_family == 'Rocky' and not ansible_os_family == 'AlmaLinux' + tags: always # For compatibility with Ansible old versions - # (support for Rocky Linux has been added to Ansible 2.11) + # (support for RockyLinux and AlmaLinux has been added to Ansible 2.11) - name: Include OS-specific variables include_vars: "vars/RedHat.yml" - when: ansible_os_family == 'Rocky' + when: ansible_os_family == 'Rocky' or ansible_os_family == 'AlmaLinux' + tags: always roles: - role: pgbackrest when: pgbackrest_install|bool @@ -141,13 +145,15 @@ pre_tasks: - name: Include OS-specific variables include_vars: "vars/{{ ansible_os_family }}.yml" - when: not ansible_os_family == 'Rocky' + when: not ansible_os_family == 'Rocky' and not ansible_os_family == 'AlmaLinux' + tags: always # For compatibility with Ansible old versions - # (support for Rocky Linux has been added to Ansible 2.11) + # (support for RockyLinux and AlmaLinux has been added to Ansible 2.11) - name: Include OS-specific variables include_vars: "vars/RedHat.yml" - when: ansible_os_family == 'Rocky' + when: ansible_os_family == 'Rocky' or ansible_os_family == 'AlmaLinux' + tags: always roles: - role: wal-g diff --git a/etcd_cluster.yml b/etcd_cluster.yml index 0f935c93d..daa9b14f1 100644 --- a/etcd_cluster.yml +++ b/etcd_cluster.yml @@ -14,12 +14,14 @@ - name: Include OS-specific variables include_vars: "vars/{{ ansible_os_family }}.yml" when: not ansible_os_family == 'Rocky' and not ansible_os_family == 'AlmaLinux' + tags: always # For compatibility with Ansible old versions # (support for RockyLinux and AlmaLinux has been added to Ansible 2.11) - name: Include OS-specific variables include_vars: "vars/RedHat.yml" when: ansible_os_family == 'Rocky' or ansible_os_family == 'AlmaLinux' + tags: always - name: Update apt cache apt: