From 87b458c8cf55623dc422f9c68595cfe99ff673dc Mon Sep 17 00:00:00 2001 From: Doug Szumski Date: Thu, 1 Mar 2018 15:42:38 +0000 Subject: [PATCH] Add support for deploying Zookeeper Previously reviewed here: https://github.com/stackhpc/kayobe/pull/136 Change-Id: I100a649f9bd659dde8a68684303c4eb4f654414d Task: 6696 Story: 2001627 --- ansible/group_vars/all/kolla | 5 +++++ ansible/kolla-openstack.yml | 2 ++ ansible/roles/kolla-ansible/defaults/main.yml | 2 ++ .../kolla-ansible/templates/overcloud-components.j2 | 3 +++ ansible/roles/kolla-ansible/tests/test-defaults.yml | 1 + ansible/roles/kolla-ansible/tests/test-extras.yml | 2 ++ ansible/roles/kolla-ansible/vars/main.yml | 1 + ansible/roles/kolla-openstack/defaults/main.yml | 9 +++++++++ .../molecule/default/tests/test_default.py | 3 ++- .../molecule/enable-everything/molecule.yml | 4 ++++ .../molecule/enable-everything/tests/test_default.py | 6 ++++-- ansible/roles/kolla-openstack/tasks/config.yml | 1 + ansible/roles/kolla-openstack/templates/zookeeper.cfg.j2 | 9 +++++++++ ansible/roles/kolla-openstack/vars/main.yml | 5 +++++ 14 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 ansible/roles/kolla-openstack/templates/zookeeper.cfg.j2 diff --git a/ansible/group_vars/all/kolla b/ansible/group_vars/all/kolla index 41351a8d8..a64e5da49 100644 --- a/ansible/group_vars/all/kolla +++ b/ansible/group_vars/all/kolla @@ -181,6 +181,8 @@ overcloud_container_image_regex_map: enabled: "{{ kolla_enable_swift | bool }}" - regex: tgtd enabled: "{{ kolla_enable_cinder | bool or kolla_enable_ironic | bool }}" + - regex: zookeeper + enabled: "{{ kolla_enable_zookeeper | bool or kolla_enable_kafka | bool }}" # List of regular expressions matching names of container images to build for # overcloud hosts. @@ -302,6 +304,8 @@ kolla_enable_haproxy: "yes" kolla_enable_heat: "yes" kolla_enable_horizon: "yes" kolla_enable_ironic: "yes" +# Kafka is not currently supported +kolla_enable_kafka: "no" kolla_enable_kibana: "{{ 'yes' if kolla_enable_central_logging | bool else 'no' }}" kolla_enable_magnum: "no" kolla_enable_manila: "no" @@ -315,6 +319,7 @@ kolla_enable_osprofiler: "no" kolla_enable_sahara: "no" kolla_enable_skydive: "no" kolla_enable_swift: "no" +kolla_enable_zookeeper: "no" ############################################################################### # Passwords and credentials. diff --git a/ansible/kolla-openstack.yml b/ansible/kolla-openstack.yml index 018916e70..babf5d565 100644 --- a/ansible/kolla-openstack.yml +++ b/ansible/kolla-openstack.yml @@ -113,6 +113,7 @@ - { name: neutron_ml2, file: neutron/ml2_conf.ini } - { name: nova, file: nova.conf } - { name: sahara, file: sahara.conf } + - { name: zookeeper, file: zookeeper.cfg } - name: Initialise a fact containing extra configuration set_fact: @@ -213,4 +214,5 @@ kolla_extra_neutron_ml2: "{{ kolla_extra_config.neutron_ml2 | default }}" kolla_extra_nova: "{{ kolla_extra_config.nova | default }}" kolla_extra_sahara: "{{ kolla_extra_config.sahara | default }}" + kolla_extra_zookeeper: "{{ kolla_extra_config.zookeeper | default }}" kolla_extra_config_path: "{{ kayobe_config_path }}/kolla/config" diff --git a/ansible/roles/kolla-ansible/defaults/main.yml b/ansible/roles/kolla-ansible/defaults/main.yml index 4d2496188..70c01d6c0 100644 --- a/ansible/roles/kolla-ansible/defaults/main.yml +++ b/ansible/roles/kolla-ansible/defaults/main.yml @@ -207,6 +207,7 @@ kolla_openstack_logging_debug: #kolla_enable_horizon: #kolla_enable_influxdb: #kolla_enable_ironic: +#kolla_enable_kafka: #kolla_enable_kuryr: #kolla_enable_magnum: #kolla_enable_manila: @@ -227,6 +228,7 @@ kolla_openstack_logging_debug: #kolla_enable_telegraf: #kolla_enable_tempest: #kolla_enable_watcher: +#kolla_enable_zookeeper: ####################### # Nova options diff --git a/ansible/roles/kolla-ansible/templates/overcloud-components.j2 b/ansible/roles/kolla-ansible/templates/overcloud-components.j2 index de3c274ea..baded2d1d 100644 --- a/ansible/roles/kolla-ansible/templates/overcloud-components.j2 +++ b/ansible/roles/kolla-ansible/templates/overcloud-components.j2 @@ -199,3 +199,6 @@ control [skydive:children] monitoring + +[zookeeper:children] +monitoring diff --git a/ansible/roles/kolla-ansible/tests/test-defaults.yml b/ansible/roles/kolla-ansible/tests/test-defaults.yml index 11ad631c7..4137bc60e 100644 --- a/ansible/roles/kolla-ansible/tests/test-defaults.yml +++ b/ansible/roles/kolla-ansible/tests/test-defaults.yml @@ -118,6 +118,7 @@ - enable_ironic - enable_neutron - enable_nova + - enable_zookeeper - grafana_admin_username - name: Check whether inventory files exist diff --git a/ansible/roles/kolla-ansible/tests/test-extras.yml b/ansible/roles/kolla-ansible/tests/test-extras.yml index e1f378ae8..712481cd5 100644 --- a/ansible/roles/kolla-ansible/tests/test-extras.yml +++ b/ansible/roles/kolla-ansible/tests/test-extras.yml @@ -121,6 +121,7 @@ kolla_enable_tempest: True kolla_enable_trove: True kolla_enable_watcher: True + kolla_enable_zookeeper: True kolla_enable_zun: True kolla_extra_globals: extra-global-1: "extra-val-1" @@ -253,6 +254,7 @@ #enable_tempest: True #enable_trove: True #enable_watcher: True + #enable_zookeeper: True #enable_zun: True extra-global-1: "extra-val-1" extra-global-2: "extra-val-2" diff --git a/ansible/roles/kolla-ansible/vars/main.yml b/ansible/roles/kolla-ansible/vars/main.yml index 0fcf327f7..cddaa4449 100644 --- a/ansible/roles/kolla-ansible/vars/main.yml +++ b/ansible/roles/kolla-ansible/vars/main.yml @@ -118,4 +118,5 @@ kolla_feature_flags: - tempest - trove - watcher + - zookeeper - zun diff --git a/ansible/roles/kolla-openstack/defaults/main.yml b/ansible/roles/kolla-openstack/defaults/main.yml index fc0575b98..003b14c60 100644 --- a/ansible/roles/kolla-openstack/defaults/main.yml +++ b/ansible/roles/kolla-openstack/defaults/main.yml @@ -348,3 +348,12 @@ kolla_extra_sahara: # Whether to enable swift. kolla_enable_swift: + +############################################################################### +# Zookeeper configuration. + +# Whether to enable Zookeeper. +kolla_enable_zookeeper: + +# Free form extra configuration to append to zookeeper.cfg. +kolla_extra_zookeeper: diff --git a/ansible/roles/kolla-openstack/molecule/default/tests/test_default.py b/ansible/roles/kolla-openstack/molecule/default/tests/test_default.py index dafca645d..c3ea79ef6 100644 --- a/ansible/roles/kolla-openstack/molecule/default/tests/test_default.py +++ b/ansible/roles/kolla-openstack/molecule/default/tests/test_default.py @@ -51,7 +51,8 @@ def test_service_config_directory(host, path): 'neutron', 'nova', 'sahara', - 'swift']) + 'swift', + 'zookeeper']) def test_service_config_directory_absent(host, path): path = os.path.join('/etc/kolla/config', path) utils.test_path_absent(host, path) diff --git a/ansible/roles/kolla-openstack/molecule/enable-everything/molecule.yml b/ansible/roles/kolla-openstack/molecule/enable-everything/molecule.yml index f020def9b..50db855d3 100644 --- a/ansible/roles/kolla-openstack/molecule/enable-everything/molecule.yml +++ b/ansible/roles/kolla-openstack/molecule/enable-everything/molecule.yml @@ -78,6 +78,10 @@ provisioner: [extra-sahara.conf] foo=bar kolla_enable_swift: True + kolla_enable_zookeeper: True + kolla_extra_zookeeper: | + [extra-zookeeper.cfg] + foo=bar lint: name: ansible-lint scenario: diff --git a/ansible/roles/kolla-openstack/molecule/enable-everything/tests/test_default.py b/ansible/roles/kolla-openstack/molecule/enable-everything/tests/test_default.py index 7217b7b6c..262e3d361 100644 --- a/ansible/roles/kolla-openstack/molecule/enable-everything/tests/test_default.py +++ b/ansible/roles/kolla-openstack/molecule/enable-everything/tests/test_default.py @@ -44,7 +44,8 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 'neutron', 'nova', 'sahara', - 'swift']) + 'swift', + 'zookeeper']) def test_service_config_directory(host, path): path = os.path.join('/etc/kolla/config', path) utils.test_directory(host, path) @@ -65,7 +66,8 @@ def test_service_config_directory(host, path): 'murano.conf', 'neutron.conf', 'nova.conf', - 'sahara.conf']) + 'sahara.conf', + 'zookeeper.cfg']) def test_service_ini_file(host, path): # TODO(mgoddard): Check more of config file contents. path = os.path.join('/etc/kolla/config', path) diff --git a/ansible/roles/kolla-openstack/tasks/config.yml b/ansible/roles/kolla-openstack/tasks/config.yml index 484ef4d45..341f26e73 100644 --- a/ansible/roles/kolla-openstack/tasks/config.yml +++ b/ansible/roles/kolla-openstack/tasks/config.yml @@ -29,6 +29,7 @@ - { src: nova.conf.j2, dest: nova.conf, enabled: "{{ kolla_enable_nova }}" } - { src: pxelinux.default.j2, dest: ironic/pxelinux.default, enabled: "{{ kolla_enable_ironic }}" } - { src: sahara.conf.j2, dest: sahara.conf, enabled: "{{ kolla_enable_sahara }}" } + - { src: zookeeper.cfg.j2, dest: zookeeper.cfg, enabled: "{{ kolla_enable_zookeeper }}" } when: item.enabled | bool - name: Ensure the ironic inspector kernel and ramdisk are downloaded diff --git a/ansible/roles/kolla-openstack/templates/zookeeper.cfg.j2 b/ansible/roles/kolla-openstack/templates/zookeeper.cfg.j2 new file mode 100644 index 000000000..08bdc8aa2 --- /dev/null +++ b/ansible/roles/kolla-openstack/templates/zookeeper.cfg.j2 @@ -0,0 +1,9 @@ +# {{ ansible_managed }} + +{% if kolla_extra_zookeeper %} +####################### +# Extra configuration +####################### + +{{ kolla_extra_zookeeper }} +{% endif %} diff --git a/ansible/roles/kolla-openstack/vars/main.yml b/ansible/roles/kolla-openstack/vars/main.yml index bbe4aca88..cfd4f43be 100644 --- a/ansible/roles/kolla-openstack/vars/main.yml +++ b/ansible/roles/kolla-openstack/vars/main.yml @@ -108,3 +108,8 @@ kolla_openstack_custom_config: dest: "{{ kolla_node_custom_config_path }}/swift" patterns: "*" enabled: "{{ kolla_enable_swift }}" + # Zookeeper. + - src: "{{ kolla_extra_config_path }}/zookeeper" + dest: "{{ kolla_node_custom_config_path }}/zookeeper" + patterns: "*" + enabled: "{{ kolla_enable_zookeeper }}"