From ad985158b61b7bcf74b92f34e72ce692bc9386e2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Thu, 5 Jul 2018 14:21:26 +0200 Subject: [PATCH] Do not run tasks for containers when on metal Without this patch, ansible parses the includes for containers, even when running on metal, and therefore even if there is no reason to do so. This is a problem because some of those includes rely on variables set by our dynamic inventory, and would fail when running OSA with a static inventory on metal. This patch solves the problem by ensuring the task will not run unnecessarily. Change-Id: I101b121d3d94673597a705979c38ea207043555f --- playbooks/ceph-install.yml | 2 ++ playbooks/ceph-rgw-install.yml | 2 ++ playbooks/common-playbooks/cinder.yml | 2 ++ playbooks/common-playbooks/glance.yml | 7 +++++-- playbooks/common-playbooks/neutron.yml | 3 +++ playbooks/common-playbooks/nova.yml | 2 ++ playbooks/common-tasks/os-lxc-container-setup.yml | 10 ---------- playbooks/common-tasks/os-nspawn-container-setup.yml | 6 ------ playbooks/etcd-install.yml | 2 ++ playbooks/galera-install.yml | 2 ++ playbooks/haproxy-install.yml | 2 ++ playbooks/memcached-install.yml | 2 ++ playbooks/os-aodh-install.yml | 2 ++ playbooks/os-barbican-install.yml | 2 ++ playbooks/os-ceilometer-install.yml | 2 ++ playbooks/os-congress-install.yml | 2 ++ playbooks/os-designate-install.yml | 2 ++ playbooks/os-gnocchi-install.yml | 7 +++++-- playbooks/os-heat-install.yml | 2 ++ playbooks/os-horizon-install.yml | 2 ++ playbooks/os-ironic-install.yml | 2 ++ playbooks/os-keystone-install.yml | 2 ++ playbooks/os-magnum-install.yml | 2 ++ playbooks/os-molteniron-install.yml | 3 +++ playbooks/os-octavia-install.yml | 2 ++ playbooks/os-sahara-install.yml | 2 ++ playbooks/os-swift-install.yml | 3 +++ playbooks/os-tacker-install.yml | 2 ++ playbooks/os-trove-install.yml | 2 ++ playbooks/rabbitmq-install.yml | 2 ++ playbooks/repo-server.yml | 1 + playbooks/rsyslog-install.yml | 3 +++ playbooks/unbound-install.yml | 2 ++ playbooks/utility-install.yml | 2 ++ 34 files changed, 73 insertions(+), 20 deletions(-) diff --git a/playbooks/ceph-install.yml b/playbooks/ceph-install.yml index 5a5cb98661..2fd72327b0 100644 --- a/playbooks/ceph-install.yml +++ b/playbooks/ceph-install.yml @@ -23,6 +23,8 @@ - src: "/openstack/log/{{ inventory_hostname }}-ceph" dest: "/var/log/ceph" - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + when: not is_metal + static: no vars: list_of_bind_mounts: "{{ ceph_container_bind_mounts }}" - include: common-tasks/unbound-clients.yml diff --git a/playbooks/ceph-rgw-install.yml b/playbooks/ceph-rgw-install.yml index fbb6d6a746..e428af35f7 100644 --- a/playbooks/ceph-rgw-install.yml +++ b/playbooks/ceph-rgw-install.yml @@ -27,6 +27,8 @@ dest: "/var/log/ceph" - include: common-tasks/os-lxc-container-setup.yml + when: not is_metal + static: no - name: Gather ceph-mon facts action: setup diff --git a/playbooks/common-playbooks/cinder.yml b/playbooks/common-playbooks/cinder.yml index 6bf4672e36..9045b37f63 100644 --- a/playbooks/common-playbooks/cinder.yml +++ b/playbooks/common-playbooks/cinder.yml @@ -52,6 +52,7 @@ extra_container_config_no_restart: - "lxc.start.order=39" when: + - "not is_metal" - "'cinder_volume' in group_names" - "cinder_backend_lvm_inuse | bool" @@ -59,6 +60,7 @@ include: "../common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" static: no when: + - "not is_metal" - "'cinder_volume' not in group_names" - name: Configure log directories (on metal) diff --git a/playbooks/common-playbooks/glance.yml b/playbooks/common-playbooks/glance.yml index a9b3e21e9c..c2b5df0adf 100644 --- a/playbooks/common-playbooks/glance.yml +++ b/playbooks/common-playbooks/glance.yml @@ -35,18 +35,21 @@ - "groups['glance_api'] | length > 1" - name: Configure container (non-nfs) - static: no include: "../common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" vars: list_of_bind_mounts: "{{ glance_container_bind_mounts }}" + static: no when: + - not is_metal - glance_default_store == "file" - (glance_nfs_client is not defined) or (glance_nfs_client | length == 0) - name: Configure container (nfs) include: "../common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" static: no - when: (glance_default_store != "file") or (glance_nfs_client is defined) + when: + - not is_metal + - (glance_default_store != "file") or (glance_nfs_client is defined) - name: Configure log directories (on metal) include: ../common-tasks/os-log-dir-setup.yml diff --git a/playbooks/common-playbooks/neutron.yml b/playbooks/common-playbooks/neutron.yml index 2d42db4883..a3273ad9ee 100644 --- a/playbooks/common-playbooks/neutron.yml +++ b/playbooks/common-playbooks/neutron.yml @@ -39,12 +39,15 @@ - "lxc.cgroup.devices.allow=a *:* rmw" extra_container_config_no_restart: - "lxc.start.order=29" + static: no when: + - "not is_metal" - "'neutron_agent' in group_names" - name: Configure container (other services) include: "../common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" when: + - "not is_metal" - "'neutron_agent' not in group_names" - name: Configure log directories (on metal) diff --git a/playbooks/common-playbooks/nova.yml b/playbooks/common-playbooks/nova.yml index 19e3b7a1ff..c43c55e9c3 100644 --- a/playbooks/common-playbooks/nova.yml +++ b/playbooks/common-playbooks/nova.yml @@ -63,6 +63,8 @@ - name: Configure container include: "../common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal vars: extra_container_config_no_restart: - "lxc.start.order=39" diff --git a/playbooks/common-tasks/os-lxc-container-setup.yml b/playbooks/common-tasks/os-lxc-container-setup.yml index e2d35d5570..daaccff5b7 100644 --- a/playbooks/common-tasks/os-lxc-container-setup.yml +++ b/playbooks/common-tasks/os-lxc-container-setup.yml @@ -43,8 +43,6 @@ - "{{ lxc_default_bind_mounts | default([]) }}" - "{{ list_of_bind_mounts | default([]) }}" delegate_to: "{{ physical_host }}" - when: - - not is_metal | bool tags: - common-lxc @@ -57,8 +55,6 @@ - "{{ lxc_default_bind_mounts | default([]) }}" - "{{ list_of_bind_mounts | default([]) }}" delegate_to: "{{ physical_host }}" - when: - - not is_metal | bool register: _mc tags: - common-lxc @@ -72,7 +68,6 @@ with_items: "{{ extra_container_config | default([]) }}" delegate_to: "{{ physical_host }}" register: _ec - when: not is_metal | bool tags: - common-lxc @@ -84,7 +79,6 @@ backup: "true" with_items: "{{ extra_container_config_no_restart | default(['lxc.start.order=100']) }}" delegate_to: "{{ physical_host }}" - when: not is_metal | bool tags: - common-lxc @@ -97,7 +91,6 @@ retries: 3 delay: 5 when: - - not is_metal | bool - (_mc is defined and _mc | changed) or (_ec is defined and _ec | changed) # Due to https://github.com/ansible/ansible-modules-extras/issues/2691 @@ -118,7 +111,6 @@ - container_stop.rc not in [0, 2] when: - lxc_container_allow_restarts | default(True) | bool - - not is_metal | bool - (_mc is defined and _mc | changed) or (_ec is defined and _ec | changed) - _lxc_container_state.stdout.find('RUNNING') != -1 tags: @@ -137,7 +129,6 @@ until: container_start | success retries: 3 when: - - not is_metal | bool - (_mc is defined and _mc | changed) or (_ec is defined and _ec | changed) tags: - common-lxc @@ -150,6 +141,5 @@ timeout: "{{ lxc_container_wait_params.timeout | default(omit) }}" when: - (_mc is defined and _mc | changed) or (_ec is defined and _ec | changed) - - not is_metal | bool tags: - common-lxc diff --git a/playbooks/common-tasks/os-nspawn-container-setup.yml b/playbooks/common-tasks/os-nspawn-container-setup.yml index 790a4c87c6..30deb86e8d 100644 --- a/playbooks/common-tasks/os-nspawn-container-setup.yml +++ b/playbooks/common-tasks/os-nspawn-container-setup.yml @@ -44,8 +44,6 @@ with_items: - "{{ list_of_bind_mounts | default([]) }}" delegate_to: "{{ physical_host }}" - when: - - not is_metal | bool tags: - common-nspawn @@ -55,8 +53,6 @@ state: "directory" with_items: - "{{ list_of_bind_mounts | default([]) }}" - when: - - not is_metal | bool tags: - common-nspawn @@ -71,7 +67,6 @@ delegate_to: "{{ physical_host }}" register: _ec when: - - not is_metal | bool - nspawn_systemd_version | int > 219 tags: - common-nspawn @@ -104,7 +99,6 @@ delegate_to: "{{ physical_host }}" register: _ec when: - - not is_metal | bool - list_of_bind_mounts | default([]) - nspawn_systemd_version | int < 220 tags: diff --git a/playbooks/etcd-install.yml b/playbooks/etcd-install.yml index 762fa019e7..772eaf5428 100644 --- a/playbooks/etcd-install.yml +++ b/playbooks/etcd-install.yml @@ -19,6 +19,8 @@ user: root pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/unbound-clients.yml static: no when: diff --git a/playbooks/galera-install.yml b/playbooks/galera-install.yml index 3f74002efb..f9acd119d6 100644 --- a/playbooks/galera-install.yml +++ b/playbooks/galera-install.yml @@ -25,6 +25,8 @@ - src: "/openstack/log/{{ inventory_hostname }}-mysql_logs" dest: "/var/log/mysql_logs" - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal vars: list_of_bind_mounts: "{{ galera_container_bind_mounts }}" extra_container_config_no_restart: diff --git a/playbooks/haproxy-install.yml b/playbooks/haproxy-install.yml index be4a58f4bc..11a6873deb 100644 --- a/playbooks/haproxy-install.yml +++ b/playbooks/haproxy-install.yml @@ -20,6 +20,8 @@ user: root pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/os-log-dir-setup.yml vars: log_dirs: diff --git a/playbooks/memcached-install.yml b/playbooks/memcached-install.yml index 3cb1130776..2f0a98ca80 100644 --- a/playbooks/memcached-install.yml +++ b/playbooks/memcached-install.yml @@ -19,6 +19,8 @@ user: root pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/os-log-dir-setup.yml vars: log_dirs: diff --git a/playbooks/os-aodh-install.yml b/playbooks/os-aodh-install.yml index 35c27c4e04..f5d197c277 100644 --- a/playbooks/os-aodh-install.yml +++ b/playbooks/os-aodh-install.yml @@ -22,6 +22,8 @@ - aodh pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/oslomsg-rpc-vhost-user.yml static: no diff --git a/playbooks/os-barbican-install.yml b/playbooks/os-barbican-install.yml index 05e9a0d6f0..4d03217947 100644 --- a/playbooks/os-barbican-install.yml +++ b/playbooks/os-barbican-install.yml @@ -22,6 +22,8 @@ - barbican pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/oslomsg-rpc-vhost-user.yml static: no diff --git a/playbooks/os-ceilometer-install.yml b/playbooks/os-ceilometer-install.yml index 1dbcf46b72..a4d6e2ab1a 100644 --- a/playbooks/os-ceilometer-install.yml +++ b/playbooks/os-ceilometer-install.yml @@ -19,6 +19,8 @@ user: root pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/oslomsg-rpc-vhost-user.yml static: no diff --git a/playbooks/os-congress-install.yml b/playbooks/os-congress-install.yml index b5d2bedbe8..23ded3e2d6 100644 --- a/playbooks/os-congress-install.yml +++ b/playbooks/os-congress-install.yml @@ -23,6 +23,8 @@ - congress pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - name: Configure log directories (on metal) include: common-tasks/os-log-dir-setup.yml diff --git a/playbooks/os-designate-install.yml b/playbooks/os-designate-install.yml index 53eb64386a..fe1ecc95ef 100644 --- a/playbooks/os-designate-install.yml +++ b/playbooks/os-designate-install.yml @@ -25,6 +25,8 @@ - designate pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/oslomsg-rpc-vhost-user.yml static: no diff --git a/playbooks/os-gnocchi-install.yml b/playbooks/os-gnocchi-install.yml index cd13322e68..5cf6d2ba79 100644 --- a/playbooks/os-gnocchi-install.yml +++ b/playbooks/os-gnocchi-install.yml @@ -21,14 +21,17 @@ - gnocchi pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" - static: no vars: list_of_bind_mounts: "{{ gnocchi_container_bind_mounts }}" - when: (gnocchi_storage_driver == "file") or (gnocchi_storage_driver is not defined) + static: no + when: + - (gnocchi_storage_driver == "file") or (gnocchi_storage_driver is not defined) + - not is_metal - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" static: no when: + - not is_metal - gnocchi_storage_driver is defined - gnocchi_storage_driver != "file" diff --git a/playbooks/os-heat-install.yml b/playbooks/os-heat-install.yml index 7c83b82c28..b148f183de 100644 --- a/playbooks/os-heat-install.yml +++ b/playbooks/os-heat-install.yml @@ -24,6 +24,8 @@ - defaults/repo_packages/openstack_services.yml pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/oslomsg-rpc-vhost-user.yml static: no diff --git a/playbooks/os-horizon-install.yml b/playbooks/os-horizon-install.yml index c0dcf3a703..963a59af62 100644 --- a/playbooks/os-horizon-install.yml +++ b/playbooks/os-horizon-install.yml @@ -22,6 +22,8 @@ - horizon pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/os-log-dir-setup.yml vars: log_dirs: diff --git a/playbooks/os-ironic-install.yml b/playbooks/os-ironic-install.yml index aeff2e6586..ffcc5063ab 100644 --- a/playbooks/os-ironic-install.yml +++ b/playbooks/os-ironic-install.yml @@ -22,6 +22,8 @@ - ironic pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/oslomsg-rpc-vhost-user.yml static: no diff --git a/playbooks/os-keystone-install.yml b/playbooks/os-keystone-install.yml index 42ae58392d..4605469f51 100644 --- a/playbooks/os-keystone-install.yml +++ b/playbooks/os-keystone-install.yml @@ -90,6 +90,8 @@ vars: extra_container_config_no_restart: - "lxc.start.order=19" + static: no + when: not is_metal - name: Configure log directories (on metal) include: common-tasks/os-log-dir-setup.yml diff --git a/playbooks/os-magnum-install.yml b/playbooks/os-magnum-install.yml index 1e68b9f41b..e555948c95 100644 --- a/playbooks/os-magnum-install.yml +++ b/playbooks/os-magnum-install.yml @@ -24,6 +24,8 @@ - magnum pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/os-log-dir-setup.yml vars: diff --git a/playbooks/os-molteniron-install.yml b/playbooks/os-molteniron-install.yml index 30fa46b0cb..89a1619089 100644 --- a/playbooks/os-molteniron-install.yml +++ b/playbooks/os-molteniron-install.yml @@ -22,6 +22,9 @@ vars: extra_container_config_no_restart: - "lxc.start.order=39" + static: no + when: not is_metal + - include: common-tasks/os-log-dir-setup.yml vars: log_dirs: diff --git a/playbooks/os-octavia-install.yml b/playbooks/os-octavia-install.yml index 4fccfd4f3d..9189bcf20c 100644 --- a/playbooks/os-octavia-install.yml +++ b/playbooks/os-octavia-install.yml @@ -22,6 +22,8 @@ - octavia pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/oslomsg-rpc-vhost-user.yml static: no diff --git a/playbooks/os-sahara-install.yml b/playbooks/os-sahara-install.yml index 0a7be9f347..cc1be30e48 100644 --- a/playbooks/os-sahara-install.yml +++ b/playbooks/os-sahara-install.yml @@ -20,6 +20,8 @@ - sahara pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - name: Configure oslo messaging rpc vhost/user include: common-tasks/oslomsg-rpc-vhost-user.yml diff --git a/playbooks/os-swift-install.yml b/playbooks/os-swift-install.yml index 06745ed762..dabe931bbe 100644 --- a/playbooks/os-swift-install.yml +++ b/playbooks/os-swift-install.yml @@ -19,9 +19,12 @@ user: root pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no vars: extra_container_config_no_restart: - "lxc.start.order=39" + when: not is_metal + - include: common-tasks/os-log-dir-setup.yml vars: log_dirs: diff --git a/playbooks/os-tacker-install.yml b/playbooks/os-tacker-install.yml index 5cc07a9f6c..c5ae7b5f29 100644 --- a/playbooks/os-tacker-install.yml +++ b/playbooks/os-tacker-install.yml @@ -22,6 +22,8 @@ - tacker pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/oslomsg-rpc-vhost-user.yml static: no diff --git a/playbooks/os-trove-install.yml b/playbooks/os-trove-install.yml index f07a691617..ffb6aa1275 100644 --- a/playbooks/os-trove-install.yml +++ b/playbooks/os-trove-install.yml @@ -25,6 +25,8 @@ - trove pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/oslomsg-rpc-vhost-user.yml static: no diff --git a/playbooks/rabbitmq-install.yml b/playbooks/rabbitmq-install.yml index e68fa83441..86cb10158f 100644 --- a/playbooks/rabbitmq-install.yml +++ b/playbooks/rabbitmq-install.yml @@ -24,6 +24,8 @@ vars: extra_container_config_no_restart: - "lxc.start.order=19" + when: not is_metal + - include: common-tasks/unbound-clients.yml static: no when: diff --git a/playbooks/repo-server.yml b/playbooks/repo-server.yml index c991e5276e..2e6a389c49 100644 --- a/playbooks/repo-server.yml +++ b/playbooks/repo-server.yml @@ -34,6 +34,7 @@ list_of_bind_mounts: - mount_path: "/openstack/{{ inventory_hostname }}" bind_dir_path: "/var/www" + when: not is_metal - include: common-tasks/unbound-clients.yml static: no diff --git a/playbooks/rsyslog-install.yml b/playbooks/rsyslog-install.yml index f19696b5c8..fc8c53a354 100644 --- a/playbooks/rsyslog-install.yml +++ b/playbooks/rsyslog-install.yml @@ -25,12 +25,15 @@ - not rsyslog_server_enabled | bool - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no vars: list_of_bind_mounts: - bind_dir_path: "{{ rsyslog_server_storage_directory }}" mount_path: "/openstack/{{ inventory_hostname }}/log-storage" extra_container_config_no_restart: - "lxc.start.order=19" + when: not is_metal + - include: common-tasks/unbound-clients.yml static: no when: diff --git a/playbooks/unbound-install.yml b/playbooks/unbound-install.yml index ee50b20c82..2652ede1d2 100644 --- a/playbooks/unbound-install.yml +++ b/playbooks/unbound-install.yml @@ -21,6 +21,8 @@ pre_tasks: - include: common-tasks/os-log-dir-setup.yml - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal roles: - role: "unbound" tags: diff --git a/playbooks/utility-install.yml b/playbooks/utility-install.yml index b58fa142fb..cf26aacdf4 100644 --- a/playbooks/utility-install.yml +++ b/playbooks/utility-install.yml @@ -18,6 +18,8 @@ user: root pre_tasks: - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml" + static: no + when: not is_metal - include: common-tasks/os-log-dir-setup.yml vars: