From e7f1062d5105ee91891261a589701f7fae8335c4 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 3 Mar 2020 17:00:48 +1100 Subject: [PATCH] Add install zookeeper role; use for nodepool-builder testing This adds a simple role to install Zookeeper. Add an option to nodepool-base to use this role to install Zookeeper. Use this in the nodepool-builder gate testing where we are just validating that the nodepool-builder container starts and is ready to accept connections. It needs a zookeeper to talk to, even though it is not going to do anything. Change-Id: I4ae89a51e454be4ee53ad4e04407162aaa8d9f9a --- playbooks/roles/install-zookeeper/README.rst | 4 ++++ playbooks/roles/install-zookeeper/tasks/main.yaml | 11 +++++++++++ playbooks/roles/nodepool-base/README.rst | 7 +++++++ playbooks/roles/nodepool-base/defaults/main.yaml | 1 + playbooks/roles/nodepool-base/tasks/main.yaml | 5 +++++ playbooks/zuul/run-base.yaml | 1 + .../templates/host_vars/nb01-test.opendev.org.yaml.j2 | 1 + 7 files changed, 30 insertions(+) create mode 100644 playbooks/roles/install-zookeeper/README.rst create mode 100644 playbooks/roles/install-zookeeper/tasks/main.yaml create mode 100644 playbooks/roles/nodepool-base/defaults/main.yaml create mode 100644 playbooks/zuul/templates/host_vars/nb01-test.opendev.org.yaml.j2 diff --git a/playbooks/roles/install-zookeeper/README.rst b/playbooks/roles/install-zookeeper/README.rst new file mode 100644 index 0000000000..32679cb981 --- /dev/null +++ b/playbooks/roles/install-zookeeper/README.rst @@ -0,0 +1,4 @@ +An ansible role to install Zookeeper + +**Role Variables** + diff --git a/playbooks/roles/install-zookeeper/tasks/main.yaml b/playbooks/roles/install-zookeeper/tasks/main.yaml new file mode 100644 index 0000000000..8373973487 --- /dev/null +++ b/playbooks/roles/install-zookeeper/tasks/main.yaml @@ -0,0 +1,11 @@ +- name: Install zookeeper + package: + name: + - zookeeper + - zookeeperd + state: present + +- name: Start zookeeper service + service: + name: zookeeper + state: started \ No newline at end of file diff --git a/playbooks/roles/nodepool-base/README.rst b/playbooks/roles/nodepool-base/README.rst index 0affcb4c94..d12b86e5e8 100644 --- a/playbooks/roles/nodepool-base/README.rst +++ b/playbooks/roles/nodepool-base/README.rst @@ -1,3 +1,10 @@ nodepool base setup **Role Variables** + +.. zuul:rolevar:: nodepool_base_install_zookeeper + + Install zookeeper to the node. This is not expected to be used in + production, where the nodes would connect to an externally + configured zookeeper instance. It can be useful for basic loopback + tests in the gate, however. diff --git a/playbooks/roles/nodepool-base/defaults/main.yaml b/playbooks/roles/nodepool-base/defaults/main.yaml new file mode 100644 index 0000000000..4f299f5df0 --- /dev/null +++ b/playbooks/roles/nodepool-base/defaults/main.yaml @@ -0,0 +1 @@ +nodepool_base_install_zookeeper: False \ No newline at end of file diff --git a/playbooks/roles/nodepool-base/tasks/main.yaml b/playbooks/roles/nodepool-base/tasks/main.yaml index 5704ecf034..df43052c00 100644 --- a/playbooks/roles/nodepool-base/tasks/main.yaml +++ b/playbooks/roles/nodepool-base/tasks/main.yaml @@ -11,6 +11,11 @@ create_home: yes shell: /bin/bash +- name: Install zookeeper + include_role: + name: install-zookeeper + when: nodepool_base_install_zookeeper + # NOTE(ianw) : A note on testing; we have some configurations for # system-config-run-nodepool test hosts committed to project-config. # Since this is a protected repo we can't speculatively test, which is diff --git a/playbooks/zuul/run-base.yaml b/playbooks/zuul/run-base.yaml index 3a8d553619..ff335289c1 100644 --- a/playbooks/zuul/run-base.yaml +++ b/playbooks/zuul/run-base.yaml @@ -92,6 +92,7 @@ - host_vars/mirror-update01.opendev.org.yaml - host_vars/backup-test01.opendev.org.yaml - host_vars/backup-test02.opendev.org.yaml + - host_vars/nb01-test.opendev.org.yaml - name: Display group membership command: ansible localhost -m debug -a 'var=groups' - name: Run base.yaml diff --git a/playbooks/zuul/templates/host_vars/nb01-test.opendev.org.yaml.j2 b/playbooks/zuul/templates/host_vars/nb01-test.opendev.org.yaml.j2 new file mode 100644 index 0000000000..d2799c226a --- /dev/null +++ b/playbooks/zuul/templates/host_vars/nb01-test.opendev.org.yaml.j2 @@ -0,0 +1 @@ +nodepool_base_install_zookeeper: True \ No newline at end of file