diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index c6907097ab..4596fa13f6 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -54,7 +54,6 @@ monitoring [etcd:children] control -compute [kafka:children] control diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index b796c2986a..80a39b601b 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -73,7 +73,6 @@ monitoring [etcd:children] control -compute [influxdb:children] monitoring diff --git a/ansible/roles/etcd/defaults/main.yml b/ansible/roles/etcd/defaults/main.yml index 5f2f6a1667..14de766574 100644 --- a/ansible/roles/etcd/defaults/main.yml +++ b/ansible/roles/etcd/defaults/main.yml @@ -14,12 +14,11 @@ etcd_services: ETCD_INITIAL_ADVERTISE_PEER_URLS: "{{ internal_protocol }}://{{ api_interface_address }}:{{ etcd_peer_port }}" ETCD_LISTEN_PEER_URLS: "{{ internal_protocol }}://{{ api_interface_address }}:{{ etcd_peer_port }}" ETCD_INITIAL_CLUSTER_TOKEN: "{{ etcd_cluster_token }}" - ETCD_INITIAL_CLUSTER: "{% for host in etcd_hosts %}{{ hostvars[host]['ansible_hostname'] }}={{ internal_protocol }}://{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ etcd_peer_port }}{% if not loop.last %},{% endif %}{% endfor %}" + ETCD_INITIAL_CLUSTER: "{% for host in groups['etcd'] %}{{ hostvars[host]['ansible_hostname'] }}={{ internal_protocol }}://{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ etcd_peer_port }}{% if not loop.last %},{% endif %}{% endfor %}" ETCD_INITIAL_CLUSTER_STATE: "new" ETCD_OUT_FILE: "/var/log/kolla/etcd/etcd.log" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" image: "{{ etcd_image_full }}" - host_in_groups: "{{ inventory_hostname in etcd_hosts }}" volumes: - "{{ node_config_directory }}/etcd/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" @@ -35,6 +34,3 @@ etcd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_nam etcd_tag: "{{ openstack_release }}" etcd_image_full: "{{ etcd_image }}:{{ etcd_tag }}" etcd_dimensions: "{{ default_container_dimensions }}" - -# List of hosts running etcd. -etcd_hosts: "{{ groups['control'] }}" diff --git a/ansible/roles/etcd/handlers/main.yml b/ansible/roles/etcd/handlers/main.yml index e5e83c02f3..c9fd38d132 100644 --- a/ansible/roles/etcd/handlers/main.yml +++ b/ansible/roles/etcd/handlers/main.yml @@ -17,6 +17,6 @@ when: - kolla_action != "config" - service.enabled | bool - - service.host_in_groups | bool + - inventory_hostname in groups[service.group] - config_json.changed | bool or etcd_container.changed | bool diff --git a/ansible/roles/etcd/tasks/config.yml b/ansible/roles/etcd/tasks/config.yml index 340d91ea10..dd827b2223 100644 --- a/ansible/roles/etcd/tasks/config.yml +++ b/ansible/roles/etcd/tasks/config.yml @@ -9,7 +9,7 @@ become: true when: - item.value.enabled | bool - - item.value.host_in_groups | bool + - inventory_hostname in groups[item.value.group] with_dict: "{{ etcd_services }}" - name: Copying over config.json files for services @@ -21,7 +21,7 @@ register: etcd_config_jsons when: - item.value.enabled | bool - - item.value.host_in_groups | bool + - inventory_hostname in groups[item.value.group] with_dict: "{{ etcd_services }}" notify: - Restart etcd container @@ -40,7 +40,7 @@ when: - kolla_action != "config" - item.value.enabled | bool - - item.value.host_in_groups | bool + - inventory_hostname in groups[item.value.group] with_dict: "{{ etcd_services }}" notify: - Restart etcd container diff --git a/ansible/roles/etcd/tasks/precheck.yml b/ansible/roles/etcd/tasks/precheck.yml index 8ac30f11bc..8b0a0433f3 100644 --- a/ansible/roles/etcd/tasks/precheck.yml +++ b/ansible/roles/etcd/tasks/precheck.yml @@ -14,7 +14,7 @@ state: stopped when: - container_facts['etcd'] is not defined - - inventory_hostname in groups['etcd'] + - inventory_hostname in groups[etcd_services.etcd.group] - name: Checking free port for Etcd Client wait_for: @@ -25,4 +25,4 @@ state: stopped when: - container_facts['etcd'] is not defined - - inventory_hostname in groups['etcd'] + - inventory_hostname in groups[etcd_services.etcd.group] diff --git a/ansible/roles/etcd/tasks/pull.yml b/ansible/roles/etcd/tasks/pull.yml index e5f18270d6..1c703daf01 100644 --- a/ansible/roles/etcd/tasks/pull.yml +++ b/ansible/roles/etcd/tasks/pull.yml @@ -7,5 +7,5 @@ image: "{{ item.value.image }}" when: - item.value.enabled | bool - - item.value.host_in_groups | bool + - inventory_hostname in groups[item.value.group] with_dict: "{{ etcd_services }}" diff --git a/tests/templates/inventory.j2 b/tests/templates/inventory.j2 index 61dcf28ec8..7cce60a6e4 100644 --- a/tests/templates/inventory.j2 +++ b/tests/templates/inventory.j2 @@ -52,7 +52,6 @@ monitoring [etcd:children] control -compute [karbor:children] control