From d9c69b87200bc583f9c4ddeb19cac129fd88b923 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 21 Feb 2019 20:26:18 -0600 Subject: [PATCH] Remove broken conditions when including playbooks The conditions in our setup playbooks have been broken for a long time however they've not caused any issues because they're not deprecated because the use of "When" with playbook includes is simply ignored. This change removes the conditions which cleans up our setup playbooks. The conditions to exit or execute a given playbook has been moved into the playbook. If the condition is not met then the meta tag is used to exit the playbook and continue. Change-Id: I4e1c2eb1ebb0dfb01e5c98e0fd13272943e9a97c Signed-off-by: Kevin Carter --- playbooks/os-gnocchi-install.yml | 9 ++------- playbooks/os-tempest-install.yml | 7 +++++++ playbooks/repo-build.yml | 16 ++++++++++++++++ playbooks/repo-server.yml | 4 ++++ playbooks/repo-use.yml | 5 +++++ playbooks/setup-infrastructure.yml | 2 -- playbooks/setup-openstack.yml | 9 --------- 7 files changed, 34 insertions(+), 18 deletions(-) diff --git a/playbooks/os-gnocchi-install.yml b/playbooks/os-gnocchi-install.yml index 6c57a307dd..608f594fbe 100644 --- a/playbooks/os-gnocchi-install.yml +++ b/playbooks/os-gnocchi-install.yml @@ -26,14 +26,8 @@ vars: list_of_bind_mounts: "{{ gnocchi_container_bind_mounts }}" when: - - (gnocchi_storage_driver == "file") or (gnocchi_storage_driver is not defined) - not is_metal - - - include_tasks: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" - when: - - not is_metal - - gnocchi_storage_driver is defined - - gnocchi_storage_driver != "file" + - (gnocchi_storage_driver | default('file')) != "file" - include_tasks: common-tasks/os-log-dir-setup.yml vars: @@ -55,6 +49,7 @@ - ceph - role: "os_gnocchi" + gnocchi_identity_only: "{{ ((gnocchi_storage_driver | default('file')) == 'swift') | ternary(true, false)}}" post_tasks: - include_tasks: "common-tasks/rsyslog-client.yml" diff --git a/playbooks/os-tempest-install.yml b/playbooks/os-tempest-install.yml index 1cf6ba09d7..9a1f0e7be0 100644 --- a/playbooks/os-tempest-install.yml +++ b/playbooks/os-tempest-install.yml @@ -19,6 +19,13 @@ user: root vars_files: - "defaults/{{ install_method }}_install.yml" + pre_tasks: + - name: End playbook + meta: end_play + when: + - (not (tempest_install | default(false)) | bool) or + (not (tempest_run | default(false)) | bool) + roles: - role: "os_tempest" - role: "system_crontab_coordination" diff --git a/playbooks/repo-build.yml b/playbooks/repo-build.yml index 1aa8541062..4270388511 100644 --- a/playbooks/repo-build.yml +++ b/playbooks/repo-build.yml @@ -18,6 +18,12 @@ # Serial 1 avoids race conditions, and makes sures the repo_servers # are added in the same order as the repo_all inventory serial: 1 + pre_tasks: + - name: End playbook + meta: end_play + when: + - (install_method | default('source')) != "source" + tasks: - name: Group repo servers by architecture and os version group_by: @@ -32,6 +38,12 @@ # of each of these combinations when deploying. - name: Prepare group of master repo servers hosts: localhost + pre_tasks: + - name: End playbook + meta: end_play + when: + - (install_method | default('source')) != "source" + tasks: - name: Prepare group of master repo servers add_host: @@ -50,6 +62,10 @@ user: root serial: 1 pre_tasks: + - name: End playbook + meta: end_play + when: + - (install_method | default('source')) != "source" - include_tasks: common-tasks/set-pip-vars.yml diff --git a/playbooks/repo-server.yml b/playbooks/repo-server.yml index 795cd77de1..10dae8d6ec 100644 --- a/playbooks/repo-server.yml +++ b/playbooks/repo-server.yml @@ -18,6 +18,10 @@ gather_facts: "{{ osa_gather_facts | default(True) }}" user: root pre_tasks: + - name: End playbook + meta: end_play + when: + - (install_method | default('source')) != "source" - include_tasks: common-tasks/set-pip-vars.yml diff --git a/playbooks/repo-use.yml b/playbooks/repo-use.yml index 23d7cf89bd..8448466e04 100644 --- a/playbooks/repo-use.yml +++ b/playbooks/repo-use.yml @@ -26,6 +26,11 @@ - always - repo-config pre_tasks: + - name: End playbook + meta: end_play + when: + - (install_method | default('source')) != "source" + - include_tasks: common-tasks/package-cache-proxy.yml - include_tasks: common-tasks/set-pip-vars.yml roles: diff --git a/playbooks/setup-infrastructure.yml b/playbooks/setup-infrastructure.yml index 5c46faf152..71bb623006 100644 --- a/playbooks/setup-infrastructure.yml +++ b/playbooks/setup-infrastructure.yml @@ -15,13 +15,11 @@ - import_playbook: unbound-install.yml - import_playbook: repo-install.yml - when: install_method == "source" - import_playbook: haproxy-install.yml # TODO(evrardjp): Remove the following when repo_build is done # before lxc_container_create, and haproxy is moved with it as # second step. - import_playbook: repo-use.yml - when: install_method == "source" - import_playbook: utility-install.yml - import_playbook: memcached-install.yml - import_playbook: galera-install.yml diff --git a/playbooks/setup-openstack.yml b/playbooks/setup-openstack.yml index 7d1ced8685..de55b26a1c 100644 --- a/playbooks/setup-openstack.yml +++ b/playbooks/setup-openstack.yml @@ -22,15 +22,8 @@ - import_playbook: os-heat-install.yml - import_playbook: os-horizon-install.yml - import_playbook: os-designate-install.yml -#NOTE(stevelle) Ensure Gnocchi identities exist before Swift - import_playbook: os-gnocchi-install.yml - when: - - gnocchi_storage_driver is defined - - gnocchi_storage_driver == 'swift' - vars: - gnocchi_identity_only: True - import_playbook: os-swift-install.yml -- import_playbook: os-gnocchi-install.yml - import_playbook: os-ceilometer-install.yml - import_playbook: os-aodh-install.yml - import_playbook: os-ironic-install.yml @@ -46,5 +39,3 @@ - import_playbook: ceph-rgw-install.yml - import_playbook: os-congress-install.yml - import_playbook: os-tempest-install.yml - when: (tempest_install | default(False)) | bool or (tempest_run | default(False)) | bool -