Update test playbooks

This commit is contained in:
Mark Goddard 2017-02-16 10:44:36 +00:00
parent 2ef0a4bd58
commit 5404539bee
4 changed files with 64 additions and 19 deletions

View File

@ -8,7 +8,6 @@
project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}" project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}"
project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}" project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}"
user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}" user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}"
image_download_dir: "{{ ansible_user_dir }}/images"
tasks: tasks:
- name: Ensure OpenStack shade module is installed - name: Ensure OpenStack shade module is installed
pip: pip:
@ -17,13 +16,13 @@
- name: Ensure image download directory exists - name: Ensure image download directory exists
file: file:
path: "{{ image_download_dir }}" path: "{{ image_cache_path }}"
state: directory state: directory
- name: Ensure CentOS 7 cloud image is downloaded - name: Ensure CentOS 7 cloud image is downloaded
get_url: get_url:
url: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 url: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
dest: "{{ image_download_dir }}/CentOS-7-x86_64-GenericCloud.qcow2" dest: "{{ image_cache_path }}/CentOS-7-x86_64-GenericCloud.qcow2"
- name: Ensure test deployment image is registered with Glance - name: Ensure test deployment image is registered with Glance
os_image: os_image:
@ -32,4 +31,4 @@
container_format: bare container_format: bare
disk_format: qcow2 disk_format: qcow2
state: present state: present
filename: "{{ image_download_dir }}/CentOS-7-x86_64-GenericCloud.qcow2" filename: "{{ image_cache_path }}/CentOS-7-x86_64-GenericCloud.qcow2"

View File

@ -1,6 +1,6 @@
--- ---
- name: Ensure user images are built and registered with Glance - name: Ensure user images are built and registered with Glance
hosts: seed[0] hosts: seed
vars: vars:
openstack_auth: openstack_auth:
auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}" auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}"
@ -14,6 +14,7 @@
image_os_element: centos7 image_os_element: centos7
image_base_elements: image_base_elements:
- dhcp-all-interfaces - dhcp-all-interfaces
- enable-serial-console
image_is_whole_disk: True image_is_whole_disk: True
image_whole_disk_elements: image_whole_disk_elements:
- vm - vm
@ -22,6 +23,7 @@
- grub2 - grub2
image_extra_elements: [] 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 }}" 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"
tasks: tasks:
- name: Ensure diskimage-builder package is installed - name: Ensure diskimage-builder package is installed
yum: yum:
@ -29,10 +31,16 @@
state: installed state: installed
become: True become: True
- name: Ensure pip is installed
pip:
name: pip
state: latest
virtualenv: "{{ shade_venv }}"
- name: Ensure OpenStack shade module is installed - name: Ensure OpenStack shade module is installed
pip: pip:
name: shade name: shade
become: True virtualenv: "{{ shade_venv }}"
- name: Ensure image build directory exists - name: Ensure image build directory exists
file: file:
@ -53,6 +61,12 @@
chdir: "{{ image_build_dir }}" chdir: "{{ image_build_dir }}"
creates: "{{ image_build_dir }}/{{ image_name }}.qcow2" creates: "{{ image_build_dir }}/{{ image_name }}.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 ramdisk and kernel images are registered with Glance - name: Ensure test deployment ramdisk and kernel images are registered with Glance
os_image: os_image:
auth: "{{ openstack_auth }}" auth: "{{ openstack_auth }}"

View File

@ -1,5 +1,5 @@
--- ---
- hosts: seed[0] - hosts: seed
vars: vars:
openstack_auth: openstack_auth:
auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}" auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}"
@ -8,24 +8,42 @@
project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}" project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}"
project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}" project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}"
user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}" user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}"
image_download_dir: "{{ ansible_user_dir }}/images" shade_venv: "{{ ansible_env['PWD'] }}/shade-venv"
test_image_cache_path: "{{ ansible_env['PWD'] }}/images"
tasks: tasks:
- name: Ensure pip is installed
pip:
name: pip
state: latest
virtualenv: "{{ shade_venv }}"
- name: Ensure OpenStack shade module is installed - name: Ensure OpenStack shade module is installed
pip: pip:
name: shade name: shade
become: True virtualenv: "{{ shade_venv }}"
- name: Ensure image download directory exists - name: Ensure image download directory exists
file: file:
path: "{{ image_download_dir }}" path: "{{ test_image_cache_path }}"
state: directory state: directory
- name: Ensure unzip package is installed
yum:
name: unzip
state: installed
- name: Ensure Ironic CoreOS IPA deploy images are downloaded - name: Ensure Ironic CoreOS IPA deploy images are downloaded
unarchive: unarchive:
src: http://tarballs.openstack.org/ironic-python-agent/coreos/ipa-coreos-stable-newton.tar.gz src: http://tarballs.openstack.org/ironic-python-agent/coreos/ipa-coreos-stable-newton.tar.gz
dest: "{{ image_download_dir }}" dest: "{{ test_image_cache_path }}"
remote_src: yes remote_src: yes
# 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 Ironic CoreOS IPA deploy images are registered with Glance - name: Ensure Ironic CoreOS IPA deploy images are registered with Glance
os_image: os_image:
auth: "{{ openstack_auth }}" auth: "{{ openstack_auth }}"
@ -33,7 +51,7 @@
container_format: "{{ item.format }}" container_format: "{{ item.format }}"
disk_format: "{{ item.format }}" disk_format: "{{ item.format }}"
state: present state: present
filename: "{{ image_download_dir }}/imagebuild/coreos/UPLOAD/{{ item.filename }}" filename: "{{ test_image_cache_path }}/imagebuild/coreos/UPLOAD/{{ item.filename }}"
with_items: with_items:
- { name: ipa.initrd, filename: coreos_production_pxe_image-oem-stable-newton.cpio.gz, format: ari } - { name: ipa.initrd, filename: coreos_production_pxe_image-oem-stable-newton.cpio.gz, format: ari }
- { name: ipa.vmlinuz, filename: coreos_production_pxe-stable-newton.vmlinuz, format: aki } - { name: ipa.vmlinuz, filename: coreos_production_pxe-stable-newton.vmlinuz, format: aki }
@ -52,7 +70,8 @@
auth: "{{ openstack_auth }}" auth: "{{ openstack_auth }}"
name: provision-subnet name: provision-subnet
network_name: provision-net network_name: provision-net
cidr: "{{ provision_net_cidr }}" cidr: "{{ provision_wl_net_name | net_cidr }}"
allocation_pool_start: "{{ provision_net_allocation_pool_start | default(omit) }}" gateway_ip: "{{ provision_wl_net_name | net_gateway | default(omit) }}"
allocation_pool_end: "{{ provision_net_allocation_pool_end | default(omit) }}" allocation_pool_start: "{{ provision_wl_net_name | net_allocation_pool_start | default(omit) }}"
allocation_pool_end: "{{ provision_wl_net_name | net_allocation_pool_end | default(omit) }}"
state: present state: present

View File

@ -1,6 +1,6 @@
--- ---
- name: Ensure user SSH keypair is registered with Nova - name: Ensure user SSH keypair is registered with Nova
hosts: seed[0] hosts: seed
vars: vars:
openstack_auth: openstack_auth:
auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}" auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}"
@ -9,16 +9,29 @@
project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}" project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}"
project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}" project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}"
user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}" user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}"
public_key_file: "{{ ansible_user_dir }}/.ssh/id_rsa.pub" public_key_path: "{{ ssh_public_key_path }}"
shade_venv: "{{ ansible_env['PWD'] }}/shade-venv"
tasks: tasks:
- name: Ensure pip is installed
pip:
name: pip
state: latest
virtualenv: "{{ shade_venv }}"
- name: Ensure OpenStack shade module is installed - name: Ensure OpenStack shade module is installed
pip: pip:
name: shade name: shade
become: True 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
set_fact:
ansible_python_interpreter: "{{ shade_venv }}/bin/python"
- name: Ensure a test SSH key pair is registered with Nova - name: Ensure a test SSH key pair is registered with Nova
os_keypair: os_keypair:
auth: "{{ openstack_auth }}" auth: "{{ openstack_auth }}"
name: test name: test
public_key_file: "{{ public_key_file }}" public_key: "{{ lookup('file', public_key_path) }}"
state: present state: present