Use shade role in test playbooks

This commit is contained in:
Mark Goddard 2017-03-15 13:52:25 +00:00
parent 0ea9003c6a
commit fb4973f833
4 changed files with 21 additions and 70 deletions

View File

@ -1,19 +1,11 @@
---
- hosts: seed[0]
- name: Ensure CentOS cloud image is registered with Glance
hosts: controllers[0]
vars:
openstack_auth:
auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}"
username: "{{ lookup('env', 'OS_USERNAME') }}"
password: "{{ lookup('env', 'OS_PASSWORD') }}"
project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}"
project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}"
user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}"
shade_venv: "{{ ansible_env['PWD'] }}/shade-venv"
roles:
- role: shade
tasks:
- name: Ensure OpenStack shade module is installed
pip:
name: shade
become: True
- name: Ensure image download directory exists
file:
path: "{{ image_cache_path }}"
@ -24,6 +16,12 @@
url: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
dest: "{{ image_cache_path }}/CentOS-7-x86_64-GenericCloud.qcow2"
# Note that setting this via a play or task variable seems to not
# evaluate the Jinja variable reference, so we use set_fact.
- name: Update the Ansible python interpreter fact to point to the shade virtualenv
set_fact:
ansible_python_interpreter: "{{ shade_venv }}/bin/python"
- name: Ensure test deployment image is registered with Glance
os_image:
auth: "{{ openstack_auth }}"

View File

@ -1,14 +1,7 @@
---
- name: Ensure user images are built and registered with Glance
hosts: seed
hosts: controllers[0]
vars:
openstack_auth:
auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}"
username: "{{ lookup('env', 'OS_USERNAME') }}"
password: "{{ lookup('env', 'OS_PASSWORD') }}"
project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}"
project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}"
user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}"
image_build_dir: "{{ ansible_user_dir }}/images/dib"
image_name: centos7
image_os_element: centos7
@ -24,6 +17,8 @@
image_extra_elements: []
image_elements: "{{ image_base_elements + (image_whole_disk_elements if image_is_whole_disk|bool else image_partition_elements) + image_extra_elements }}"
shade_venv: "{{ ansible_env['PWD'] }}/shade-venv"
roles:
- role: shade
tasks:
- name: Ensure diskimage-builder package is installed
yum:
@ -31,17 +26,6 @@
state: installed
become: True
- name: Ensure pip is installed
pip:
name: pip
state: latest
virtualenv: "{{ shade_venv }}"
- name: Ensure OpenStack shade module is installed
pip:
name: shade
virtualenv: "{{ shade_venv }}"
- name: Ensure image build directory exists
file:
path: "{{ image_build_dir }}"

View File

@ -1,27 +1,12 @@
---
- hosts: seed
- name: Ensure test infrastructure is registered
hosts: controllers[0]
vars:
openstack_auth:
auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}"
username: "{{ lookup('env', 'OS_USERNAME') }}"
password: "{{ lookup('env', 'OS_PASSWORD') }}"
project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}"
project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}"
user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}"
shade_venv: "{{ ansible_env['PWD'] }}/shade-venv"
test_image_cache_path: "{{ ansible_env['PWD'] }}/images"
roles:
- role: shade
tasks:
- name: Ensure pip is installed
pip:
name: pip
state: latest
virtualenv: "{{ shade_venv }}"
- name: Ensure OpenStack shade module is installed
pip:
name: shade
virtualenv: "{{ shade_venv }}"
- name: Ensure image download directory exists
file:
path: "{{ test_image_cache_path }}"

View File

@ -1,28 +1,12 @@
---
- name: Ensure user SSH keypair is registered with Nova
hosts: seed
hosts: controllers[0]
vars:
openstack_auth:
auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}"
username: "{{ lookup('env', 'OS_USERNAME') }}"
password: "{{ lookup('env', 'OS_PASSWORD') }}"
project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}"
project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}"
user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}"
public_key_path: "{{ ssh_public_key_path }}"
shade_venv: "{{ ansible_env['PWD'] }}/shade-venv"
roles:
- role: shade
tasks:
- name: Ensure pip is installed
pip:
name: pip
state: latest
virtualenv: "{{ shade_venv }}"
- name: Ensure OpenStack shade module is installed
pip:
name: shade
virtualenv: "{{ shade_venv }}"
# Note that setting this via a play or task variable seems to not
# evaluate the Jinja variable reference, so we use set_fact.
- name: Update the Ansible python interpreter fact to point to the shade virtualenv