diff --git a/ansible/roles/glance/defaults/main.yml b/ansible/roles/glance/defaults/main.yml index d8dbed8c60..3e35923e89 100644 --- a/ansible/roles/glance/defaults/main.yml +++ b/ansible/roles/glance/defaults/main.yml @@ -1,5 +1,9 @@ --- project_name: "glance" +glance_service_groups: + - { name: glance_api, service: glance-api, group: glance-api } + - { name: glance_registry, service: glance-registry, group: glance-registry } + #################### # Ceph diff --git a/ansible/roles/glance/tasks/config.yml b/ansible/roles/glance/tasks/config.yml index eb9bf16914..8a29534b0a 100644 --- a/ansible/roles/glance/tasks/config.yml +++ b/ansible/roles/glance/tasks/config.yml @@ -5,18 +5,14 @@ state: "directory" recurse: yes when: inventory_hostname in groups[item.group] - with_items: - - { service: glance-api, group: glance-api } - - { service: glance-registry, group: glance-registry } + with_items: "{{ glance_service_groups }}" - name: Copying over config.json files for services template: src: "{{ item.service }}.json.j2" dest: "{{ node_config_directory }}/{{ item.service }}/config.json" when: inventory_hostname in groups[item.group] - with_items: - - { service: glance-api, group: glance-api } - - { service: glance-registry, group: glance-registry } + with_items: "{{ glance_service_groups }}" - name: Copying over glance-*.conf merge_configs: @@ -32,7 +28,4 @@ - "/etc/kolla/config/glance/{{ inventory_hostname }}/{{ item.service }}.conf" dest: "{{ node_config_directory }}/{{ item.service }}/{{ item.service }}.conf" when: inventory_hostname in groups[item.group] - with_items: - - { service: glance-api, group: glance-api } - - { service: glance-registry, group: glance-registry } - + with_items: "{{ glance_service_groups }}" diff --git a/ansible/roles/glance/tasks/do_reconfigure.yml b/ansible/roles/glance/tasks/do_reconfigure.yml index dc3483ae63..ae685dd0e5 100644 --- a/ansible/roles/glance/tasks/do_reconfigure.yml +++ b/ansible/roles/glance/tasks/do_reconfigure.yml @@ -6,9 +6,7 @@ register: container_state failed_when: container_state.Running == false when: inventory_hostname in groups[item.group] - with_items: - - { name: glance_api, group: glance-api } - - { name: glance_registry, group: glance-registry } + with_items: "{{ glance_service_groups }}" - include: config.yml @@ -18,9 +16,7 @@ failed_when: false register: check_results when: inventory_hostname in groups[item.group] - with_items: - - { name: glance_api, group: glance-api } - - { name: glance_registry, group: glance-registry } + with_items: "{{ glance_service_groups }}" # NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' # and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', @@ -31,9 +27,7 @@ action: "get_container_env" register: container_envs when: inventory_hostname in groups[item.group] - with_items: - - { name: glance_api, group: glance-api } - - { name: glance_registry, group: glance-registry } + with_items: "{{ glance_service_groups }}" - name: Remove the containers kolla_docker: @@ -45,8 +39,7 @@ - item[2]['rc'] == 1 - inventory_hostname in groups[item[0]['group']] with_together: - - [{ name: glance_api, group: glance-api }, - { name: glance_registry, group: glance-registry }] + - "{{ glance_service_groups }}" - container_envs.results - check_results.results @@ -63,7 +56,6 @@ - item[2]['rc'] == 1 - inventory_hostname in groups[item[0]['group']] with_together: - - [{ name: glance_api, group: glance-api }, - { name: glance_registry, group: glance-registry }] + - "{{ glance_service_groups }}" - container_envs.results - check_results.results