Remove compute hosts from etcd group

Since I701d495675178c3ed8ec1f00b31d09f198b38a6f merged, etcd only runs
on the control hosts, not the compute hosts. We therefore no longer
require the etcd group to include the compute hosts.

Since the group mapping is now static, we can remove the use of
host_in_groups from the etcd service, in favour of the simpler method of
specifying the group.

Change-Id: Id8f888d7321a30a85ff95e742f7e6c8e2b9c696f
Related-Bug: #1790415
This commit is contained in:
Mark Goddard 2018-09-04 18:51:27 +01:00
parent 4dcb4ce741
commit ee7a29cf00
8 changed files with 8 additions and 15 deletions

View File

@ -54,7 +54,6 @@ monitoring
[etcd:children]
control
compute
[kafka:children]
control

View File

@ -73,7 +73,6 @@ monitoring
[etcd:children]
control
compute
[influxdb:children]
monitoring

View File

@ -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'] }}"

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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 }}"

View File

@ -52,7 +52,6 @@ monitoring
[etcd:children]
control
compute
[karbor:children]
control