kayobe/ansible/test-infra.yml
2017-02-16 10:44:36 +00:00

78 lines
2.9 KiB
YAML

---
- hosts: seed
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"
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 }}"
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