diff --git a/inventory/testing/group_vars/bastion.yaml b/inventory/testing/group_vars/bastion.yaml new file mode 100644 index 0000000..4640457 --- /dev/null +++ b/inventory/testing/group_vars/bastion.yaml @@ -0,0 +1,20 @@ +# Copyright 2019 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. +--- +ansible_pip_name: + - ansible + - ara + - netaddr +ansible_pip_virtualenv_python: python3 +ansible_pip_virtualenv: /opt/venv/ansible diff --git a/requirements.txt b/requirements.txt index bd9afca..f3a3f52 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ ansible>=2.4.0 -netaddr diff --git a/tests/playbooks/pre.yaml b/tests/playbooks/pre.yaml index af896c3..e4cd588 100644 --- a/tests/playbooks/pre.yaml +++ b/tests/playbooks/pre.yaml @@ -16,16 +16,27 @@ state: absent when: ansible_os_family == 'RedHat' - - name: Symlink ansible configuration file - file: + - name: Install ansible configuration file + template: dest: ~/.ansible.cfg - src: "{{ ansible_user_dir}}/{{ windmill_src_dir }}/inventory/testing/ansible.cfg" - state: link + src: "{{ zuul.executor.work_root }}/{{ windmill_src_dir }}/inventory/testing/ansible.cfg" - - name: Bootstrap bindep environment - args: - chdir: "{{ windmill_src_dir }}" - command: tox -ebindep + - name: Set ARA fact for Debian + set_fact: + ara_path: /opt/venv/ansible/lib/python3.6/site-packages/ara/plugins/callbacks + when: ansible_os_family == 'Debian' + + - name: Set ARA fact for RedHat + set_fact: + ara_path: /opt/venv/ansible/lib/python3.7/site-packages/ara/plugins/callbacks + when: ansible_os_family == 'RedHat' + + - name: Enable ARA callback plugin + ini_file: + path: ~/.ansible.cfg + section: defaults + option: callback_plugins + value: "{{ ara_path }}" - name: Bootstrap tox environment args: diff --git a/tests/playbooks/run-post.yaml b/tests/playbooks/run-post.yaml index 922d649..d224266 100644 --- a/tests/playbooks/run-post.yaml +++ b/tests/playbooks/run-post.yaml @@ -4,4 +4,4 @@ - name: Run ansible-playbook for prove.yaml args: chdir: "{{ windmill_src_dir }}" - shell: "tox -evenv -- ansible-playbook -i {{ ansible_user_dir }}/{{ windmill_src_dir }}/inventory/testing/hosts playbooks/prove.yaml" + shell: "/opt/venv/ansible/bin/ansible-playbook -i {{ ansible_user_dir }}/{{ windmill_src_dir }}/inventory/testing/hosts playbooks/prove.yaml" diff --git a/tests/playbooks/run-pre.yaml b/tests/playbooks/run-pre.yaml index af73cd0..ed7a76f 100644 --- a/tests/playbooks/run-pre.yaml +++ b/tests/playbooks/run-pre.yaml @@ -5,3 +5,11 @@ args: chdir: "{{ windmill_src_dir }}" shell: "tox -evenv -- ansible-playbook -i {{ ansible_user_dir }}/{{ windmill_src_dir }}/inventory/testing/hosts tests/playbooks/bastion/site.yaml" + + # TODO(pabelanger): Because we use ansible, to install ansible, we first + # need to run windmill-ops, like we do with the current launch-node.py + # script. However, limit it to only the bastion host. + - name: Bootstrap bastion node using windmill-ops + args: + chdir: "{{ zuul.projects['git.openstack.org/openstack/windmill-ops'].src_dir }}" + shell: "tox -evenv -- ansible-playbook -v -f1 -i {{ ansible_user_dir }}/{{ windmill_src_dir }}/inventory/testing/hosts playbooks/bootstrap/site.yaml --limit bastion" diff --git a/tests/playbooks/run.yaml b/tests/playbooks/run.yaml index d94f0c1..0602276 100644 --- a/tests/playbooks/run.yaml +++ b/tests/playbooks/run.yaml @@ -4,9 +4,9 @@ - name: Bootstrap all nodes using windmill-ops args: chdir: "{{ zuul.projects['git.openstack.org/openstack/windmill-ops'].src_dir }}" - shell: "tox -evenv -- ansible-playbook -v -f1 -i {{ ansible_user_dir }}/{{ windmill_src_dir }}/inventory/testing/hosts playbooks/bootstrap/site.yaml" + shell: "/opt/venv/ansible/bin/ansible-playbook -v -f1 -i {{ ansible_user_dir }}/{{ windmill_src_dir }}/inventory/testing/hosts playbooks/bootstrap/site.yaml" - name: Run ansible-playbook for site.yaml args: chdir: "{{ windmill_src_dir }}" - shell: "tox -evenv -- ansible-playbook -v -f1 -i {{ ansible_user_dir }}/{{ windmill_src_dir }}/inventory/testing/hosts playbooks/site.yaml -e @{{ windmill_extra_vars_file }}" + shell: "/opt/venv/ansible/bin/ansible-playbook -v -f1 -i {{ ansible_user_dir }}/{{ windmill_src_dir }}/inventory/testing/hosts playbooks/site.yaml -e @{{ windmill_extra_vars_file }}"