diff --git a/ansible/bifrost.yml b/ansible/bifrost.yml index 1769ce8e22..2adedcc1da 100644 --- a/ansible/bifrost.yml +++ b/ansible/bifrost.yml @@ -1,19 +1,7 @@ --- -- name: Detect openstack_release variable - hosts: bifrost - gather_facts: false - tasks: - - name: Get current kolla-ansible version number - local_action: command python -c "import pbr.version; print(pbr.version.VersionInfo('kolla-ansible'))" - register: kolla_ansible_version - changed_when: false - when: openstack_release == "auto" - - - name: Set openstack_release variable - set_fact: - openstack_release: "{{ kolla_ansible_version.stdout }}" - when: openstack_release == "auto" - tags: always +- import_playbook: detect-release.yml + vars: + detect_release_hosts: bifrost - name: Apply role bifrost hosts: bifrost diff --git a/ansible/detect-release.yml b/ansible/detect-release.yml new file mode 100644 index 0000000000..406a544999 --- /dev/null +++ b/ansible/detect-release.yml @@ -0,0 +1,16 @@ +--- +- name: Detect openstack_release variable + hosts: "{{ detect_release_hosts }}" + gather_facts: false + tasks: + - name: Get current kolla-ansible version number + local_action: command python -c "import pbr.version; print(pbr.version.VersionInfo('kolla-ansible'))" + register: kolla_ansible_version + changed_when: false + when: openstack_release == "auto" + + - name: Set openstack_release variable + set_fact: + openstack_release: "{{ kolla_ansible_version.stdout }}" + when: openstack_release == "auto" + tags: always diff --git a/ansible/mariadb_backup.yml b/ansible/mariadb_backup.yml index 2bd9f9af90..f3a1218863 100644 --- a/ansible/mariadb_backup.yml +++ b/ansible/mariadb_backup.yml @@ -1,19 +1,7 @@ --- -- name: Detect openstack_release variable - hosts: mariadb - gather_facts: false - tasks: - - name: Get current kolla-ansible version number - local_action: command python -c "import pbr.version; print(pbr.version.VersionInfo('kolla-ansible'))" - register: kolla_ansible_version - changed_when: false - when: openstack_release == "auto" - - - name: Set openstack_release variable - set_fact: - openstack_release: "{{ kolla_ansible_version.stdout }}" - when: openstack_release == "auto" - tags: always +- import_playbook: detect-release.yml + vars: + detect_release_hosts: mariadb - name: Backup MariaDB hosts: mariadb diff --git a/ansible/mariadb_recovery.yml b/ansible/mariadb_recovery.yml index 2fed6de36b..a37bf9d5fc 100644 --- a/ansible/mariadb_recovery.yml +++ b/ansible/mariadb_recovery.yml @@ -1,19 +1,7 @@ --- -- name: Detect openstack_release variable - hosts: mariadb - gather_facts: false - tasks: - - name: Get current kolla-ansible version number - local_action: command python -c "import pbr.version; print(pbr.version.VersionInfo('kolla-ansible'))" - register: kolla_ansible_version - changed_when: false - when: openstack_release == "auto" - - - name: Set openstack_release variable - set_fact: - openstack_release: "{{ kolla_ansible_version.stdout }}" - when: openstack_release == "auto" - tags: always +- import_playbook: detect-release.yml + vars: + detect_release_hosts: mariadb - name: Recover mariadb hosts: mariadb diff --git a/ansible/site.yml b/ansible/site.yml index 7c4c54ebdd..1f2cbc2e4d 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -32,21 +32,9 @@ - (ansible_play_batch | length) != (groups['all'] | length) tags: always -- name: Detect openstack_release variable - hosts: all - gather_facts: false - tasks: - - name: Get current kolla-ansible version number - local_action: command python -c "import pbr.version; print(pbr.version.VersionInfo('kolla-ansible'))" - register: kolla_ansible_version - changed_when: false - when: openstack_release == "auto" - - - name: Set openstack_release variable - set_fact: - openstack_release: "{{ kolla_ansible_version.stdout }}" - when: openstack_release == "auto" - tags: always +- import_playbook: detect-release.yml + vars: + detect_release_hosts: all - name: Apply role prechecks gather_facts: false