ansible/test/integration/targets/cloud_init_data_facts/tasks/main.yml
René Moser e7709e169a
new module cloud_init_data_facts (#37932)
* add new module cloud_init_facts

* rename cloud-init facts

* simplify

* re-add tests

* make test run on ubuntu except 14.04
2018-05-25 07:44:24 +02:00

44 lines
1.7 KiB
YAML

---
- name: test cloud-init
# TODO: check for a workaround
# install 'cloud-init'' failed: dpkg-divert: error: `diversion of /etc/init/ureadahead.conf
# to /etc/init/ureadahead.conf.disabled by cloud-init' clashes with `local diversion of
# /etc/init/ureadahead.conf to /etc/init/ureadahead.conf.distrib
# https://bugs.launchpad.net/ubuntu/+source/ureadahead/+bug/997838
when: ansible_distribution != "Ubuntu" or ansible_distribution_major_version|int != 14
block:
- name: setup install cloud-init
package:
name: cloud-init
- name: setup run cloud-init
service:
name: cloud-init-local
state: restarted
- name: test gather cloud-init facts in check mode
cloud_init_data_facts:
check_mode: yes
register: result
- name: verify test gather cloud-init facts in check mode
assert:
that:
- result.cloud_init_data_facts.status.v1 is defined
- result.cloud_init_data_facts.status.v1.stage is defined
- not result.cloud_init_data_facts.status.v1.stage
- cloud_init_data_facts.status.v1 is defined
- cloud_init_data_facts.status.v1.stage is defined
- not cloud_init_data_facts.status.v1.stage
- name: test gather cloud-init facts
cloud_init_data_facts:
register: result
- name: verify test gather cloud-init facts
assert:
that:
- result.cloud_init_data_facts.status.v1 is defined
- result.cloud_init_data_facts.status.v1.stage is defined
- not result.cloud_init_data_facts.status.v1.stage
- cloud_init_data_facts.status.v1 is defined
- cloud_init_data_facts.status.v1.stage is defined
- not cloud_init_data_facts.status.v1.stage