kayobe/ansible/test-image-centos-cloud.yml
2017-03-15 14:21:12 +00:00

33 lines
1.1 KiB
YAML

---
- name: Ensure CentOS cloud image is registered with Glance
hosts: controllers[0]
vars:
shade_venv: "{{ ansible_env['PWD'] }}/shade-venv"
roles:
- role: shade
tasks:
- name: Ensure image download directory exists
file:
path: "{{ image_cache_path }}"
state: directory
- name: Ensure CentOS 7 cloud image is downloaded
get_url:
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 }}"
name: centos7
container_format: bare
disk_format: qcow2
state: present
filename: "{{ image_cache_path }}/CentOS-7-x86_64-GenericCloud.qcow2"