From c34860d166f6d69b3c9d4d1030b2f98936c06806 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 30 Aug 2018 16:00:46 -0700 Subject: [PATCH] Add a run-nodepool job Change-Id: I9d0721a7db7f355683895fca5a2a5f152d147034 --- .zuul.yaml | 24 +++++++++++++++++++ playbooks/base.yaml | 1 + playbooks/roles/minimal-nodepool/README.rst | 9 +++++++ .../roles/minimal-nodepool/tasks/main.yaml | 12 ++++++++++ .../templates/clouds/nodepool_clouds.yaml.j2 | 2 +- testinfra/test_nodepool.py | 23 ++++++++++++++++++ 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 playbooks/roles/minimal-nodepool/README.rst create mode 100644 playbooks/roles/minimal-nodepool/tasks/main.yaml create mode 100644 testinfra/test_nodepool.py diff --git a/.zuul.yaml b/.zuul.yaml index c82dfda491..d5e6ec7279 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -173,6 +173,28 @@ - playbooks/group_vars/eavesdrop.yaml - testinfra/test_eavesdrop.py +- job: + name: system-config-run-nodepool + parent: system-config-run + description: | + Run the playbook for nodepool. + nodeset: + nodes: + - name: bridge.openstack.org + label: ubuntu-bionic + - name: nl01.openstack.org + label: ubuntu-xenial + - name: nb01.openstack.org + label: ubuntu-xenial + files: + - .zuul.yaml + - playbooks/group_vars/nodepool.yaml + - playbooks/group_vars/nodepool-builder.yaml + - playbooks/group_vars/nodepool-launcher.yaml + - playbooks/roles/configure-openstacksdk/ + - playbooks/templates/clouds/ + - testinfra/test_nodepool.py + - project: templates: - system-config-zuul-role-integration @@ -184,6 +206,7 @@ - puppet-beaker-rspec-puppet-4-centos-7-infra-system-config - system-config-run-base - system-config-run-eavesdrop + - system-config-run-nodepool gate: jobs: - puppet-beaker-rspec-infra-system-config @@ -192,3 +215,4 @@ - puppet-beaker-rspec-puppet-4-centos-7-infra-system-config - system-config-run-base - system-config-run-eavesdrop + - system-config-run-nodepool \ No newline at end of file diff --git a/playbooks/base.yaml b/playbooks/base.yaml index 2c9b5d825d..7e011bb300 100644 --- a/playbooks/base.yaml +++ b/playbooks/base.yaml @@ -26,6 +26,7 @@ - hosts: nodepool-launcher:nodepool-builder:!disabled strategy: free roles: + - minimal-nodepool - configure-openstacksdk - hosts: "puppet:!disabled" diff --git a/playbooks/roles/minimal-nodepool/README.rst b/playbooks/roles/minimal-nodepool/README.rst new file mode 100644 index 0000000000..d0151e1636 --- /dev/null +++ b/playbooks/roles/minimal-nodepool/README.rst @@ -0,0 +1,9 @@ +Create minimal nodepool requirements so that we can manage nodepool servers +with ansible and puppet while we transition. + +NOTE: THis likely isn't what we want long term. Should have a proper nodepool +role or use windmill. + +**Role Variables** + +* None diff --git a/playbooks/roles/minimal-nodepool/tasks/main.yaml b/playbooks/roles/minimal-nodepool/tasks/main.yaml new file mode 100644 index 0000000000..f93a06c762 --- /dev/null +++ b/playbooks/roles/minimal-nodepool/tasks/main.yaml @@ -0,0 +1,12 @@ +- name: Add the nodepool group + group: + name: nodepool + state: present + +- name: Add the nodepool user + user: + name: nodepool + group: nodepool + home: /home/nodepool + create_home: yes + shell: /bin/bash diff --git a/playbooks/templates/clouds/nodepool_clouds.yaml.j2 b/playbooks/templates/clouds/nodepool_clouds.yaml.j2 index eda8d9c0ee..0f833cb957 100644 --- a/playbooks/templates/clouds/nodepool_clouds.yaml.j2 +++ b/playbooks/templates/clouds/nodepool_clouds.yaml.j2 @@ -107,7 +107,7 @@ clouds: auth_url: https://osa.continuous.pw:5000 username: '{{ nodepool_limestone_username }}' password: '{{ nodepool_limestone_password }}' - project_name: '{{ limestone_project }}' + project_name: '{{ nodepool_limestone_project }}' user_domain_name: default project_domain_name: default api_timeout: 60 diff --git a/testinfra/test_nodepool.py b/testinfra/test_nodepool.py new file mode 100644 index 0000000000..32dc0938bd --- /dev/null +++ b/testinfra/test_nodepool.py @@ -0,0 +1,23 @@ +# Copyright 2018 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +testinfra_hosts = ['nl01.openstack.org', 'nb01.openstack.org'] + + +def test_clouds_yaml(host): + clouds_yaml = host.file('/home/nodepool/.config/openstack/clouds.yaml') + assert clouds_yaml.exists + + assert b'password' in clouds_yaml.content