kayobe/ansible/test-image-centos-cloud.yml

34 lines
1.2 KiB
YAML

---
- name: Ensure CentOS cloud image is registered with Glance
hosts: controllers[0]
vars:
os_shade_venv: "{{ virtualenv_path }}/shade"
roles:
- role: stackhpc.os-shade
os_shade_install_epel: "{{ yum_install_epel }}"
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: "{{ os_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"