kayobe/ansible/test-infra.yml

63 lines
2.4 KiB
YAML

---
- name: Ensure test infrastructure is registered
hosts: controllers[0]
vars:
shade_venv: "{{ ansible_env['PWD'] }}/shade-venv"
test_image_cache_path: "{{ ansible_env['PWD'] }}/images"
roles:
- role: shade
tasks:
- name: Ensure image download directory exists
file:
path: "{{ test_image_cache_path }}"
state: directory
- name: Ensure unzip package is installed
yum:
name: unzip
state: installed
- name: Ensure Ironic CoreOS IPA deploy images are downloaded
unarchive:
src: http://tarballs.openstack.org/ironic-python-agent/coreos/ipa-coreos-stable-newton.tar.gz
dest: "{{ test_image_cache_path }}"
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
os_image:
auth: "{{ openstack_auth }}"
name: "{{ item.name }}"
container_format: "{{ item.format }}"
disk_format: "{{ item.format }}"
state: present
filename: "{{ test_image_cache_path }}/imagebuild/coreos/UPLOAD/{{ item.filename }}"
with_items:
- { 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: Ensure provisioning network is registered with Neutron
os_network:
auth: "{{ openstack_auth }}"
name: provision-net
provider_network_type: flat
provider_physical_network: physnet1
shared: True
state: present
- name: Ensure provisioning subnet is registered with Neutron
os_subnet:
auth: "{{ openstack_auth }}"
name: provision-subnet
network_name: provision-net
cidr: "{{ provision_wl_net_name | net_cidr }}"
gateway_ip: "{{ provision_wl_net_name | net_gateway | 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