Add test for os_image Ansible module

Change-Id: I80c983e41a08df43f39376868290cf78e0085771
This commit is contained in:
David Shrewsbury 2015-11-23 09:33:39 -05:00
parent 05bd92c8a1
commit 4c7583b33a
3 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,54 @@
---
- name: Create a test image file
shell: mktemp
register: tmp_file
- name: Fill test image file to 1MB
shell: truncate -s 1048576 {{ tmp_file.stdout }}
- name: Create raw image (defaults)
os_image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
filename: "{{ tmp_file.stdout }}"
disk_format: raw
register: image
- debug: var=image
- name: Delete raw image (defaults)
os_image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
- name: Create raw image (complex)
os_image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
filename: "{{ tmp_file.stdout }}"
disk_format: raw
is_public: True
min_disk: 10
min_ram: 1024
kernel: cirros-vmlinuz
ramdisk: cirros-initrd
properties:
cpu_arch: x86_64
distro: ubuntu
register: image
- debug: var=image
- name: Delete raw image (complex)
os_image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
- name: Delete test image file
file:
name: "{{ tmp_file.stdout }}"
state: absent

View File

@ -0,0 +1 @@
image_name: ansible_image

View File

@ -6,6 +6,7 @@
roles:
- { role: auth, tags: auth }
- { role: client_config, tags: client_config }
- { role: image, tags: image }
- { role: keypair, tags: keypair }
- { role: network, tags: network }
- { role: nova_flavor, tags: nova_flavor }