Create ansible virtualenv on bastion

Change-Id: I7b925ae283d25d42b2079d9ee5789b9fef97aab6
Depends-On: https://review.openstack.org/638208
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-02-20 12:08:15 -05:00
parent 6efea7a8c1
commit 609e460994
6 changed files with 50 additions and 12 deletions

View File

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

View File

@ -1,2 +1 @@
ansible>=2.4.0
netaddr

View File

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

View File

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

View File

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

View File

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