diff --git a/ansible/roles/aodh/tasks/do_reconfigure.yml b/ansible/roles/aodh/tasks/do_reconfigure.yml deleted file mode 100644 index c915b500d1..0000000000 --- a/ansible/roles/aodh/tasks/do_reconfigure.yml +++ /dev/null @@ -1,79 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: aodh_api, group: aodh-api } - - { name: aodh_listener, group: aodh-listener } - - { name: aodh_evaluator, group: aodh-evaluator } - - { name: aodh_notifier, group: aodh-notifier } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: aodh_api, group: aodh-api } - - { name: aodh_listener, group: aodh-listener } - - { name: aodh_evaluator, group: aodh-evaluator } - - { name: aodh_notifier, group: aodh-notifier } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: aodh_api, group: aodh-api } - - { name: aodh_listener, group: aodh-listener } - - { name: aodh_evaluator, group: aodh-evaluator } - - { name: aodh_notifier, group: aodh-notifier } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: aodh_api, group: aodh-api }, - { name: aodh_listener, group: aodh-listener }, - { name: aodh_evaluator, group: aodh-evaluator }, - { name: aodh_notifier, group: aodh-notifier }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: aodh_api, group: aodh-api }, - { name: aodh_listener, group: aodh-listener }, - { name: aodh_evaluator, group: aodh-evaluator }, - { name: aodh_notifier, group: aodh-notifier }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/aodh/tasks/reconfigure.yml b/ansible/roles/aodh/tasks/reconfigure.yml index fa2921b205..c915b500d1 100644 --- a/ansible/roles/aodh/tasks/reconfigure.yml +++ b/ansible/roles/aodh/tasks/reconfigure.yml @@ -1,6 +1,79 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['aodh-api'] - or inventory_hostname in groups['aodh-listener'] - or inventory_hostname in groups['aodh-evaluator'] - or inventory_hostname in groups['aodh-notifier'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: aodh_api, group: aodh-api } + - { name: aodh_listener, group: aodh-listener } + - { name: aodh_evaluator, group: aodh-evaluator } + - { name: aodh_notifier, group: aodh-notifier } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: aodh_api, group: aodh-api } + - { name: aodh_listener, group: aodh-listener } + - { name: aodh_evaluator, group: aodh-evaluator } + - { name: aodh_notifier, group: aodh-notifier } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: aodh_api, group: aodh-api } + - { name: aodh_listener, group: aodh-listener } + - { name: aodh_evaluator, group: aodh-evaluator } + - { name: aodh_notifier, group: aodh-notifier } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: aodh_api, group: aodh-api }, + { name: aodh_listener, group: aodh-listener }, + { name: aodh_evaluator, group: aodh-evaluator }, + { name: aodh_notifier, group: aodh-notifier }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: aodh_api, group: aodh-api }, + { name: aodh_listener, group: aodh-listener }, + { name: aodh_evaluator, group: aodh-evaluator }, + { name: aodh_notifier, group: aodh-notifier }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/barbican/tasks/do_reconfigure.yml b/ansible/roles/barbican/tasks/do_reconfigure.yml deleted file mode 100644 index 84f378665f..0000000000 --- a/ansible/roles/barbican/tasks/do_reconfigure.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: barbican_api, group: barbican-api } - - { name: barbican_keystone_listener, group: barbican-keystone-listener } - - { name: barbican_worker, group: barbican-worker } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: barbican_api, group: barbican-api } - - { name: barbican_keystone_listener, group: barbican-keystone-listener } - - { name: barbican_worker, group: barbican-worker } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: barbican_api, group: barbican-api } - - { name: barbican_keystone_listener, group: barbican-keystone-listener } - - { name: barbican_worker, group: barbican-worker } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: barbican_api, group: barbican-api }, - { name: barbican_keystone_listener, group: barbican-keystone-listener }, - { name: barbican_worker, group: barbican-worker }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: barbican_api, group: barbican-api }, - { name: barbican_keystone_listener, group: barbican-keystone-listener }, - { name: barbican_worker, group: barbican-worker }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/barbican/tasks/reconfigure.yml b/ansible/roles/barbican/tasks/reconfigure.yml index 6906fb6d88..84f378665f 100644 --- a/ansible/roles/barbican/tasks/reconfigure.yml +++ b/ansible/roles/barbican/tasks/reconfigure.yml @@ -1,5 +1,74 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['barbican-api'] - or inventory_hostname in groups['barbican-keystone-listener'] - or inventory_hostname in groups['barbican-worker'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: barbican_api, group: barbican-api } + - { name: barbican_keystone_listener, group: barbican-keystone-listener } + - { name: barbican_worker, group: barbican-worker } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: barbican_api, group: barbican-api } + - { name: barbican_keystone_listener, group: barbican-keystone-listener } + - { name: barbican_worker, group: barbican-worker } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: barbican_api, group: barbican-api } + - { name: barbican_keystone_listener, group: barbican-keystone-listener } + - { name: barbican_worker, group: barbican-worker } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: barbican_api, group: barbican-api }, + { name: barbican_keystone_listener, group: barbican-keystone-listener }, + { name: barbican_worker, group: barbican-worker }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: barbican_api, group: barbican-api }, + { name: barbican_keystone_listener, group: barbican-keystone-listener }, + { name: barbican_worker, group: barbican-worker }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/ceilometer/tasks/do_reconfigure.yml b/ansible/roles/ceilometer/tasks/do_reconfigure.yml deleted file mode 100644 index e0e1df5102..0000000000 --- a/ansible/roles/ceilometer/tasks/do_reconfigure.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: ceilometer_api, group: ceilometer-api } - - { name: ceilometer_central, group: ceilometer-central } - - { name: ceilometer_notification, group: ceilometer-notification } - - { name: ceilometer_collector, group: ceilometer-collector } - - { name: ceilometer_compute, group: ceilometer-compute } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: ceilometer_api, group: ceilometer-api } - - { name: ceilometer_central, group: ceilometer-central } - - { name: ceilometer_notification, group: ceilometer-notification } - - { name: ceilometer_collector, group: ceilometer-collector } - - { name: ceilometer_compute, group: ceilometer-compute } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: ceilometer_api, group: ceilometer-api } - - { name: ceilometer_central, group: ceilometer-central } - - { name: ceilometer_notification, group: ceilometer-notification } - - { name: ceilometer_collector, group: ceilometer-collector } - - { name: ceilometer_compute, group: ceilometer-compute } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: ceilometer_api, group: ceilometer-api }, - { name: ceilometer_central, group: ceilometer-central }, - { name: ceilometer_notification, group: ceilometer-notification }, - { name: ceilometer_collector, group: ceilometer-collector }, - { name: ceilometer_compute, group: ceilometer-compute }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: ceilometer_api, group: ceilometer-api }, - { name: ceilometer_central, group: ceilometer-central }, - { name: ceilometer_notification, group: ceilometer-notification }, - { name: ceilometer_collector, group: ceilometer-collector }, - { name: ceilometer_compute, group: ceilometer-compute }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/ceilometer/tasks/reconfigure.yml b/ansible/roles/ceilometer/tasks/reconfigure.yml index 7ae9d9d8ce..e0e1df5102 100644 --- a/ansible/roles/ceilometer/tasks/reconfigure.yml +++ b/ansible/roles/ceilometer/tasks/reconfigure.yml @@ -1,7 +1,84 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['ceilometer-api'] - or inventory_hostname in groups['ceilometer-central'] - or inventory_hostname in groups['ceilometer-notification'] - or inventory_hostname in groups['ceilometer-collector'] - or inventory_hostname in groups['ceilometer-compute'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: ceilometer_api, group: ceilometer-api } + - { name: ceilometer_central, group: ceilometer-central } + - { name: ceilometer_notification, group: ceilometer-notification } + - { name: ceilometer_collector, group: ceilometer-collector } + - { name: ceilometer_compute, group: ceilometer-compute } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: ceilometer_api, group: ceilometer-api } + - { name: ceilometer_central, group: ceilometer-central } + - { name: ceilometer_notification, group: ceilometer-notification } + - { name: ceilometer_collector, group: ceilometer-collector } + - { name: ceilometer_compute, group: ceilometer-compute } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: ceilometer_api, group: ceilometer-api } + - { name: ceilometer_central, group: ceilometer-central } + - { name: ceilometer_notification, group: ceilometer-notification } + - { name: ceilometer_collector, group: ceilometer-collector } + - { name: ceilometer_compute, group: ceilometer-compute } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: ceilometer_api, group: ceilometer-api }, + { name: ceilometer_central, group: ceilometer-central }, + { name: ceilometer_notification, group: ceilometer-notification }, + { name: ceilometer_collector, group: ceilometer-collector }, + { name: ceilometer_compute, group: ceilometer-compute }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: ceilometer_api, group: ceilometer-api }, + { name: ceilometer_central, group: ceilometer-central }, + { name: ceilometer_notification, group: ceilometer-notification }, + { name: ceilometer_collector, group: ceilometer-collector }, + { name: ceilometer_compute, group: ceilometer-compute }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/ceph/tasks/do_reconfigure.yml b/ansible/roles/ceph/tasks/do_reconfigure.yml deleted file mode 100644 index ee7a78779f..0000000000 --- a/ansible/roles/ceph/tasks/do_reconfigure.yml +++ /dev/null @@ -1,214 +0,0 @@ ---- -- name: Ensuring the ceph_mon container is up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: ceph_mon_container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: ceph_mon, group: ceph-mon } - -- name: Looking up OSDs for Ceph - command: docker exec -t kolla_toolbox sudo -E /usr/bin/ansible localhost - -m find_disks - -a "partition_name='KOLLA_CEPH_DATA' match_mode='prefix'" - register: osd_lookup - changed_when: "{{ osd_lookup.stdout.find('localhost | SUCCESS => ') != -1 and (osd_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - failed_when: osd_lookup.stdout.split()[2] != 'SUCCESS' - when: inventory_hostname in groups['ceph-osd'] - -- name: Reading data from variable - set_fact: - osds: "{{ (osd_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).disks|from_json }}" - when: inventory_hostname in groups['ceph-osd'] - -- name: Gathering OSD IDs - command: "cat /var/lib/ceph/osd/{{ item['fs_uuid'] }}/whoami" - with_items: "{{ osds }}" - register: osd_ids - changed_when: False - failed_when: osd_ids.rc != 0 - when: inventory_hostname in groups['ceph-osd'] - -- name: Ensuring the ceph_osd container is up - kolla_docker: - name: "ceph_osd_{{ item.stdout }}" - action: "get_container_state" - register: ceph_osd_container_state - failed_when: ceph_osd_container_state.Running == false - when: inventory_hostname in groups['ceph-osd'] - with_items: "{{ osd_ids.results }}" - -- name: Ensuring the ceph_rgw container is up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: ceph_rgw_container_state - failed_when: container_state.Running == false - when: - - enable_ceph_rgw | bool - - inventory_hostname in groups[item.group] - with_items: - - { name: ceph_rgw, group: ceph-rgw } - -- include: config.yml - -- name: Check the configs in ceph_mon container - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: ceph_mon_check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: ceph_mon, group: ceph-mon } - -- name: Check the configs in the ceph_osd container - command: docker exec ceph_osd_{{ item.stdout }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: ceph_osd_check_results - with_items: "{{ osd_ids.results }}" - when: inventory_hostname in groups['ceph-osd'] - -- name: Check the configs in ceph_rgw container - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: ceph_rgw_check_results - when: - - inventory_hostname in groups[item.group] - - enable_ceph_rgw | bool - with_items: - - { name: ceph_rgw, group: ceph-rgw} - -- name: Containers config strategy for ceph_mon container - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: ceph_mon_container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: ceph_mon, group: ceph-mon } - -- name: Containers config strategy for the ceph_osd containers - kolla_docker: - name: "ceph_osd_{{ item.stdout }}" - action: "get_container_env" - register: ceph_osd_container_envs - with_items: "{{ osd_ids.results }}" - when: - - inventory_hostname in groups['ceph-osd'] - - osds - -- name: Containers config strategy for ceph_rgw container - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: ceph_rgw_container_envs - when: - - inventory_hostname in groups[item.group] - - enable_ceph_rgw | bool - with_items: - - { name: ceph_rgw, group: ceph-rgw } - -- name: Remove the ceph_mon container - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_ceph_mon_container - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: ceph_mon, group: ceph-mon }] - - "{{ ceph_mon_container_envs.results }}" - - "{{ ceph_mon_check_results.results }}" - -- name: Remove the ceph_osd containers - kolla_docker: - name: "ceph_osd_{{ item.0.stdout }}" - action: "remove_container" - register: remove_ceph_osd_containers - when: - - inventory_hostname in groups['ceph-osd'] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - osds - with_together: - - "{{ osd_ids.results }}" - - "{{ ceph_osd_container_envs.results }}" - - "{{ ceph_osd_check_results.results }}" - -- name: Remove the ceph_rgw container - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_ceph_rgw_container - when: - - enable_ceph_rgw | bool - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: ceph_rgw, group: ceph-rgw }] - - "{{ ceph_rgw_container_envs.results }}" - - "{{ ceph_rgw_check_results.results }}" - -- include: start_mons.yml - when: - - inventory_hostname in groups['ceph-mon'] - - remove_ceph_mon_container.changed - -- include: start_osds.yml - when: - - inventory_hostname in groups['ceph-osd'] - - remove_ceph_osd_containers.changed - -- include: start_rgws.yml - when: - - inventory_hostname in groups['ceph-rgw'] - - remove_ceph_rgw_container.changed - -- name: Restart the ceph_mon container - kolla_docker: - name: "ceph_mon" - action: "restart_container" - when: - - inventory_hostname in groups['ceph-mon'] - - config_strategy == 'COPY_ALWAYS' - - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[1]['rc'] == 1 - with_together: - - "{{ ceph_mon_container_envs.results }}" - - "{{ ceph_mon_check_results.results }}" - -- name: Restart the ceph_osd container - kolla_docker: - name: "ceph_osd_{{ item.0.stdout }}" - action: "restart_container" - when: - - inventory_hostname in groups['ceph-osd'] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - osds - with_together: - - "{{ osd_ids.results }}" - - "{{ ceph_osd_container_envs.results }}" - - "{{ ceph_osd_check_results.results }}" - -- name: Restart the ceph_rgw container - kolla_docker: - name: "ceph_rgw" - action: "restart_container" - when: - - enable_ceph_rgw | bool - - inventory_hostname in groups['ceph-rgw'] - - config_strategy == 'COPY_ALWAYS' - - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[1]['rc'] == 1 - with_together: - - "{{ ceph_rgw_container_envs.results }}" - - "{{ ceph_rgw_check_results.results }}" diff --git a/ansible/roles/ceph/tasks/reconfigure.yml b/ansible/roles/ceph/tasks/reconfigure.yml index a725c8324c..ee7a78779f 100644 --- a/ansible/roles/ceph/tasks/reconfigure.yml +++ b/ansible/roles/ceph/tasks/reconfigure.yml @@ -1,5 +1,214 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['ceph-mon'] - or inventory_hostname in groups['ceph-rgw'] - or inventory_hostname in groups['ceph-osd'] +- name: Ensuring the ceph_mon container is up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: ceph_mon_container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: ceph_mon, group: ceph-mon } + +- name: Looking up OSDs for Ceph + command: docker exec -t kolla_toolbox sudo -E /usr/bin/ansible localhost + -m find_disks + -a "partition_name='KOLLA_CEPH_DATA' match_mode='prefix'" + register: osd_lookup + changed_when: "{{ osd_lookup.stdout.find('localhost | SUCCESS => ') != -1 and (osd_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + failed_when: osd_lookup.stdout.split()[2] != 'SUCCESS' + when: inventory_hostname in groups['ceph-osd'] + +- name: Reading data from variable + set_fact: + osds: "{{ (osd_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).disks|from_json }}" + when: inventory_hostname in groups['ceph-osd'] + +- name: Gathering OSD IDs + command: "cat /var/lib/ceph/osd/{{ item['fs_uuid'] }}/whoami" + with_items: "{{ osds }}" + register: osd_ids + changed_when: False + failed_when: osd_ids.rc != 0 + when: inventory_hostname in groups['ceph-osd'] + +- name: Ensuring the ceph_osd container is up + kolla_docker: + name: "ceph_osd_{{ item.stdout }}" + action: "get_container_state" + register: ceph_osd_container_state + failed_when: ceph_osd_container_state.Running == false + when: inventory_hostname in groups['ceph-osd'] + with_items: "{{ osd_ids.results }}" + +- name: Ensuring the ceph_rgw container is up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: ceph_rgw_container_state + failed_when: container_state.Running == false + when: + - enable_ceph_rgw | bool + - inventory_hostname in groups[item.group] + with_items: + - { name: ceph_rgw, group: ceph-rgw } + +- include: config.yml + +- name: Check the configs in ceph_mon container + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: ceph_mon_check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: ceph_mon, group: ceph-mon } + +- name: Check the configs in the ceph_osd container + command: docker exec ceph_osd_{{ item.stdout }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: ceph_osd_check_results + with_items: "{{ osd_ids.results }}" + when: inventory_hostname in groups['ceph-osd'] + +- name: Check the configs in ceph_rgw container + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: ceph_rgw_check_results + when: + - inventory_hostname in groups[item.group] + - enable_ceph_rgw | bool + with_items: + - { name: ceph_rgw, group: ceph-rgw} + +- name: Containers config strategy for ceph_mon container + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: ceph_mon_container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: ceph_mon, group: ceph-mon } + +- name: Containers config strategy for the ceph_osd containers + kolla_docker: + name: "ceph_osd_{{ item.stdout }}" + action: "get_container_env" + register: ceph_osd_container_envs + with_items: "{{ osd_ids.results }}" + when: + - inventory_hostname in groups['ceph-osd'] + - osds + +- name: Containers config strategy for ceph_rgw container + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: ceph_rgw_container_envs + when: + - inventory_hostname in groups[item.group] + - enable_ceph_rgw | bool + with_items: + - { name: ceph_rgw, group: ceph-rgw } + +- name: Remove the ceph_mon container + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_ceph_mon_container + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: ceph_mon, group: ceph-mon }] + - "{{ ceph_mon_container_envs.results }}" + - "{{ ceph_mon_check_results.results }}" + +- name: Remove the ceph_osd containers + kolla_docker: + name: "ceph_osd_{{ item.0.stdout }}" + action: "remove_container" + register: remove_ceph_osd_containers + when: + - inventory_hostname in groups['ceph-osd'] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - osds + with_together: + - "{{ osd_ids.results }}" + - "{{ ceph_osd_container_envs.results }}" + - "{{ ceph_osd_check_results.results }}" + +- name: Remove the ceph_rgw container + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_ceph_rgw_container + when: + - enable_ceph_rgw | bool + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: ceph_rgw, group: ceph-rgw }] + - "{{ ceph_rgw_container_envs.results }}" + - "{{ ceph_rgw_check_results.results }}" + +- include: start_mons.yml + when: + - inventory_hostname in groups['ceph-mon'] + - remove_ceph_mon_container.changed + +- include: start_osds.yml + when: + - inventory_hostname in groups['ceph-osd'] + - remove_ceph_osd_containers.changed + +- include: start_rgws.yml + when: + - inventory_hostname in groups['ceph-rgw'] + - remove_ceph_rgw_container.changed + +- name: Restart the ceph_mon container + kolla_docker: + name: "ceph_mon" + action: "restart_container" + when: + - inventory_hostname in groups['ceph-mon'] + - config_strategy == 'COPY_ALWAYS' + - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[1]['rc'] == 1 + with_together: + - "{{ ceph_mon_container_envs.results }}" + - "{{ ceph_mon_check_results.results }}" + +- name: Restart the ceph_osd container + kolla_docker: + name: "ceph_osd_{{ item.0.stdout }}" + action: "restart_container" + when: + - inventory_hostname in groups['ceph-osd'] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - osds + with_together: + - "{{ osd_ids.results }}" + - "{{ ceph_osd_container_envs.results }}" + - "{{ ceph_osd_check_results.results }}" + +- name: Restart the ceph_rgw container + kolla_docker: + name: "ceph_rgw" + action: "restart_container" + when: + - enable_ceph_rgw | bool + - inventory_hostname in groups['ceph-rgw'] + - config_strategy == 'COPY_ALWAYS' + - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[1]['rc'] == 1 + with_together: + - "{{ ceph_rgw_container_envs.results }}" + - "{{ ceph_rgw_check_results.results }}" diff --git a/ansible/roles/cinder/tasks/do_reconfigure.yml b/ansible/roles/cinder/tasks/do_reconfigure.yml deleted file mode 100644 index af453c8875..0000000000 --- a/ansible/roles/cinder/tasks/do_reconfigure.yml +++ /dev/null @@ -1,79 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: cinder_api, group: cinder-api } - - { name: cinder_scheduler, group: cinder-scheduler } - - { name: cinder_volume, group: cinder-volume } - - { name: cinder_backup, group: cinder-backup } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: cinder_api, group: cinder-api } - - { name: cinder_scheduler, group: cinder-scheduler } - - { name: cinder_volume, group: cinder-volume } - - { name: cinder_backup, group: cinder-backup } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: cinder_api, group: cinder-api } - - { name: cinder_scheduler, group: cinder-scheduler } - - { name: cinder_volume, group: cinder-volume } - - { name: cinder_backup, group: cinder-backup } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: cinder_api, group: cinder-api }, - { name: cinder_scheduler, group: cinder-scheduler }, - { name: cinder_volume, group: cinder-volume }, - { name: cinder_backup, group: cinder-backup }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: cinder_api, group: cinder-api }, - { name: cinder_scheduler, group: cinder-scheduler }, - { name: cinder_volume, group: cinder-volume }, - { name: cinder_backup, group: cinder-backup }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/cinder/tasks/reconfigure.yml b/ansible/roles/cinder/tasks/reconfigure.yml index 844ed9e3e8..af453c8875 100644 --- a/ansible/roles/cinder/tasks/reconfigure.yml +++ b/ansible/roles/cinder/tasks/reconfigure.yml @@ -1,6 +1,79 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['cinder-api'] - or inventory_hostname in groups['cinder-scheduler'] - or inventory_hostname in groups['cinder-volume'] - or inventory_hostname in groups['cinder-backup'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: cinder_api, group: cinder-api } + - { name: cinder_scheduler, group: cinder-scheduler } + - { name: cinder_volume, group: cinder-volume } + - { name: cinder_backup, group: cinder-backup } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: cinder_api, group: cinder-api } + - { name: cinder_scheduler, group: cinder-scheduler } + - { name: cinder_volume, group: cinder-volume } + - { name: cinder_backup, group: cinder-backup } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: cinder_api, group: cinder-api } + - { name: cinder_scheduler, group: cinder-scheduler } + - { name: cinder_volume, group: cinder-volume } + - { name: cinder_backup, group: cinder-backup } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: cinder_api, group: cinder-api }, + { name: cinder_scheduler, group: cinder-scheduler }, + { name: cinder_volume, group: cinder-volume }, + { name: cinder_backup, group: cinder-backup }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: cinder_api, group: cinder-api }, + { name: cinder_scheduler, group: cinder-scheduler }, + { name: cinder_volume, group: cinder-volume }, + { name: cinder_backup, group: cinder-backup }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/cloudkitty/tasks/do_reconfigure.yml b/ansible/roles/cloudkitty/tasks/do_reconfigure.yml deleted file mode 100644 index 6cd265dfc1..0000000000 --- a/ansible/roles/cloudkitty/tasks/do_reconfigure.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: cloudkitty_api, group: cloudkitty-api } - - { name: cloudkitty_processor, group: cloudkitty-processor } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: cloudkitty_api, group: cloudkitty-api } - - { name: cloudkitty_processor, group: cloudkitty-processor } - -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: cloudkitty_api, group: cloudkitty-api } - - { name: cloudkitty_processor, group: cloudkitty-processor } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: cloudkitty_api, group: cloudkitty-api }, - { name: cloudkitty_processor, group: cloudkitty-processor }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: cloudkitty_api, group: cloudkitty-api }, - { name: cloudkitty_processor, group: cloudkitty-processor }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/cloudkitty/tasks/reconfigure.yml b/ansible/roles/cloudkitty/tasks/reconfigure.yml index 6180f5be60..6cd265dfc1 100644 --- a/ansible/roles/cloudkitty/tasks/reconfigure.yml +++ b/ansible/roles/cloudkitty/tasks/reconfigure.yml @@ -1,4 +1,66 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['cloudkitty-api'] - or inventory_hostname in groups['cloudkitty-processor'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: cloudkitty_api, group: cloudkitty-api } + - { name: cloudkitty_processor, group: cloudkitty-processor } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: cloudkitty_api, group: cloudkitty-api } + - { name: cloudkitty_processor, group: cloudkitty-processor } + +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: cloudkitty_api, group: cloudkitty-api } + - { name: cloudkitty_processor, group: cloudkitty-processor } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: cloudkitty_api, group: cloudkitty-api }, + { name: cloudkitty_processor, group: cloudkitty-processor }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: cloudkitty_api, group: cloudkitty-api }, + { name: cloudkitty_processor, group: cloudkitty-processor }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/collectd/tasks/do_reconfigure.yml b/ansible/roles/collectd/tasks/do_reconfigure.yml deleted file mode 100644 index 602850983e..0000000000 --- a/ansible/roles/collectd/tasks/do_reconfigure.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: collectd, group: collectd } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: collectd, group: collectd } - -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: collectd, group: collectd } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: collectd, group: collectd }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: collectd, group: collectd }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/collectd/tasks/reconfigure.yml b/ansible/roles/collectd/tasks/reconfigure.yml index 859dc5cc00..602850983e 100644 --- a/ansible/roles/collectd/tasks/reconfigure.yml +++ b/ansible/roles/collectd/tasks/reconfigure.yml @@ -1,3 +1,61 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups ['collectd'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: collectd, group: collectd } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: collectd, group: collectd } + +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: collectd, group: collectd } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: collectd, group: collectd }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: collectd, group: collectd }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/common/tasks/do_reconfigure.yml b/ansible/roles/common/tasks/do_reconfigure.yml deleted file mode 100644 index 961c656fa3..0000000000 --- a/ansible/roles/common/tasks/do_reconfigure.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- name: Ensuring the heka container is up - kolla_docker: - name: "heka" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - -- include: config.yml - -- name: Checking the heka config - command: docker exec heka /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_result - -- name: Getting the heka container config strategy - kolla_docker: - name: "heka" - action: "get_container_env" - register: container_env - -- name: Removing the heka container - kolla_docker: - name: "heka" - action: "remove_container" - register: remove_container - when: - - config_strategy == "COPY_ONCE" or container_env["KOLLA_CONFIG_STRATEGY"] == "COPY_ONCE" - - check_result.rc == 1 - -- include: start.yml - when: remove_container.changed - -- name: Restarting the heka container - kolla_docker: - name: "heka" - action: "restart_container" - when: - - config_strategy == "COPY_ALWAYS" - - container_env["KOLLA_CONFIG_STRATEGY"] == "COPY_ALWAYS" - - check_result.rc == 1 diff --git a/ansible/roles/common/tasks/reconfigure.yml b/ansible/roles/common/tasks/reconfigure.yml index 2a1e32d9c2..961c656fa3 100644 --- a/ansible/roles/common/tasks/reconfigure.yml +++ b/ansible/roles/common/tasks/reconfigure.yml @@ -1,2 +1,42 @@ --- -- include: do_reconfigure.yml +- name: Ensuring the heka container is up + kolla_docker: + name: "heka" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + +- include: config.yml + +- name: Checking the heka config + command: docker exec heka /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_result + +- name: Getting the heka container config strategy + kolla_docker: + name: "heka" + action: "get_container_env" + register: container_env + +- name: Removing the heka container + kolla_docker: + name: "heka" + action: "remove_container" + register: remove_container + when: + - config_strategy == "COPY_ONCE" or container_env["KOLLA_CONFIG_STRATEGY"] == "COPY_ONCE" + - check_result.rc == 1 + +- include: start.yml + when: remove_container.changed + +- name: Restarting the heka container + kolla_docker: + name: "heka" + action: "restart_container" + when: + - config_strategy == "COPY_ALWAYS" + - container_env["KOLLA_CONFIG_STRATEGY"] == "COPY_ALWAYS" + - check_result.rc == 1 diff --git a/ansible/roles/elasticsearch/tasks/do_reconfigure.yml b/ansible/roles/elasticsearch/tasks/do_reconfigure.yml deleted file mode 100644 index 480746ef4b..0000000000 --- a/ansible/roles/elasticsearch/tasks/do_reconfigure.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: elasticsearch, group: elasticsearch } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: elasticsearch, group: elasticsearch } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: elasticsearch, group: elasticsearch } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: elasticsearch, group: elasticsearch }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: elasticsearch, group: elasticsearch }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/elasticsearch/tasks/reconfigure.yml b/ansible/roles/elasticsearch/tasks/reconfigure.yml index 59fd9b0aaf..480746ef4b 100644 --- a/ansible/roles/elasticsearch/tasks/reconfigure.yml +++ b/ansible/roles/elasticsearch/tasks/reconfigure.yml @@ -1,3 +1,64 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups ['elasticsearch'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: elasticsearch, group: elasticsearch } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: elasticsearch, group: elasticsearch } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: elasticsearch, group: elasticsearch } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: elasticsearch, group: elasticsearch }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: elasticsearch, group: elasticsearch }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/etcd/tasks/do_reconfigure.yml b/ansible/roles/etcd/tasks/do_reconfigure.yml deleted file mode 100644 index 6eece782d3..0000000000 --- a/ansible/roles/etcd/tasks/do_reconfigure.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: etcd, group: etcd } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: etcd, group: etcd } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: etcd, group: etcd } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: etcd, group: etcd }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: etcd, group: etcd }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/etcd/tasks/reconfigure.yml b/ansible/roles/etcd/tasks/reconfigure.yml index c66bdb1bc9..6eece782d3 100644 --- a/ansible/roles/etcd/tasks/reconfigure.yml +++ b/ansible/roles/etcd/tasks/reconfigure.yml @@ -1,3 +1,64 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['etcd'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: etcd, group: etcd } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: etcd, group: etcd } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: etcd, group: etcd } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: etcd, group: etcd }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: etcd, group: etcd }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/glance/tasks/do_reconfigure.yml b/ansible/roles/glance/tasks/do_reconfigure.yml deleted file mode 100644 index 22f0eb79b5..0000000000 --- a/ansible/roles/glance/tasks/do_reconfigure.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: "{{ glance_service_groups }}" - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: "{{ glance_service_groups }}" - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: "{{ glance_service_groups }}" - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - "{{ glance_service_groups }}" - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: bootstrap_service.yml - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - "{{ glance_service_groups }}" - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/glance/tasks/reconfigure.yml b/ansible/roles/glance/tasks/reconfigure.yml index 73bb13a731..22f0eb79b5 100644 --- a/ansible/roles/glance/tasks/reconfigure.yml +++ b/ansible/roles/glance/tasks/reconfigure.yml @@ -1,4 +1,63 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['glance-api'] - or inventory_hostname in groups['glance-registry'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: "{{ glance_service_groups }}" + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: "{{ glance_service_groups }}" + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: "{{ glance_service_groups }}" + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - "{{ glance_service_groups }}" + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: bootstrap_service.yml + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - "{{ glance_service_groups }}" + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/gnocchi/tasks/do_reconfigure.yml b/ansible/roles/gnocchi/tasks/do_reconfigure.yml deleted file mode 100644 index 39798455c8..0000000000 --- a/ansible/roles/gnocchi/tasks/do_reconfigure.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: gnocchi_api, group: gnocchi-api } - - { name: gnocchi_metricd, group: gnocchi-metricd } - - { name: gnocchi_statsd, group: gnocchi-statsd } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: gnocchi_api, group: gnocchi-api } - - { name: gnocchi_metricd, group: gnocchi-metricd } - - { name: gnocchi_statsd, group: gnocchi-statsd } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: gnocchi_api, group: gnocchi-api } - - { name: gnocchi_metricd, group: gnocchi-metricd } - - { name: gnocchi_statsd, group: gnocchi-statsd } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: gnocchi_api, group: gnocchi-api }, - { name: gnocchi_metricd, group: gnocchi-metricd }, - { name: gnocchi_statsd, group: gnocchi-statsd }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: gnocchi_api, group: gnocchi-api }, - { name: gnocchi_metricd, group: gnocchi-metricd }, - { name: gnocchi_statsd, group: gnocchi-statsd }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/gnocchi/tasks/reconfigure.yml b/ansible/roles/gnocchi/tasks/reconfigure.yml index 2f926a551b..39798455c8 100644 --- a/ansible/roles/gnocchi/tasks/reconfigure.yml +++ b/ansible/roles/gnocchi/tasks/reconfigure.yml @@ -1,5 +1,74 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['gnocchi-api'] - or inventory_hostname in groups['gnocchi-metricd'] - or inventory_hostname in groups['gnocchi-statsd'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: gnocchi_api, group: gnocchi-api } + - { name: gnocchi_metricd, group: gnocchi-metricd } + - { name: gnocchi_statsd, group: gnocchi-statsd } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: gnocchi_api, group: gnocchi-api } + - { name: gnocchi_metricd, group: gnocchi-metricd } + - { name: gnocchi_statsd, group: gnocchi-statsd } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: gnocchi_api, group: gnocchi-api } + - { name: gnocchi_metricd, group: gnocchi-metricd } + - { name: gnocchi_statsd, group: gnocchi-statsd } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: gnocchi_api, group: gnocchi-api }, + { name: gnocchi_metricd, group: gnocchi-metricd }, + { name: gnocchi_statsd, group: gnocchi-statsd }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: gnocchi_api, group: gnocchi-api }, + { name: gnocchi_metricd, group: gnocchi-metricd }, + { name: gnocchi_statsd, group: gnocchi-statsd }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/grafana/tasks/do_reconfigure.yml b/ansible/roles/grafana/tasks/do_reconfigure.yml deleted file mode 100644 index b8ca4ed270..0000000000 --- a/ansible/roles/grafana/tasks/do_reconfigure.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "grafana" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups['grafana'] - -- include: config.yml - -- name: Check the configs - command: docker exec grafana /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups['grafana'] - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "grafana" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups['grafana'] - -- name: Remove the containers - kolla_docker: - name: "grafana" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" - - inventory_hostname in groups['grafana'] - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "grafana" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - inventory_hostname in groups['grafana'] diff --git a/ansible/roles/grafana/tasks/reconfigure.yml b/ansible/roles/grafana/tasks/reconfigure.yml index 0b28cb949a..b8ca4ed270 100644 --- a/ansible/roles/grafana/tasks/reconfigure.yml +++ b/ansible/roles/grafana/tasks/reconfigure.yml @@ -1,3 +1,47 @@ --- -- include: do_reconfigure.yml +- name: Ensuring the containers up + kolla_docker: + name: "grafana" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false when: inventory_hostname in groups['grafana'] + +- include: config.yml + +- name: Check the configs + command: docker exec grafana /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups['grafana'] + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "grafana" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups['grafana'] + +- name: Remove the containers + kolla_docker: + name: "grafana" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" + - inventory_hostname in groups['grafana'] + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "grafana" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - inventory_hostname in groups['grafana'] diff --git a/ansible/roles/haproxy/tasks/do_reconfigure.yml b/ansible/roles/haproxy/tasks/do_reconfigure.yml deleted file mode 100644 index ea2b3dfc02..0000000000 --- a/ansible/roles/haproxy/tasks/do_reconfigure.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: haproxy, group: haproxy } - - { name: keepalived, group: haproxy } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: haproxy, group: haproxy } - - { name: keepalived, group: haproxy } - -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: haproxy, group: haproxy } - - { name: keepalived, group: haproxy } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: haproxy, group: haproxy }, - { name: keepalived, group: haproxy }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -# container_envs.results is a list of two elements, first corresponds to -# haproxy container result and second to keepalived container result and the -# same applicable for check_results.results -- name: Ensuring latest haproxy config is used - command: docker exec haproxy /usr/local/bin/kolla_ensure_haproxy_latest_config - register: status - changed_when: status.stdout.find('changed') != -1 - when: - - config_strategy == 'COPY_ALWAYS' - - container_envs.results[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - check_results.results[0]['rc'] == 1 - - inventory_hostname in groups['haproxy'] - -- name: Restart keepalived container - kolla_docker: - name: "keepalived" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - container_envs.results[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - check_results.results[1]['rc'] == 1 - - inventory_hostname in groups['haproxy'] diff --git a/ansible/roles/haproxy/tasks/reconfigure.yml b/ansible/roles/haproxy/tasks/reconfigure.yml index ae2aa6b5ec..ea2b3dfc02 100644 --- a/ansible/roles/haproxy/tasks/reconfigure.yml +++ b/ansible/roles/haproxy/tasks/reconfigure.yml @@ -1,3 +1,74 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['haproxy'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: haproxy, group: haproxy } + - { name: keepalived, group: haproxy } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: haproxy, group: haproxy } + - { name: keepalived, group: haproxy } + +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: haproxy, group: haproxy } + - { name: keepalived, group: haproxy } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: haproxy, group: haproxy }, + { name: keepalived, group: haproxy }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +# container_envs.results is a list of two elements, first corresponds to +# haproxy container result and second to keepalived container result and the +# same applicable for check_results.results +- name: Ensuring latest haproxy config is used + command: docker exec haproxy /usr/local/bin/kolla_ensure_haproxy_latest_config + register: status + changed_when: status.stdout.find('changed') != -1 + when: + - config_strategy == 'COPY_ALWAYS' + - container_envs.results[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - check_results.results[0]['rc'] == 1 + - inventory_hostname in groups['haproxy'] + +- name: Restart keepalived container + kolla_docker: + name: "keepalived" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - container_envs.results[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - check_results.results[1]['rc'] == 1 + - inventory_hostname in groups['haproxy'] diff --git a/ansible/roles/heat/tasks/do_reconfigure.yml b/ansible/roles/heat/tasks/do_reconfigure.yml deleted file mode 100644 index 1e4bfeacd5..0000000000 --- a/ansible/roles/heat/tasks/do_reconfigure.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: heat_api, group: heat-api } - - { name: heat_api_cfn, group: heat-api-cfn } - - { name: heat_engine, group: heat-engine } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: heat_api, group: heat-api } - - { name: heat_api_cfn, group: heat-api-cfn } - - { name: heat_engine, group: heat-engine } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: heat_api, group: heat-api } - - { name: heat_api_cfn, group: heat-api-cfn } - - { name: heat_engine, group: heat-engine } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: heat_api, group: heat-api }, - { name: heat_api_cfn, group: heat-api-cfn }, - { name: heat_engine, group: heat-engine }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: heat_api, group: heat-api }, - { name: heat_api_cfn, group: heat-api-cfn }, - { name: heat_engine, group: heat-engine }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/heat/tasks/reconfigure.yml b/ansible/roles/heat/tasks/reconfigure.yml index 1030a79e4a..1e4bfeacd5 100644 --- a/ansible/roles/heat/tasks/reconfigure.yml +++ b/ansible/roles/heat/tasks/reconfigure.yml @@ -1,5 +1,74 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['heat-api'] - or inventory_hostname in groups['heat-api-cfn'] - or inventory_hostname in groups['heat-engine'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: heat_api, group: heat-api } + - { name: heat_api_cfn, group: heat-api-cfn } + - { name: heat_engine, group: heat-engine } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: heat_api, group: heat-api } + - { name: heat_api_cfn, group: heat-api-cfn } + - { name: heat_engine, group: heat-engine } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: heat_api, group: heat-api } + - { name: heat_api_cfn, group: heat-api-cfn } + - { name: heat_engine, group: heat-engine } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: heat_api, group: heat-api }, + { name: heat_api_cfn, group: heat-api-cfn }, + { name: heat_engine, group: heat-engine }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: heat_api, group: heat-api }, + { name: heat_api_cfn, group: heat-api-cfn }, + { name: heat_engine, group: heat-engine }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/horizon/tasks/do_reconfigure.yml b/ansible/roles/horizon/tasks/do_reconfigure.yml deleted file mode 100644 index e4ae77c07e..0000000000 --- a/ansible/roles/horizon/tasks/do_reconfigure.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: horizon, group: horizon } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: horizon, group: horizon } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: horizon, group: horizon } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: horizon, group: horizon }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: horizon, group: horizon }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/horizon/tasks/reconfigure.yml b/ansible/roles/horizon/tasks/reconfigure.yml index 5d29982134..e4ae77c07e 100644 --- a/ansible/roles/horizon/tasks/reconfigure.yml +++ b/ansible/roles/horizon/tasks/reconfigure.yml @@ -1,3 +1,64 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['horizon'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: horizon, group: horizon } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: horizon, group: horizon } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: horizon, group: horizon } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: horizon, group: horizon }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: horizon, group: horizon }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/influxdb/tasks/do_reconfigure.yml b/ansible/roles/influxdb/tasks/do_reconfigure.yml deleted file mode 100644 index 6049df4746..0000000000 --- a/ansible/roles/influxdb/tasks/do_reconfigure.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "influxdb" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups['influxdb'] - -- include: config.yml - -- name: Check the configs - command: docker exec influxdb /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups['influxdb'] - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "influxdb" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups['influxdb'] - -- name: Remove the containers - kolla_docker: - name: "influxdb" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" - - inventory_hostname in groups['influxdb'] - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "influxdb" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - inventory_hostname in groups['influxdb'] diff --git a/ansible/roles/influxdb/tasks/reconfigure.yml b/ansible/roles/influxdb/tasks/reconfigure.yml index 965700b55e..6049df4746 100644 --- a/ansible/roles/influxdb/tasks/reconfigure.yml +++ b/ansible/roles/influxdb/tasks/reconfigure.yml @@ -1,3 +1,47 @@ --- -- include: do_reconfigure.yml +- name: Ensuring the containers up + kolla_docker: + name: "influxdb" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false when: inventory_hostname in groups['influxdb'] + +- include: config.yml + +- name: Check the configs + command: docker exec influxdb /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups['influxdb'] + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "influxdb" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups['influxdb'] + +- name: Remove the containers + kolla_docker: + name: "influxdb" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" + - inventory_hostname in groups['influxdb'] + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "influxdb" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - inventory_hostname in groups['influxdb'] diff --git a/ansible/roles/ironic/tasks/do_reconfigure.yml b/ansible/roles/ironic/tasks/do_reconfigure.yml deleted file mode 100644 index 392c8219c9..0000000000 --- a/ansible/roles/ironic/tasks/do_reconfigure.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: ironic_pxe, group: ironic-pxe } - - { name: ironic_api, group: ironic-api } - - { name: ironic_conductor, group: ironic-conductor } - - { name: ironic_inspector, group: ironic-inspector } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: ironic_pxe, group: ironic-pxe } - - { name: ironic_api, group: ironic-api } - - { name: ironic_conductor, group: ironic-conductor } - - { name: ironic_inspector, group: ironic-inspector } - -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: ironic_pxe, group: ironic-pxe } - - { name: ironic_api, group: ironic-api } - - { name: ironic_conductor, group: ironic-conductor } - - { name: ironic_inspector, group: ironic-inspector } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: ironic_pxe, group: ironic-pxe }, - { name: ironic_api, group: ironic-api }, - { name: ironic_conductor, group: ironic-conductor }, - { name: ironic_inspector, group: ironic-inspector }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: ironic_pxe, group: ironic-pxe }, - { name: ironic_api, group: ironic-api }, - { name: ironic_conductor, group: ironic-conductor }, - { name: ironic_inspector, group: ironic-inspector }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/ironic/tasks/reconfigure.yml b/ansible/roles/ironic/tasks/reconfigure.yml index cac0cb37ea..392c8219c9 100644 --- a/ansible/roles/ironic/tasks/reconfigure.yml +++ b/ansible/roles/ironic/tasks/reconfigure.yml @@ -1,6 +1,76 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['ironic-pxe'] - or inventory_hostname in groups['ironic-api'] - or inventory_hostname in groups['ironic-conductor'] - or inventory_hostname in groups['ironic-inspector'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: ironic_pxe, group: ironic-pxe } + - { name: ironic_api, group: ironic-api } + - { name: ironic_conductor, group: ironic-conductor } + - { name: ironic_inspector, group: ironic-inspector } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: ironic_pxe, group: ironic-pxe } + - { name: ironic_api, group: ironic-api } + - { name: ironic_conductor, group: ironic-conductor } + - { name: ironic_inspector, group: ironic-inspector } + +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: ironic_pxe, group: ironic-pxe } + - { name: ironic_api, group: ironic-api } + - { name: ironic_conductor, group: ironic-conductor } + - { name: ironic_inspector, group: ironic-inspector } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: ironic_pxe, group: ironic-pxe }, + { name: ironic_api, group: ironic-api }, + { name: ironic_conductor, group: ironic-conductor }, + { name: ironic_inspector, group: ironic-inspector }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: ironic_pxe, group: ironic-pxe }, + { name: ironic_api, group: ironic-api }, + { name: ironic_conductor, group: ironic-conductor }, + { name: ironic_inspector, group: ironic-inspector }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/keystone/tasks/do_reconfigure.yml b/ansible/roles/keystone/tasks/do_reconfigure.yml deleted file mode 100644 index 7cfeded612..0000000000 --- a/ansible/roles/keystone/tasks/do_reconfigure.yml +++ /dev/null @@ -1,75 +0,0 @@ ---- -- name: Set variable for keystone components used in reconfigure - set_fact: - keystone_items: - - { name: keystone, group: keystone } - -- name: Add fernet related components to variable if fernet is enabled - set_fact: - keystone_fernet_items: - - { name: keystone_fernet, group: keystone } - - { name: keystone_ssh, group: keystone } - keystone_items: "{{ keystone_items + keystone_fernet_items }}" - when: keystone_token_provider == 'fernet' - -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: "{{ keystone_items }}" - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: "{{ keystone_items }}" - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: "{{ keystone_items }}" - - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - "{{ keystone_items }}" - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - "{{ keystone_items }}" - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/keystone/tasks/reconfigure.yml b/ansible/roles/keystone/tasks/reconfigure.yml index c73548ba60..7cfeded612 100644 --- a/ansible/roles/keystone/tasks/reconfigure.yml +++ b/ansible/roles/keystone/tasks/reconfigure.yml @@ -1,3 +1,75 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['keystone'] +- name: Set variable for keystone components used in reconfigure + set_fact: + keystone_items: + - { name: keystone, group: keystone } + +- name: Add fernet related components to variable if fernet is enabled + set_fact: + keystone_fernet_items: + - { name: keystone_fernet, group: keystone } + - { name: keystone_ssh, group: keystone } + keystone_items: "{{ keystone_items + keystone_fernet_items }}" + when: keystone_token_provider == 'fernet' + +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: "{{ keystone_items }}" + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: "{{ keystone_items }}" + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: "{{ keystone_items }}" + + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - "{{ keystone_items }}" + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - "{{ keystone_items }}" + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/magnum/tasks/do_reconfigure.yml b/ansible/roles/magnum/tasks/do_reconfigure.yml deleted file mode 100644 index 9598ffb89d..0000000000 --- a/ansible/roles/magnum/tasks/do_reconfigure.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: magnum_api, group: magnum-api } - - { name: magnum_conductor, group: magnum-conductor } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: magnum_api, group: magnum-api } - - { name: magnum_conductor, group: magnum-conductor } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: magnum_api, group: magnum-api } - - { name: magnum_conductor, group: magnum-conductor } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: magnum_api, group: magnum-api }, - { name: magnum_conductor, group: magnum-conductor }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: magnum_api, group: magnum-api }, - { name: magnum_conductor, group: magnum-conductor }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/magnum/tasks/reconfigure.yml b/ansible/roles/magnum/tasks/reconfigure.yml index 7d428522be..9598ffb89d 100644 --- a/ansible/roles/magnum/tasks/reconfigure.yml +++ b/ansible/roles/magnum/tasks/reconfigure.yml @@ -1,4 +1,69 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['magnum-api'] - or inventory_hostname in groups['magnum-conductor'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: magnum_api, group: magnum-api } + - { name: magnum_conductor, group: magnum-conductor } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: magnum_api, group: magnum-api } + - { name: magnum_conductor, group: magnum-conductor } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: magnum_api, group: magnum-api } + - { name: magnum_conductor, group: magnum-conductor } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: magnum_api, group: magnum-api }, + { name: magnum_conductor, group: magnum-conductor }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: magnum_api, group: magnum-api }, + { name: magnum_conductor, group: magnum-conductor }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/manila/tasks/do_reconfigure.yml b/ansible/roles/manila/tasks/do_reconfigure.yml deleted file mode 100644 index 3c265fb0d8..0000000000 --- a/ansible/roles/manila/tasks/do_reconfigure.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: manila_api, group: manila-api } - - { name: manila_scheduler, group: manila-scheduler } - - { name: manila_share, group: manila-share } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: manila_api, group: manila-api } - - { name: manila_scheduler, group: manila-scheduler } - - { name: manila_share, group: manila-share } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: manila_api, group: manila-api } - - { name: manila_scheduler, group: manila-scheduler } - - { name: manila_share, group: manila-share } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: manila_api, group: manila-api }, - { name: manila_scheduler, group: manila-scheduler }, - { name: manila_share, group: manila-share }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: manila_api, group: manila-api }, - { name: manila_scheduler, group: manila-scheduler }, - { name: manila_share, group: manila-share }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/manila/tasks/reconfigure.yml b/ansible/roles/manila/tasks/reconfigure.yml index 447ff856cd..3c265fb0d8 100644 --- a/ansible/roles/manila/tasks/reconfigure.yml +++ b/ansible/roles/manila/tasks/reconfigure.yml @@ -1,5 +1,74 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['manila-api'] - or inventory_hostname in groups['manila-scheduler'] - or inventory_hostname in groups['manila-share'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: manila_api, group: manila-api } + - { name: manila_scheduler, group: manila-scheduler } + - { name: manila_share, group: manila-share } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: manila_api, group: manila-api } + - { name: manila_scheduler, group: manila-scheduler } + - { name: manila_share, group: manila-share } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: manila_api, group: manila-api } + - { name: manila_scheduler, group: manila-scheduler } + - { name: manila_share, group: manila-share } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: manila_api, group: manila-api }, + { name: manila_scheduler, group: manila-scheduler }, + { name: manila_share, group: manila-share }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: manila_api, group: manila-api }, + { name: manila_scheduler, group: manila-scheduler }, + { name: manila_share, group: manila-share }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/mariadb/tasks/do_reconfigure.yml b/ansible/roles/mariadb/tasks/do_reconfigure.yml deleted file mode 100644 index 92bf538c47..0000000000 --- a/ansible/roles/mariadb/tasks/do_reconfigure.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: mariadb, group: mariadb } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: mariadb, group: mariadb } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: mariadb, group: mariadb } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: mariadb, group: mariadb }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: mariadb, group: mariadb }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: check.yml diff --git a/ansible/roles/mariadb/tasks/reconfigure.yml b/ansible/roles/mariadb/tasks/reconfigure.yml index f28f4269ac..92bf538c47 100644 --- a/ansible/roles/mariadb/tasks/reconfigure.yml +++ b/ansible/roles/mariadb/tasks/reconfigure.yml @@ -1,3 +1,66 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['mariadb'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: mariadb, group: mariadb } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: mariadb, group: mariadb } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: mariadb, group: mariadb } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: mariadb, group: mariadb }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: mariadb, group: mariadb }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: check.yml diff --git a/ansible/roles/memcached/tasks/do_reconfigure.yml b/ansible/roles/memcached/tasks/do_reconfigure.yml deleted file mode 100644 index b63684beb7..0000000000 --- a/ansible/roles/memcached/tasks/do_reconfigure.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: memcached, group: memcached } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: memcached, group: memcached } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: memcached, group: memcached } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: memcached, group: memcached }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: memcached, group: memcached }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/memcached/tasks/reconfigure.yml b/ansible/roles/memcached/tasks/reconfigure.yml index d4f3c676af..b63684beb7 100644 --- a/ansible/roles/memcached/tasks/reconfigure.yml +++ b/ansible/roles/memcached/tasks/reconfigure.yml @@ -1,3 +1,64 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups ['memcached'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: memcached, group: memcached } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: memcached, group: memcached } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: memcached, group: memcached } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: memcached, group: memcached }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: memcached, group: memcached }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/mistral/tasks/do_reconfigure.yml b/ansible/roles/mistral/tasks/do_reconfigure.yml deleted file mode 100644 index d0d9e7ae97..0000000000 --- a/ansible/roles/mistral/tasks/do_reconfigure.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: mistral_api, group: mistral-api } - - { name: mistral_engine, group: mistral-engine } - - { name: mistral_executor, group: mistral-executor } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: mistral_api, group: mistral-api } - - { name: mistral_engine, group: mistral-engine } - - { name: mistral_executor, group: mistral-executor } - -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: mistral_api, group: mistral-api } - - { name: mistral_engine, group: mistral-engine } - - { name: mistral_executor, group: mistral-executor } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: mistral_api, group: mistral-api }, - { name: mistral_engine, group: mistral-engine }, - { name: mistral_executor, group: mistral-executor }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: mistral_api, group: mistral-api }, - { name: mistral_engine, group: mistral-engine }, - { name: mistral_executor, group: mistral-executor }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/mistral/tasks/reconfigure.yml b/ansible/roles/mistral/tasks/reconfigure.yml index 47757ff537..d0d9e7ae97 100644 --- a/ansible/roles/mistral/tasks/reconfigure.yml +++ b/ansible/roles/mistral/tasks/reconfigure.yml @@ -1,5 +1,71 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['mistral-api'] - or inventory_hostname in groups['mistral-engine'] - or inventory_hostname in groups['mistral-executor'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: mistral_api, group: mistral-api } + - { name: mistral_engine, group: mistral-engine } + - { name: mistral_executor, group: mistral-executor } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: mistral_api, group: mistral-api } + - { name: mistral_engine, group: mistral-engine } + - { name: mistral_executor, group: mistral-executor } + +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: mistral_api, group: mistral-api } + - { name: mistral_engine, group: mistral-engine } + - { name: mistral_executor, group: mistral-executor } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: mistral_api, group: mistral-api }, + { name: mistral_engine, group: mistral-engine }, + { name: mistral_executor, group: mistral-executor }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: mistral_api, group: mistral-api }, + { name: mistral_engine, group: mistral-engine }, + { name: mistral_executor, group: mistral-executor }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/mongodb/tasks/do_reconfigure.yml b/ansible/roles/mongodb/tasks/do_reconfigure.yml deleted file mode 100644 index 9bec471870..0000000000 --- a/ansible/roles/mongodb/tasks/do_reconfigure.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: mongodb, group: mongodb } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: mongodb, group: mongodb } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: mongodb, group: mongodb } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: mongodb, group: mongodb }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: mongodb, group: mongodb }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/mongodb/tasks/reconfigure.yml b/ansible/roles/mongodb/tasks/reconfigure.yml index 4a59d8bc5c..9bec471870 100644 --- a/ansible/roles/mongodb/tasks/reconfigure.yml +++ b/ansible/roles/mongodb/tasks/reconfigure.yml @@ -1,3 +1,64 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['mongodb'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: mongodb, group: mongodb } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: mongodb, group: mongodb } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: mongodb, group: mongodb } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: mongodb, group: mongodb }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: mongodb, group: mongodb }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/murano/tasks/do_reconfigure.yml b/ansible/roles/murano/tasks/do_reconfigure.yml deleted file mode 100644 index d5d784aa04..0000000000 --- a/ansible/roles/murano/tasks/do_reconfigure.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: murano_api, group: murano-api } - - { name: murano_engine, group: murano-engine } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: murano_api, group: murano-api } - - { name: murano_engine, group: murano-engine } - -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: murano_api, group: murano-api } - - { name: murano_engine, group: murano-engine } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: murano_api, group: murano-api }, - { name: murano_engine, group: murano-engine }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: murano_api, group: murano-api }, - { name: murano_engine, group: murano-engine }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/murano/tasks/reconfigure.yml b/ansible/roles/murano/tasks/reconfigure.yml index 60ce412725..d5d784aa04 100644 --- a/ansible/roles/murano/tasks/reconfigure.yml +++ b/ansible/roles/murano/tasks/reconfigure.yml @@ -1,4 +1,66 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['murano-api'] - or inventory_hostname in groups['murano-engine'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: murano_api, group: murano-api } + - { name: murano_engine, group: murano-engine } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: murano_api, group: murano-api } + - { name: murano_engine, group: murano-engine } + +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: murano_api, group: murano-api } + - { name: murano_engine, group: murano-engine } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: murano_api, group: murano-api }, + { name: murano_engine, group: murano-engine }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: murano_api, group: murano-api }, + { name: murano_engine, group: murano-engine }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/neutron/tasks/do_reconfigure.yml b/ansible/roles/neutron/tasks/do_reconfigure.yml deleted file mode 100644 index ad8ef35aba..0000000000 --- a/ansible/roles/neutron/tasks/do_reconfigure.yml +++ /dev/null @@ -1,324 +0,0 @@ ---- -- name: Ensuring the containers running neutron-server and neutron agents are up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: neutron_container_states - failed_when: neutron_container_states.Running == false - when: - - "{{ item.enabled|default(True) }}" - - inventory_hostname in groups[item.group] - with_items: - - { name: neutron_server, group: neutron-server } - - { name: neutron_dhcp_agent, group: neutron-dhcp-agent } - - { name: neutron_l3_agent, group: neutron-l3-agent } - - { name: neutron_l3_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } - - { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" } - - { name: neutron_metadata_agent, group: neutron-metadata-agent } - - { name: neutron_metadata_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } - - { name: neutron_vpnaas_agent, group: neutron-vpnaas-agent, enabled: "{{ enable_neutron_vpnaas | bool }}" } - -- name: Ensuring the neutron_openvswitch_agent container is up - kolla_docker: - name: neutron_openvswitch_agent - action: "get_container_state" - register: openvswitch_agent_container_states - failed_when: openvswitch_agent_container_states.Running == false - when: - - neutron_plugin_agent == "openvswitch" - - ( - ( inventory_hostname in groups['compute'] - or (enable_manila | bool and inventory_hostname in groups['manila-share']) - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] - and not enable_nova_fake | bool - ) or - ( inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] - and enable_nova_fake | bool - ) - ) - -- name: Ensuring the neutron_linuxbridge_agent container is up - kolla_docker: - name: neutron_linuxbridge_agent - action: "get_container_state" - register: linuxbridge_agent_container_states - failed_when: linuxbridge_agent_container_states.Running == false - when: - - neutron_plugin_agent == "linuxbridge" - - (inventory_hostname in groups['compute'] - or (enable_manila | bool and inventory_hostname in groups['manila-share']) - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent']) - -- include: config.yml - -- name: Check the configs in containers running neutron-server and neutron agents - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: neutron_check_results - when: - - "{{ item.enabled|default(True) }}" - - inventory_hostname in groups[item.group] - with_items: - - { name: neutron_server, group: neutron-server } - - { name: neutron_dhcp_agent, group: neutron-dhcp-agent } - - { name: neutron_l3_agent, group: neutron-l3-agent } - - { name: neutron_l3_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } - - { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" } - - { name: neutron_metadata_agent, group: neutron-metadata-agent } - - { name: neutron_metadata_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } - - { name: neutron_vpnaas_agent, group: neutron-vpnaas-agent, enabled: "{{ enable_neutron_vpnaas | bool }}" } - -- name: Check the configs in the neutron_openvswitch_agent container - command: docker exec neutron_openvswitch_agent /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: openvswitch_agent_check_results - when: - - neutron_plugin_agent == "openvswitch" - - ( - ( inventory_hostname in groups['compute'] - or (enable_manila | bool and inventory_hostname in groups['manila-share']) - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] - and not enable_nova_fake | bool - ) or - ( inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] - and enable_nova_fake | bool - ) - ) - -- name: Check the configs in the neutron_linuxbridge_agent container - command: docker exec neutron_linuxbridge_agent /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: linuxbridge_agent_check_results - when: - - neutron_plugin_agent == "linuxbridge" - - (inventory_hostname in groups['compute'] - or (enable_manila | bool and inventory_hostname in groups['manila-share']) - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent']) - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy for containers running neutron-server and neutron agents - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: neutron_container_envs - when: - - "{{ item.enabled|default(True) }}" - - inventory_hostname in groups[item.group] - with_items: - - { name: neutron_server, group: neutron-server } - - { name: neutron_dhcp_agent, group: neutron-dhcp-agent } - - { name: neutron_l3_agent, group: neutron-l3-agent } - - { name: neutron_l3_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } - - { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" } - - { name: neutron_metadata_agent, group: neutron-metadata-agent } - - { name: neutron_metadata_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } - - { name: neutron_vpnaas_agent, group: neutron-vpnaas-agent, enabled: "{{ enable_neutron_vpnaas | bool }}" } - -- name: Container config strategy for the neutron_openvswitch_agent container - kolla_docker: - name: "neutron_openvswitch_agent" - action: "get_container_env" - register: openvswitch_agent_envs - when: - - neutron_plugin_agent == "openvswitch" - - ( - ( not enable_nova_fake | bool - and inventory_hostname in groups['compute'] - or (enable_manila | bool and inventory_hostname in groups['manila-share']) - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] - ) or - ( enable_nova_fake | bool - and inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] - ) - ) - -- name: Container config strategy for the neutron_linuxbridge_agent container - kolla_docker: - name: "neutron_linuxbridge_agent" - action: "get_container_env" - register: linuxbridge_agent_envs - when: - - neutron_plugin_agent == "linuxbridge" - - (inventory_hostname in groups['compute'] - or (enable_manila | bool and inventory_hostname in groups['manila-share']) - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent']) - -- name: Remove the containers running neutron-server and neutron agents - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: neutron_remove_containers - when: - - "{{ item[0].enabled | default(True) }}" - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: neutron_server, group: neutron-server }, - { name: neutron_dhcp_agent, group: neutron-dhcp-agent }, - { name: neutron_l3_agent, group: neutron-l3-agent }, - { name: neutron_l3_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" }, - { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" }, - { name: neutron_metadata_agent, group: neutron-metadata-agent }, - { name: neutron_metadata_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" }, - { name: neutron_vpnaas_agent, group: neutron-vpnaas-agent, enabled: "{{ enable_neutron_vpnaas | bool }}" }] - - "{{ neutron_container_envs.results }}" - - "{{ neutron_check_results.results }}" - -- name: Remove the neutron_openvswitch_agent container - kolla_docker: - name: "neutron_openvswitch_agent" - action: "remove_container" - register: openvswitch_agent_remove_containers - when: - - neutron_plugin_agent == "openvswitch" - - ( - ( not enable_nova_fake | bool - and inventory_hostname in groups['compute'] - or (enable_manila | bool and inventory_hostname in groups['manila-share']) - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] - ) or - ( enable_nova_fake | bool - and inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] - ) - ) - - config_strategy == "COPY_ONCE" or openvswitch_agent_envs['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - openvswitch_agent_check_results['rc'] == 1 - -- name: Remove the neutron_linuxbridge_agent container - kolla_docker: - name: "neutron_linuxbridge_agent" - action: "remove_container" - register: linuxbridge_agent_remove_containers - when: - - neutron_plugin_agent == "linuxbridge" - - (inventory_hostname in groups['compute'] - or inventory_hostname in groups['manila-share'] - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent']) - - config_strategy == "COPY_ONCE" or linuxbridge_agent_envs['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - linuxbridge_agent_check_results['rc'] == 1 - -- include: start.yml - when: neutron_remove_containers.changed - or openvswitch_agent_remove_containers.changed - or linuxbridge_agent_remove_containers.changed - -- name: Restart containers running neutron-server and neutron agents - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - "{{ item[0].enabled|default(True) }}" - - config_strategy == 'COPY_ALWAYS' - - inventory_hostname in groups[item[0]['group']] - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: neutron_server, group: neutron-server }, - { name: neutron_dhcp_agent, group: neutron-dhcp-agent }, - { name: neutron_l3_agent, group: neutron-l3-agent }, - { name: neutron_l3_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" }, - { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" }, - { name: neutron_metadata_agent, group: neutron-metadata-agent }, - { name: neutron_metadata_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" }, - { name: neutron_vpnaas_agent, group: neutron-vpnaas-agent, enabled: "{{ enable_neutron_vpnaas | bool }}" }] - - "{{ neutron_container_envs.results }}" - - "{{ neutron_check_results.results }}" - -- name: Restart the neutron_openvswitch_agent container - kolla_docker: - name: "neutron_openvswitch_agent" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - neutron_plugin_agent == "openvswitch" - - ( - ( inventory_hostname in groups['compute'] - or (enable_manila | bool and inventory_hostname in groups['manila-share']) - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] - and not enable_nova_fake | bool - ) or - ( inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] - and enable_nova_fake | bool - ) - ) - - openvswitch_agent_envs['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - openvswitch_agent_check_results['rc'] == 1 - -- name: Restart the neutron_linuxbridge_agent container - kolla_docker: - name: "neutron_linuxbridge_agent" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - neutron_plugin_agent == "linuxbridge" - - (inventory_hostname in groups['compute'] - or (enable_manila | bool and inventory_hostname in groups['manila-share']) - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent']) - - linuxbridge_agent_envs['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - linuxbridge_agent_check_results['rc'] == 1 diff --git a/ansible/roles/neutron/tasks/reconfigure.yml b/ansible/roles/neutron/tasks/reconfigure.yml index cc30a005b8..ad8ef35aba 100644 --- a/ansible/roles/neutron/tasks/reconfigure.yml +++ b/ansible/roles/neutron/tasks/reconfigure.yml @@ -1,10 +1,324 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['neutron-server'] - or (enable_manila | bool and inventory_hostname in groups['manila-share']) - or inventory_hostname in groups['compute'] - or inventory_hostname in groups['neutron-dhcp-agent'] - or inventory_hostname in groups['neutron-l3-agent'] - or inventory_hostname in groups['neutron-lbaas-agent'] - or inventory_hostname in groups['neutron-metadata-agent'] - or inventory_hostname in groups['neutron-vpnaas-agent'] +- name: Ensuring the containers running neutron-server and neutron agents are up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: neutron_container_states + failed_when: neutron_container_states.Running == false + when: + - "{{ item.enabled|default(True) }}" + - inventory_hostname in groups[item.group] + with_items: + - { name: neutron_server, group: neutron-server } + - { name: neutron_dhcp_agent, group: neutron-dhcp-agent } + - { name: neutron_l3_agent, group: neutron-l3-agent } + - { name: neutron_l3_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } + - { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" } + - { name: neutron_metadata_agent, group: neutron-metadata-agent } + - { name: neutron_metadata_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } + - { name: neutron_vpnaas_agent, group: neutron-vpnaas-agent, enabled: "{{ enable_neutron_vpnaas | bool }}" } + +- name: Ensuring the neutron_openvswitch_agent container is up + kolla_docker: + name: neutron_openvswitch_agent + action: "get_container_state" + register: openvswitch_agent_container_states + failed_when: openvswitch_agent_container_states.Running == false + when: + - neutron_plugin_agent == "openvswitch" + - ( + ( inventory_hostname in groups['compute'] + or (enable_manila | bool and inventory_hostname in groups['manila-share']) + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent'] + and not enable_nova_fake | bool + ) or + ( inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent'] + and enable_nova_fake | bool + ) + ) + +- name: Ensuring the neutron_linuxbridge_agent container is up + kolla_docker: + name: neutron_linuxbridge_agent + action: "get_container_state" + register: linuxbridge_agent_container_states + failed_when: linuxbridge_agent_container_states.Running == false + when: + - neutron_plugin_agent == "linuxbridge" + - (inventory_hostname in groups['compute'] + or (enable_manila | bool and inventory_hostname in groups['manila-share']) + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent']) + +- include: config.yml + +- name: Check the configs in containers running neutron-server and neutron agents + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: neutron_check_results + when: + - "{{ item.enabled|default(True) }}" + - inventory_hostname in groups[item.group] + with_items: + - { name: neutron_server, group: neutron-server } + - { name: neutron_dhcp_agent, group: neutron-dhcp-agent } + - { name: neutron_l3_agent, group: neutron-l3-agent } + - { name: neutron_l3_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } + - { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" } + - { name: neutron_metadata_agent, group: neutron-metadata-agent } + - { name: neutron_metadata_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } + - { name: neutron_vpnaas_agent, group: neutron-vpnaas-agent, enabled: "{{ enable_neutron_vpnaas | bool }}" } + +- name: Check the configs in the neutron_openvswitch_agent container + command: docker exec neutron_openvswitch_agent /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: openvswitch_agent_check_results + when: + - neutron_plugin_agent == "openvswitch" + - ( + ( inventory_hostname in groups['compute'] + or (enable_manila | bool and inventory_hostname in groups['manila-share']) + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent'] + and not enable_nova_fake | bool + ) or + ( inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent'] + and enable_nova_fake | bool + ) + ) + +- name: Check the configs in the neutron_linuxbridge_agent container + command: docker exec neutron_linuxbridge_agent /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: linuxbridge_agent_check_results + when: + - neutron_plugin_agent == "linuxbridge" + - (inventory_hostname in groups['compute'] + or (enable_manila | bool and inventory_hostname in groups['manila-share']) + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent']) + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy for containers running neutron-server and neutron agents + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: neutron_container_envs + when: + - "{{ item.enabled|default(True) }}" + - inventory_hostname in groups[item.group] + with_items: + - { name: neutron_server, group: neutron-server } + - { name: neutron_dhcp_agent, group: neutron-dhcp-agent } + - { name: neutron_l3_agent, group: neutron-l3-agent } + - { name: neutron_l3_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } + - { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" } + - { name: neutron_metadata_agent, group: neutron-metadata-agent } + - { name: neutron_metadata_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" } + - { name: neutron_vpnaas_agent, group: neutron-vpnaas-agent, enabled: "{{ enable_neutron_vpnaas | bool }}" } + +- name: Container config strategy for the neutron_openvswitch_agent container + kolla_docker: + name: "neutron_openvswitch_agent" + action: "get_container_env" + register: openvswitch_agent_envs + when: + - neutron_plugin_agent == "openvswitch" + - ( + ( not enable_nova_fake | bool + and inventory_hostname in groups['compute'] + or (enable_manila | bool and inventory_hostname in groups['manila-share']) + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent'] + ) or + ( enable_nova_fake | bool + and inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent'] + ) + ) + +- name: Container config strategy for the neutron_linuxbridge_agent container + kolla_docker: + name: "neutron_linuxbridge_agent" + action: "get_container_env" + register: linuxbridge_agent_envs + when: + - neutron_plugin_agent == "linuxbridge" + - (inventory_hostname in groups['compute'] + or (enable_manila | bool and inventory_hostname in groups['manila-share']) + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent']) + +- name: Remove the containers running neutron-server and neutron agents + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: neutron_remove_containers + when: + - "{{ item[0].enabled | default(True) }}" + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: neutron_server, group: neutron-server }, + { name: neutron_dhcp_agent, group: neutron-dhcp-agent }, + { name: neutron_l3_agent, group: neutron-l3-agent }, + { name: neutron_l3_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" }, + { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" }, + { name: neutron_metadata_agent, group: neutron-metadata-agent }, + { name: neutron_metadata_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" }, + { name: neutron_vpnaas_agent, group: neutron-vpnaas-agent, enabled: "{{ enable_neutron_vpnaas | bool }}" }] + - "{{ neutron_container_envs.results }}" + - "{{ neutron_check_results.results }}" + +- name: Remove the neutron_openvswitch_agent container + kolla_docker: + name: "neutron_openvswitch_agent" + action: "remove_container" + register: openvswitch_agent_remove_containers + when: + - neutron_plugin_agent == "openvswitch" + - ( + ( not enable_nova_fake | bool + and inventory_hostname in groups['compute'] + or (enable_manila | bool and inventory_hostname in groups['manila-share']) + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent'] + ) or + ( enable_nova_fake | bool + and inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent'] + ) + ) + - config_strategy == "COPY_ONCE" or openvswitch_agent_envs['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - openvswitch_agent_check_results['rc'] == 1 + +- name: Remove the neutron_linuxbridge_agent container + kolla_docker: + name: "neutron_linuxbridge_agent" + action: "remove_container" + register: linuxbridge_agent_remove_containers + when: + - neutron_plugin_agent == "linuxbridge" + - (inventory_hostname in groups['compute'] + or inventory_hostname in groups['manila-share'] + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent']) + - config_strategy == "COPY_ONCE" or linuxbridge_agent_envs['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - linuxbridge_agent_check_results['rc'] == 1 + +- include: start.yml + when: neutron_remove_containers.changed + or openvswitch_agent_remove_containers.changed + or linuxbridge_agent_remove_containers.changed + +- name: Restart containers running neutron-server and neutron agents + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - "{{ item[0].enabled|default(True) }}" + - config_strategy == 'COPY_ALWAYS' + - inventory_hostname in groups[item[0]['group']] + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: neutron_server, group: neutron-server }, + { name: neutron_dhcp_agent, group: neutron-dhcp-agent }, + { name: neutron_l3_agent, group: neutron-l3-agent }, + { name: neutron_l3_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" }, + { name: neutron_lbaas_agent, group: neutron-lbaas-agent, enabled: "{{ enable_neutron_lbaas | bool }}" }, + { name: neutron_metadata_agent, group: neutron-metadata-agent }, + { name: neutron_metadata_agent, group: compute, enabled: "{{ enable_neutron_dvr | bool }}" }, + { name: neutron_vpnaas_agent, group: neutron-vpnaas-agent, enabled: "{{ enable_neutron_vpnaas | bool }}" }] + - "{{ neutron_container_envs.results }}" + - "{{ neutron_check_results.results }}" + +- name: Restart the neutron_openvswitch_agent container + kolla_docker: + name: "neutron_openvswitch_agent" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - neutron_plugin_agent == "openvswitch" + - ( + ( inventory_hostname in groups['compute'] + or (enable_manila | bool and inventory_hostname in groups['manila-share']) + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent'] + and not enable_nova_fake | bool + ) or + ( inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent'] + and enable_nova_fake | bool + ) + ) + - openvswitch_agent_envs['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - openvswitch_agent_check_results['rc'] == 1 + +- name: Restart the neutron_linuxbridge_agent container + kolla_docker: + name: "neutron_linuxbridge_agent" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - neutron_plugin_agent == "linuxbridge" + - (inventory_hostname in groups['compute'] + or (enable_manila | bool and inventory_hostname in groups['manila-share']) + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-lbaas-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + or inventory_hostname in groups['neutron-vpnaas-agent']) + - linuxbridge_agent_envs['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - linuxbridge_agent_check_results['rc'] == 1 diff --git a/ansible/roles/nova/tasks/do_reconfigure.yml b/ansible/roles/nova/tasks/do_reconfigure.yml deleted file mode 100644 index b551dd92ac..0000000000 --- a/ansible/roles/nova/tasks/do_reconfigure.yml +++ /dev/null @@ -1,318 +0,0 @@ ---- -- name: Ensuring the nova libvirt, ssh, conductor, api, consoleauth and scheduler containers are up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: nova_libvirt, group: compute } - - { name: nova_ssh, group: compute } - - { name: nova_conductor, group: nova-conductor } - - { name: nova_api, group: nova-api } - - { name: nova_consoleauth, group: nova-consoleauth } - - { name: nova_scheduler, group: nova-scheduler } - -- name: Ensuring the nova_compute container is up - kolla_docker: - name: "nova_compute" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: - - not enable_nova_fake | bool - - inventory_hostname in groups['compute'] - -- name: Ensuring the nova_compute_ironic container is up - kolla_docker: - name: "nova_compute_ironic" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: - - enable_ironic | bool - - inventory_hostname in groups['nova-compute-ironic'] - -- name: Ensuring the nova_novncproxy container is up - kolla_docker: - name: "nova_novncproxy" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: - - nova_console == 'novnc' - - inventory_hostname in groups['nova-novncproxy'] - -- name: Ensuring the nova_spicehtml5proxy container is up - kolla_docker: - name: "nova_spicehtml5proxy" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: - - nova_console == 'spice' - - inventory_hostname in groups['nova-spicehtml5proxy'] - -- include: config.yml - -- name: Check the configs for nova libvirt, ssh, conductor, api, consoleauth and scheduler containers - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: nova_libvirt, group: compute } - - { name: nova_ssh, group: compute } - - { name: nova_conductor, group: nova-conductor } - - { name: nova_api, group: nova-api } - - { name: nova_consoleauth, group: nova-consoleauth } - - { name: nova_scheduler, group: nova-scheduler } - -- name: Check the configs in the nova_compute container - command: docker exec nova_compute /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: nova_compute_check_result - when: - - not enable_nova_fake | bool - - inventory_hostname in groups['compute'] - -- name: Check the configs in the nova_compute_ironic container - command: docker exec nova_compute_ironic /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: nova_compute_ironic_check_result - when: - - enable_ironic | bool - - inventory_hostname in groups['nova-compute-ironic'] - -- name: Check the configs in the nova_novncproxy container - command: docker exec nova_novncproxy /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: nova_novncproxy_check_result - when: - - nova_console == 'novnc' - - inventory_hostname in groups['nova-novncproxy'] - -- name: Check the configs in the nova_spicehtml5proxy container - command: docker exec nova_spicehtml5proxy /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: nova_spicehtml5proxy_check_result - when: - - nova_console == 'spice' - - inventory_hostname in groups['nova-spicehtml5proxy'] - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy for nova libvirt, ssh, conductor, api, consoleauth and scheduler containers - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: nova_libvirt, group: compute } - - { name: nova_ssh, group: compute } - - { name: nova_conductor, group: nova-conductor } - - { name: nova_api, group: nova-api } - - { name: nova_consoleauth, group: nova-consoleauth } - - { name: nova_scheduler, group: nova-scheduler } - -- name: Container config strategy for nova_compute - kolla_docker: - name: nova_compute - action: "get_container_env" - register: nova_compute_container_env - when: - - not enable_nova_fake | bool - - inventory_hostname in groups['compute'] - -- name: Container config strategy for nova_compute_ironic - kolla_docker: - name: nova_compute_ironic - action: "get_container_env" - register: nova_compute_ironic_container_env - when: - - enable_ironic | bool - - inventory_hostname in groups['nova-compute-ironic'] - -- name: Container config strategy for nova_novncproxy - kolla_docker: - name: nova_novncproxy - action: "get_container_env" - register: nova_novncproxy_container_env - when: - - nova_console == 'novnc' - - inventory_hostname in groups['nova-novncproxy'] - -- name: Container config strategy for nova_spicehtml5proxy - kolla_docker: - name: nova_spicehtml5proxy - action: "get_container_env" - register: nova_spicehtml5proxy_container_env - when: - - nova_console == 'spice' - - inventory_hostname in groups['nova-spicehtml5proxy'] - -- name: Remove the nova libvirt, ssh, conductor, api, consoleauth and scheduler containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - until: remote_container|success - retries: "{{ item[0]['retries']|default(0) }}" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - # NOTE(Jeffrey4l): retry 1 to remove nova_libvirt container because when - # guests running, nova_libvirt will raise error even though it is removed. - - [{ name: nova_libvirt, group: compute, retries: 1 }, - { name: nova_ssh, group: compute }, - { name: nova_conductor, group: nova-conductor }, - { name: nova_api, group: nova-api }, - { name: nova_consoleauth, group: nova-consoleauth }, - { name: nova_scheduler, group: nova-scheduler }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- name: Remove nova_compute container - kolla_docker: - name: nova_compute - action: "remove_container" - register: remove_nova_compute_container - when: - - not enable_nova_fake | bool - - inventory_hostname in groups['compute'] - - config_strategy == 'COPY_ONCE' or nova_compute_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - nova_compute_check_result['rc'] == 1 - -- name: Remove nova_compute_ironic container - kolla_docker: - name: nova_compute_ironic - action: "remove_container" - register: remove_nova_compute_ironic_container - when: - - enable_ironic | bool - - inventory_hostname in groups['nova-compute-ironic'] - - config_strategy == 'COPY_ONCE' or nova_compute_ironic_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - nova_compute_ironic_check_result['rc'] == 1 - -- name: Remove nova_novncproxy container - kolla_docker: - name: nova_novncproxy - action: "remove_container" - register: remove_nova_novncproxy_container - when: - - nova_console == 'novnc' - - inventory_hostname in groups['nova-novncproxy'] - - config_strategy == 'COPY_ONCE' or nova_novncproxy_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - nova_novncproxy_check_result['rc'] == 1 - -- name: Remove nova_spicehtml5proxy container - kolla_docker: - name: nova_spicehtml5proxy - action: "remove_container" - register: remove_nova_spicehtml5proxy_container - when: - - nova_console == 'spice' - - inventory_hostname in groups['nova-spicehtml5proxy'] - - config_strategy == 'COPY_ONCE' or nova_spicehtml5proxy_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - nova_spicehtml5proxy_check_result['rc'] == 1 - -- include: start.yml - when: remove_containers.changed - -- include: start.yml - when: - - not enable_nova_fake | bool - - remove_nova_compute_container.changed - -- include: start.yml - when: - - enable_ironic | bool - - remove_nova_compute_ironic_container.changed - -- include: start.yml - when: - - enable_ironic | bool - - remove_nova_compute_ironic_container.changed - -- include: start.yml - when: - - nova_console == 'novnc' - - remove_nova_novncproxy_container.changed - -- include: start.yml - when: - - nova_console == 'spice' - - remove_nova_spicehtml5proxy_container.changed - -- name: Restart the nova libvirt, ssh, conductor, api, consoleauth and scheduler containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - inventory_hostname in groups[item[0]['group']] - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: nova_libvirt, group: compute }, - { name: nova_ssh, group: compute }, - { name: nova_conductor, group: nova-conductor }, - { name: nova_api, group: nova-api }, - { name: nova_consoleauth, group: nova-consoleauth }, - { name: nova_scheduler, group: nova-scheduler }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- name: Restart the nova_compute container - kolla_docker: - name: "nova_compute" - action: "restart_container" - when: - - not enable_nova_fake | bool - - config_strategy == 'COPY_ALWAYS' - - inventory_hostname in groups['compute'] - - nova_compute_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - nova_compute_check_result['rc'] == 1 - -- name: Restart the nova_compute_ironic container - kolla_docker: - name: "nova_compute_ironic" - action: "restart_container" - when: - - enable_ironic | bool - - config_strategy == 'COPY_ALWAYS' - - inventory_hostname in groups['nova-compute-ironic'] - - nova_compute_ironic_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - nova_compute_ironic_check_result['rc'] == 1 - -- name: Restart the nova_novncproxy container - kolla_docker: - name: "nova_novncproxy" - action: "restart_container" - when: - - nova_console == 'novnc' - - config_strategy == 'COPY_ALWAYS' - - inventory_hostname in groups['nova-novncproxy'] - - nova_novncproxy_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - nova_novncproxy_check_result['rc'] == 1 - -- name: Restart the nova_spicehtml5proxy container - kolla_docker: - name: "nova_spicehtml5proxy" - action: "restart_container" - when: - - nova_console == 'spice' - - config_strategy == 'COPY_ALWAYS' - - inventory_hostname in groups['nova-spicehtml5proxy'] - - nova_spicehtml5proxy_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - nova_spicehtml5proxy_check_result['rc'] == 1 diff --git a/ansible/roles/nova/tasks/reconfigure.yml b/ansible/roles/nova/tasks/reconfigure.yml index af5164ee8d..b551dd92ac 100644 --- a/ansible/roles/nova/tasks/reconfigure.yml +++ b/ansible/roles/nova/tasks/reconfigure.yml @@ -1,10 +1,318 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['compute'] - or inventory_hostname in groups['nova-conductor'] - or inventory_hostname in groups['nova-api'] - or inventory_hostname in groups['nova-consoleauth'] - or inventory_hostname in groups['nova-scheduler'] - or inventory_hostname in groups['nova-compute-ironic'] - or inventory_hostname in groups['nova-novncproxy'] - or inventory_hostname in groups['nova-spicehtml5proxy'] +- name: Ensuring the nova libvirt, ssh, conductor, api, consoleauth and scheduler containers are up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: nova_libvirt, group: compute } + - { name: nova_ssh, group: compute } + - { name: nova_conductor, group: nova-conductor } + - { name: nova_api, group: nova-api } + - { name: nova_consoleauth, group: nova-consoleauth } + - { name: nova_scheduler, group: nova-scheduler } + +- name: Ensuring the nova_compute container is up + kolla_docker: + name: "nova_compute" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: + - not enable_nova_fake | bool + - inventory_hostname in groups['compute'] + +- name: Ensuring the nova_compute_ironic container is up + kolla_docker: + name: "nova_compute_ironic" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: + - enable_ironic | bool + - inventory_hostname in groups['nova-compute-ironic'] + +- name: Ensuring the nova_novncproxy container is up + kolla_docker: + name: "nova_novncproxy" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: + - nova_console == 'novnc' + - inventory_hostname in groups['nova-novncproxy'] + +- name: Ensuring the nova_spicehtml5proxy container is up + kolla_docker: + name: "nova_spicehtml5proxy" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: + - nova_console == 'spice' + - inventory_hostname in groups['nova-spicehtml5proxy'] + +- include: config.yml + +- name: Check the configs for nova libvirt, ssh, conductor, api, consoleauth and scheduler containers + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: nova_libvirt, group: compute } + - { name: nova_ssh, group: compute } + - { name: nova_conductor, group: nova-conductor } + - { name: nova_api, group: nova-api } + - { name: nova_consoleauth, group: nova-consoleauth } + - { name: nova_scheduler, group: nova-scheduler } + +- name: Check the configs in the nova_compute container + command: docker exec nova_compute /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: nova_compute_check_result + when: + - not enable_nova_fake | bool + - inventory_hostname in groups['compute'] + +- name: Check the configs in the nova_compute_ironic container + command: docker exec nova_compute_ironic /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: nova_compute_ironic_check_result + when: + - enable_ironic | bool + - inventory_hostname in groups['nova-compute-ironic'] + +- name: Check the configs in the nova_novncproxy container + command: docker exec nova_novncproxy /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: nova_novncproxy_check_result + when: + - nova_console == 'novnc' + - inventory_hostname in groups['nova-novncproxy'] + +- name: Check the configs in the nova_spicehtml5proxy container + command: docker exec nova_spicehtml5proxy /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: nova_spicehtml5proxy_check_result + when: + - nova_console == 'spice' + - inventory_hostname in groups['nova-spicehtml5proxy'] + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy for nova libvirt, ssh, conductor, api, consoleauth and scheduler containers + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: nova_libvirt, group: compute } + - { name: nova_ssh, group: compute } + - { name: nova_conductor, group: nova-conductor } + - { name: nova_api, group: nova-api } + - { name: nova_consoleauth, group: nova-consoleauth } + - { name: nova_scheduler, group: nova-scheduler } + +- name: Container config strategy for nova_compute + kolla_docker: + name: nova_compute + action: "get_container_env" + register: nova_compute_container_env + when: + - not enable_nova_fake | bool + - inventory_hostname in groups['compute'] + +- name: Container config strategy for nova_compute_ironic + kolla_docker: + name: nova_compute_ironic + action: "get_container_env" + register: nova_compute_ironic_container_env + when: + - enable_ironic | bool + - inventory_hostname in groups['nova-compute-ironic'] + +- name: Container config strategy for nova_novncproxy + kolla_docker: + name: nova_novncproxy + action: "get_container_env" + register: nova_novncproxy_container_env + when: + - nova_console == 'novnc' + - inventory_hostname in groups['nova-novncproxy'] + +- name: Container config strategy for nova_spicehtml5proxy + kolla_docker: + name: nova_spicehtml5proxy + action: "get_container_env" + register: nova_spicehtml5proxy_container_env + when: + - nova_console == 'spice' + - inventory_hostname in groups['nova-spicehtml5proxy'] + +- name: Remove the nova libvirt, ssh, conductor, api, consoleauth and scheduler containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + until: remote_container|success + retries: "{{ item[0]['retries']|default(0) }}" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + # NOTE(Jeffrey4l): retry 1 to remove nova_libvirt container because when + # guests running, nova_libvirt will raise error even though it is removed. + - [{ name: nova_libvirt, group: compute, retries: 1 }, + { name: nova_ssh, group: compute }, + { name: nova_conductor, group: nova-conductor }, + { name: nova_api, group: nova-api }, + { name: nova_consoleauth, group: nova-consoleauth }, + { name: nova_scheduler, group: nova-scheduler }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- name: Remove nova_compute container + kolla_docker: + name: nova_compute + action: "remove_container" + register: remove_nova_compute_container + when: + - not enable_nova_fake | bool + - inventory_hostname in groups['compute'] + - config_strategy == 'COPY_ONCE' or nova_compute_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - nova_compute_check_result['rc'] == 1 + +- name: Remove nova_compute_ironic container + kolla_docker: + name: nova_compute_ironic + action: "remove_container" + register: remove_nova_compute_ironic_container + when: + - enable_ironic | bool + - inventory_hostname in groups['nova-compute-ironic'] + - config_strategy == 'COPY_ONCE' or nova_compute_ironic_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - nova_compute_ironic_check_result['rc'] == 1 + +- name: Remove nova_novncproxy container + kolla_docker: + name: nova_novncproxy + action: "remove_container" + register: remove_nova_novncproxy_container + when: + - nova_console == 'novnc' + - inventory_hostname in groups['nova-novncproxy'] + - config_strategy == 'COPY_ONCE' or nova_novncproxy_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - nova_novncproxy_check_result['rc'] == 1 + +- name: Remove nova_spicehtml5proxy container + kolla_docker: + name: nova_spicehtml5proxy + action: "remove_container" + register: remove_nova_spicehtml5proxy_container + when: + - nova_console == 'spice' + - inventory_hostname in groups['nova-spicehtml5proxy'] + - config_strategy == 'COPY_ONCE' or nova_spicehtml5proxy_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - nova_spicehtml5proxy_check_result['rc'] == 1 + +- include: start.yml + when: remove_containers.changed + +- include: start.yml + when: + - not enable_nova_fake | bool + - remove_nova_compute_container.changed + +- include: start.yml + when: + - enable_ironic | bool + - remove_nova_compute_ironic_container.changed + +- include: start.yml + when: + - enable_ironic | bool + - remove_nova_compute_ironic_container.changed + +- include: start.yml + when: + - nova_console == 'novnc' + - remove_nova_novncproxy_container.changed + +- include: start.yml + when: + - nova_console == 'spice' + - remove_nova_spicehtml5proxy_container.changed + +- name: Restart the nova libvirt, ssh, conductor, api, consoleauth and scheduler containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - inventory_hostname in groups[item[0]['group']] + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: nova_libvirt, group: compute }, + { name: nova_ssh, group: compute }, + { name: nova_conductor, group: nova-conductor }, + { name: nova_api, group: nova-api }, + { name: nova_consoleauth, group: nova-consoleauth }, + { name: nova_scheduler, group: nova-scheduler }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- name: Restart the nova_compute container + kolla_docker: + name: "nova_compute" + action: "restart_container" + when: + - not enable_nova_fake | bool + - config_strategy == 'COPY_ALWAYS' + - inventory_hostname in groups['compute'] + - nova_compute_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - nova_compute_check_result['rc'] == 1 + +- name: Restart the nova_compute_ironic container + kolla_docker: + name: "nova_compute_ironic" + action: "restart_container" + when: + - enable_ironic | bool + - config_strategy == 'COPY_ALWAYS' + - inventory_hostname in groups['nova-compute-ironic'] + - nova_compute_ironic_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - nova_compute_ironic_check_result['rc'] == 1 + +- name: Restart the nova_novncproxy container + kolla_docker: + name: "nova_novncproxy" + action: "restart_container" + when: + - nova_console == 'novnc' + - config_strategy == 'COPY_ALWAYS' + - inventory_hostname in groups['nova-novncproxy'] + - nova_novncproxy_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - nova_novncproxy_check_result['rc'] == 1 + +- name: Restart the nova_spicehtml5proxy container + kolla_docker: + name: "nova_spicehtml5proxy" + action: "restart_container" + when: + - nova_console == 'spice' + - config_strategy == 'COPY_ALWAYS' + - inventory_hostname in groups['nova-spicehtml5proxy'] + - nova_spicehtml5proxy_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - nova_spicehtml5proxy_check_result['rc'] == 1 diff --git a/ansible/roles/rabbitmq/tasks/do_reconfigure.yml b/ansible/roles/rabbitmq/tasks/do_reconfigure.yml deleted file mode 100644 index 7524002b77..0000000000 --- a/ansible/roles/rabbitmq/tasks/do_reconfigure.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: rabbitmq, group: rabbitmq } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: rabbitmq, group: rabbitmq } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: rabbitmq, group: rabbitmq } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: rabbitmq, group: rabbitmq }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: rabbitmq, group: rabbitmq }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/rabbitmq/tasks/reconfigure.yml b/ansible/roles/rabbitmq/tasks/reconfigure.yml index 03cbcb70ed..7524002b77 100644 --- a/ansible/roles/rabbitmq/tasks/reconfigure.yml +++ b/ansible/roles/rabbitmq/tasks/reconfigure.yml @@ -1,3 +1,64 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['rabbitmq'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: rabbitmq, group: rabbitmq } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: rabbitmq, group: rabbitmq } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: rabbitmq, group: rabbitmq } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: rabbitmq, group: rabbitmq }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: rabbitmq, group: rabbitmq }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/rally/tasks/do_reconfigure.yml b/ansible/roles/rally/tasks/do_reconfigure.yml deleted file mode 100644 index 79c3dde5ac..0000000000 --- a/ansible/roles/rally/tasks/do_reconfigure.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: rally, group: rally } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: rally, group: rally } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: rally, group: rally } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: rally, group: rally }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: rally, group: rally }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/rally/tasks/reconfigure.yml b/ansible/roles/rally/tasks/reconfigure.yml index 2a1e32d9c2..79c3dde5ac 100644 --- a/ansible/roles/rally/tasks/reconfigure.yml +++ b/ansible/roles/rally/tasks/reconfigure.yml @@ -1,2 +1,64 @@ --- -- include: do_reconfigure.yml +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: rally, group: rally } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: rally, group: rally } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: rally, group: rally } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: rally, group: rally }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: rally, group: rally }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/sahara/tasks/do_reconfigure.yml b/ansible/roles/sahara/tasks/do_reconfigure.yml deleted file mode 100644 index 890f10645b..0000000000 --- a/ansible/roles/sahara/tasks/do_reconfigure.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: sahara_api, group: sahara-api } - - { name: sahara_engine, group: sahara-engine } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: sahara_api, group: sahara-api } - - { name: sahara_engine, group: sahara-engine } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: sahara_api, group: sahara-api } - - { name: sahara_engine, group: sahara-engine } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: sahara_api, group: sahara-api }, - { name: sahara_engine, group: sahara-engine },] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: sahara_api, group: sahara-api }, - { name: sahara_engine, group: sahara-engine },] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/sahara/tasks/reconfigure.yml b/ansible/roles/sahara/tasks/reconfigure.yml index 44748272af..890f10645b 100644 --- a/ansible/roles/sahara/tasks/reconfigure.yml +++ b/ansible/roles/sahara/tasks/reconfigure.yml @@ -1,4 +1,69 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['sahara-api'] - or inventory_hostname in groups['sahara-engine'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: sahara_api, group: sahara-api } + - { name: sahara_engine, group: sahara-engine } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: sahara_api, group: sahara-api } + - { name: sahara_engine, group: sahara-engine } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: sahara_api, group: sahara-api } + - { name: sahara_engine, group: sahara-engine } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: sahara_api, group: sahara-api }, + { name: sahara_engine, group: sahara-engine },] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: sahara_api, group: sahara-api }, + { name: sahara_engine, group: sahara-engine },] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/senlin/tasks/do_reconfigure.yml b/ansible/roles/senlin/tasks/do_reconfigure.yml deleted file mode 100644 index ffd25dc392..0000000000 --- a/ansible/roles/senlin/tasks/do_reconfigure.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: senlin_api, group: senlin-api } - - { name: senlin_engine, group: senlin-engine } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: senlin_api, group: senlin-api } - - { name: senlin_engine, group: senlin-engine } - -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: senlin_api, group: senlin-api } - - { name: senlin_engine, group: senlin-engine } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: senlin_api, group: senlin-api }, - { name: senlin_engine, group: senlin-engine }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: senlin_api, group: senlin-api }, - { name: senlin_engine, group: senlin-engine }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/senlin/tasks/reconfigure.yml b/ansible/roles/senlin/tasks/reconfigure.yml index 60d4d0ce20..ffd25dc392 100644 --- a/ansible/roles/senlin/tasks/reconfigure.yml +++ b/ansible/roles/senlin/tasks/reconfigure.yml @@ -1,4 +1,66 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['senlin-api'] - or inventory_hostname in groups['senlin-engine'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: senlin_api, group: senlin-api } + - { name: senlin_engine, group: senlin-engine } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: senlin_api, group: senlin-api } + - { name: senlin_engine, group: senlin-engine } + +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: senlin_api, group: senlin-api } + - { name: senlin_engine, group: senlin-engine } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: senlin_api, group: senlin-api }, + { name: senlin_engine, group: senlin-engine }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: senlin_api, group: senlin-api }, + { name: senlin_engine, group: senlin-engine }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/swift/tasks/do_reconfigure.yml b/ansible/roles/swift/tasks/do_reconfigure.yml deleted file mode 100644 index 3cb6ebe548..0000000000 --- a/ansible/roles/swift/tasks/do_reconfigure.yml +++ /dev/null @@ -1,144 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: swift_account_server, group: swift-account-server } - - { name: swift_account_auditor, group: swift-account-server } - - { name: swift_account_replicator, group: swift-account-server } - - { name: swift_account_reaper, group: swift-account-server } - - { name: swift_rsyncd, group: swift-account-server } - - { name: swift_container_server, group: swift-container-server } - - { name: swift_container_auditor, group: swift-container-server } - - { name: swift_container_replicator, group: swift-container-server } - - { name: swift_container_updater, group: swift-container-server } - - { name: swift_rsyncd, group: swift-container-server } - - { name: swift_object_server, group: swift-object-server } - - { name: swift_object_auditor, group: swift-object-server } - - { name: swift_object_replicator, group: swift-object-server } - - { name: swift_object_updater, group: swift-object-server } - - { name: swift_object_expirer, group: swift-object-server } - - { name: swift_rsyncd, group: swift-object-server } - - { name: swift_proxy_server, group: swift-proxy-server } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: swift_account_server, group: swift-account-server } - - { name: swift_account_auditor, group: swift-account-server } - - { name: swift_account_replicator, group: swift-account-server } - - { name: swift_account_reaper, group: swift-account-server } - - { name: swift_rsyncd, group: swift-account-server } - - { name: swift_container_server, group: swift-container-server } - - { name: swift_container_auditor, group: swift-container-server } - - { name: swift_container_replicator, group: swift-container-server } - - { name: swift_container_updater, group: swift-container-server } - - { name: swift_rsyncd, group: swift-container-server } - - { name: swift_object_server, group: swift-object-server } - - { name: swift_object_auditor, group: swift-object-server } - - { name: swift_object_replicator, group: swift-object-server } - - { name: swift_object_updater, group: swift-object-server } - - { name: swift_object_expirer, group: swift-object-server } - - { name: swift_rsyncd, group: swift-object-server } - - { name: swift_proxy_server, group: swift-proxy-server } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: swift_account_server, group: swift-account-server } - - { name: swift_account_auditor, group: swift-account-server } - - { name: swift_account_replicator, group: swift-account-server } - - { name: swift_account_reaper, group: swift-account-server } - - { name: swift_rsyncd, group: swift-account-server } - - { name: swift_container_server, group: swift-container-server } - - { name: swift_container_auditor, group: swift-container-server } - - { name: swift_container_replicator, group: swift-container-server } - - { name: swift_container_updater, group: swift-container-server } - - { name: swift_rsyncd, group: swift-container-server } - - { name: swift_object_server, group: swift-object-server } - - { name: swift_object_auditor, group: swift-object-server } - - { name: swift_object_replicator, group: swift-object-server } - - { name: swift_object_updater, group: swift-object-server } - - { name: swift_object_expirer, group: swift-object-server } - - { name: swift_rsyncd, group: swift-object-server } - - { name: swift_proxy_server, group: swift-proxy-server } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: swift_account_server, group: swift-account-server }, - { name: swift_account_auditor, group: swift-account-server }, - { name: swift_account_replicator, group: swift-account-server }, - { name: swift_account_reaper, group: swift-account-server }, - { name: swift_rsyncd, group: swift-account-server }, - { name: swift_container_server, group: swift-container-server }, - { name: swift_container_auditor, group: swift-container-server }, - { name: swift_container_replicator, group: swift-container-server }, - { name: swift_container_updater, group: swift-container-server }, - { name: swift_rsyncd, group: swift-container-server }, - { name: swift_object_server, group: swift-object-server }, - { name: swift_object_auditor, group: swift-object-server }, - { name: swift_object_replicator, group: swift-object-server }, - { name: swift_object_updater, group: swift-object-server }, - { name: swift_object_expirer, group: swift-object-server }, - { name: swift_rsyncd, group: swift-object-server }, - { name: swift_proxy_server, group: swift-proxy-server }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: swift_account_server, group: swift-account-server }, - { name: swift_account_auditor, group: swift-account-server }, - { name: swift_account_replicator, group: swift-account-server }, - { name: swift_account_reaper, group: swift-account-server }, - { name: swift_rsyncd, group: swift-account-server }, - { name: swift_container_server, group: swift-container-server }, - { name: swift_container_auditor, group: swift-container-server }, - { name: swift_container_replicator, group: swift-container-server }, - { name: swift_container_updater, group: swift-container-server }, - { name: swift_rsyncd, group: swift-container-server }, - { name: swift_object_server, group: swift-object-server }, - { name: swift_object_auditor, group: swift-object-server }, - { name: swift_object_replicator, group: swift-object-server }, - { name: swift_object_updater, group: swift-object-server }, - { name: swift_object_expirer, group: swift-object-server }, - { name: swift_rsyncd, group: swift-object-server }, - { name: swift_proxy_server, group: swift-proxy-server }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/swift/tasks/reconfigure.yml b/ansible/roles/swift/tasks/reconfigure.yml index 267bb70df1..3cb6ebe548 100644 --- a/ansible/roles/swift/tasks/reconfigure.yml +++ b/ansible/roles/swift/tasks/reconfigure.yml @@ -1,6 +1,144 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['swift-account-server'] or - inventory_hostname in groups['swift-container-server'] or - inventory_hostname in groups['swift-object-server'] or - inventory_hostname in groups['swift-proxy-server'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: swift_account_server, group: swift-account-server } + - { name: swift_account_auditor, group: swift-account-server } + - { name: swift_account_replicator, group: swift-account-server } + - { name: swift_account_reaper, group: swift-account-server } + - { name: swift_rsyncd, group: swift-account-server } + - { name: swift_container_server, group: swift-container-server } + - { name: swift_container_auditor, group: swift-container-server } + - { name: swift_container_replicator, group: swift-container-server } + - { name: swift_container_updater, group: swift-container-server } + - { name: swift_rsyncd, group: swift-container-server } + - { name: swift_object_server, group: swift-object-server } + - { name: swift_object_auditor, group: swift-object-server } + - { name: swift_object_replicator, group: swift-object-server } + - { name: swift_object_updater, group: swift-object-server } + - { name: swift_object_expirer, group: swift-object-server } + - { name: swift_rsyncd, group: swift-object-server } + - { name: swift_proxy_server, group: swift-proxy-server } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: swift_account_server, group: swift-account-server } + - { name: swift_account_auditor, group: swift-account-server } + - { name: swift_account_replicator, group: swift-account-server } + - { name: swift_account_reaper, group: swift-account-server } + - { name: swift_rsyncd, group: swift-account-server } + - { name: swift_container_server, group: swift-container-server } + - { name: swift_container_auditor, group: swift-container-server } + - { name: swift_container_replicator, group: swift-container-server } + - { name: swift_container_updater, group: swift-container-server } + - { name: swift_rsyncd, group: swift-container-server } + - { name: swift_object_server, group: swift-object-server } + - { name: swift_object_auditor, group: swift-object-server } + - { name: swift_object_replicator, group: swift-object-server } + - { name: swift_object_updater, group: swift-object-server } + - { name: swift_object_expirer, group: swift-object-server } + - { name: swift_rsyncd, group: swift-object-server } + - { name: swift_proxy_server, group: swift-proxy-server } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: swift_account_server, group: swift-account-server } + - { name: swift_account_auditor, group: swift-account-server } + - { name: swift_account_replicator, group: swift-account-server } + - { name: swift_account_reaper, group: swift-account-server } + - { name: swift_rsyncd, group: swift-account-server } + - { name: swift_container_server, group: swift-container-server } + - { name: swift_container_auditor, group: swift-container-server } + - { name: swift_container_replicator, group: swift-container-server } + - { name: swift_container_updater, group: swift-container-server } + - { name: swift_rsyncd, group: swift-container-server } + - { name: swift_object_server, group: swift-object-server } + - { name: swift_object_auditor, group: swift-object-server } + - { name: swift_object_replicator, group: swift-object-server } + - { name: swift_object_updater, group: swift-object-server } + - { name: swift_object_expirer, group: swift-object-server } + - { name: swift_rsyncd, group: swift-object-server } + - { name: swift_proxy_server, group: swift-proxy-server } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: swift_account_server, group: swift-account-server }, + { name: swift_account_auditor, group: swift-account-server }, + { name: swift_account_replicator, group: swift-account-server }, + { name: swift_account_reaper, group: swift-account-server }, + { name: swift_rsyncd, group: swift-account-server }, + { name: swift_container_server, group: swift-container-server }, + { name: swift_container_auditor, group: swift-container-server }, + { name: swift_container_replicator, group: swift-container-server }, + { name: swift_container_updater, group: swift-container-server }, + { name: swift_rsyncd, group: swift-container-server }, + { name: swift_object_server, group: swift-object-server }, + { name: swift_object_auditor, group: swift-object-server }, + { name: swift_object_replicator, group: swift-object-server }, + { name: swift_object_updater, group: swift-object-server }, + { name: swift_object_expirer, group: swift-object-server }, + { name: swift_rsyncd, group: swift-object-server }, + { name: swift_proxy_server, group: swift-proxy-server }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: swift_account_server, group: swift-account-server }, + { name: swift_account_auditor, group: swift-account-server }, + { name: swift_account_replicator, group: swift-account-server }, + { name: swift_account_reaper, group: swift-account-server }, + { name: swift_rsyncd, group: swift-account-server }, + { name: swift_container_server, group: swift-container-server }, + { name: swift_container_auditor, group: swift-container-server }, + { name: swift_container_replicator, group: swift-container-server }, + { name: swift_container_updater, group: swift-container-server }, + { name: swift_rsyncd, group: swift-container-server }, + { name: swift_object_server, group: swift-object-server }, + { name: swift_object_auditor, group: swift-object-server }, + { name: swift_object_replicator, group: swift-object-server }, + { name: swift_object_updater, group: swift-object-server }, + { name: swift_object_expirer, group: swift-object-server }, + { name: swift_rsyncd, group: swift-object-server }, + { name: swift_proxy_server, group: swift-proxy-server }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/telegraf/tasks/do_reconfigure.yml b/ansible/roles/telegraf/tasks/do_reconfigure.yml deleted file mode 100644 index 68a27d8a57..0000000000 --- a/ansible/roles/telegraf/tasks/do_reconfigure.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "telegraf" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - -- include: config.yml - -- name: Check the configs - command: docker exec telegraf /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "telegraf" - action: "get_container_env" - register: container_envs - -- name: Remove the containers - kolla_docker: - name: "telegraf" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "telegraf" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' diff --git a/ansible/roles/telegraf/tasks/reconfigure.yml b/ansible/roles/telegraf/tasks/reconfigure.yml index 2a1e32d9c2..68a27d8a57 100644 --- a/ansible/roles/telegraf/tasks/reconfigure.yml +++ b/ansible/roles/telegraf/tasks/reconfigure.yml @@ -1,2 +1,42 @@ --- -- include: do_reconfigure.yml +- name: Ensuring the containers up + kolla_docker: + name: "telegraf" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + +- include: config.yml + +- name: Check the configs + command: docker exec telegraf /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "telegraf" + action: "get_container_env" + register: container_envs + +- name: Remove the containers + kolla_docker: + name: "telegraf" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "telegraf" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' diff --git a/ansible/roles/tempest/tasks/do_reconfigure.yml b/ansible/roles/tempest/tasks/do_reconfigure.yml deleted file mode 100644 index 0aeab552f0..0000000000 --- a/ansible/roles/tempest/tasks/do_reconfigure.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: tempest, group: tempest } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: tempest, group: tempest } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: tempest, group: tempest } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: tempest, group: tempest }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: tempest, group: tempest }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/tempest/tasks/reconfigure.yml b/ansible/roles/tempest/tasks/reconfigure.yml index 2a1e32d9c2..0aeab552f0 100644 --- a/ansible/roles/tempest/tasks/reconfigure.yml +++ b/ansible/roles/tempest/tasks/reconfigure.yml @@ -1,2 +1,64 @@ --- -- include: do_reconfigure.yml +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: tempest, group: tempest } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: tempest, group: tempest } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: tempest, group: tempest } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: tempest, group: tempest }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: tempest, group: tempest }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/vmtp/tasks/do_reconfigure.yml b/ansible/roles/vmtp/tasks/do_reconfigure.yml deleted file mode 100644 index 3cf5f29402..0000000000 --- a/ansible/roles/vmtp/tasks/do_reconfigure.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -- name: Ensure container is up - kolla_docker: - name: "vmtp" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups['vmtp'] - -- include: config.yml - -- name: Check configuration - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups['vmtp'] - with_items: - - { name: vmtp, group: vmtp } - -# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' -# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', -# just remove the container and start again -- name: Containers config strategy - kolla_docker: - name: "vmtp" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups['vmtp'] - -- name: Remove the containers - kolla_docker: - name: "vmtp" - action: "remove_container" - register: remove_containers - when: - - config_strategy == "COPY_ONCE" or item[0]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[1]['rc'] == 1 - - inventory_hostname in groups['vmtp'] - with_together: - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "vmtp" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[1]['rc'] == 1 - - inventory_hostname in groups['vmtp'] - with_together: - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/vmtp/tasks/reconfigure.yml b/ansible/roles/vmtp/tasks/reconfigure.yml index 6d29b43269..3cf5f29402 100644 --- a/ansible/roles/vmtp/tasks/reconfigure.yml +++ b/ansible/roles/vmtp/tasks/reconfigure.yml @@ -1,3 +1,58 @@ --- -- include: do_reconfigure.yml +- name: Ensure container is up + kolla_docker: + name: "vmtp" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false when: inventory_hostname in groups['vmtp'] + +- include: config.yml + +- name: Check configuration + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups['vmtp'] + with_items: + - { name: vmtp, group: vmtp } + +# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' +# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', +# just remove the container and start again +- name: Containers config strategy + kolla_docker: + name: "vmtp" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups['vmtp'] + +- name: Remove the containers + kolla_docker: + name: "vmtp" + action: "remove_container" + register: remove_containers + when: + - config_strategy == "COPY_ONCE" or item[0]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[1]['rc'] == 1 + - inventory_hostname in groups['vmtp'] + with_together: + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "vmtp" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[1]['rc'] == 1 + - inventory_hostname in groups['vmtp'] + with_together: + - "{{ container_envs.results }}" + - "{{ check_results.results }}" diff --git a/ansible/roles/watcher/tasks/do_reconfigure.yml b/ansible/roles/watcher/tasks/do_reconfigure.yml deleted file mode 100644 index e28ec6ab6f..0000000000 --- a/ansible/roles/watcher/tasks/do_reconfigure.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: watcher_api, group: watcher-api } - - { name: watcher_engine, group: watcher-engine } - - { name: watcher_applier, group: watcher-applier } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: watcher_api, group: watcher-api } - - { name: watcher_engine, group: watcher-engine } - - { name: watcher_applier, group: watcher-applier } - -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: watcher_api, group: watcher-api } - - { name: watcher_engine, group: watcher-engine } - - { name: watcher_applier, group: watcher-applier } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: watcher_api, group: watcher-api }, - { name: watcher_engine, group: watcher-engine }, - { name: watcher_applier, group: watcher-applier }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: watcher_api, group: watcher-api }, - { name: watcher_engine, group: watcher-engine }, - { name: watcher_applier, group: watcher-applier }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/watcher/tasks/reconfigure.yml b/ansible/roles/watcher/tasks/reconfigure.yml index 1dee3652df..e28ec6ab6f 100644 --- a/ansible/roles/watcher/tasks/reconfigure.yml +++ b/ansible/roles/watcher/tasks/reconfigure.yml @@ -1,5 +1,71 @@ --- -- include: do_reconfigure.yml - when: inventory_hostname in groups['watcher-api'] - or inventory_hostname in groups['watcher-engine'] - or inventory_hostname in groups['watcher-applier'] +- name: Ensuring the containers up + kolla_docker: + name: "{{ item.name }}" + action: "get_container_state" + register: container_state + failed_when: container_state.Running == false + when: inventory_hostname in groups[item.group] + with_items: + - { name: watcher_api, group: watcher-api } + - { name: watcher_engine, group: watcher-engine } + - { name: watcher_applier, group: watcher-applier } + +- include: config.yml + +- name: Check the configs + command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check + changed_when: false + failed_when: false + register: check_results + when: inventory_hostname in groups[item.group] + with_items: + - { name: watcher_api, group: watcher-api } + - { name: watcher_engine, group: watcher-engine } + - { name: watcher_applier, group: watcher-applier } + +- name: Containers config strategy + kolla_docker: + name: "{{ item.name }}" + action: "get_container_env" + register: container_envs + when: inventory_hostname in groups[item.group] + with_items: + - { name: watcher_api, group: watcher-api } + - { name: watcher_engine, group: watcher-engine } + - { name: watcher_applier, group: watcher-applier } + +- name: Remove the containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "remove_container" + register: remove_containers + when: + - inventory_hostname in groups[item[0]['group']] + - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' + - item[2]['rc'] == 1 + with_together: + - [{ name: watcher_api, group: watcher-api }, + { name: watcher_engine, group: watcher-engine }, + { name: watcher_applier, group: watcher-applier }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}" + +- include: start.yml + when: remove_containers.changed + +- name: Restart containers + kolla_docker: + name: "{{ item[0]['name'] }}" + action: "restart_container" + when: + - config_strategy == 'COPY_ALWAYS' + - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' + - item[2]['rc'] == 1 + - inventory_hostname in groups[item[0]['group']] + with_together: + - [{ name: watcher_api, group: watcher-api }, + { name: watcher_engine, group: watcher-engine }, + { name: watcher_applier, group: watcher-applier }] + - "{{ container_envs.results }}" + - "{{ check_results.results }}"