ansible/test/integration/targets/cs_instance_info/tasks/main.yml
Felix Fontein 0c592c8225
CloudStack modules: rename _facts -> _info (#61090)
* Rename cloudstack _facts -> _info

* Add changelog.

* Fix errors due to overloaded get_result having different parameter names.

* Fix examples.

* Change debug tasks.

* Remove unneeded code.

* Change from rename -> deprecate+new module.

* Make cs_zone_info return a list.

* Make cs_instance_info return a list.

* Fix return value docs.

* Fix typo.

* Improve tests.

* Fix cs_zone_info.

* Linting.

* Fix alias/option switch.

* Fix version numbers.

* Extend docs.
2019-08-29 16:14:51 +02:00

91 lines
2.8 KiB
YAML

---
- name: setup ssh key
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
register: sshkey
- name: verify setup ssh key
assert:
that:
- sshkey is successful
- name: setup affinity group
cs_affinitygroup: name={{ cs_resource_prefix }}-ag
register: ag
- name: verify setup affinity group
assert:
that:
- ag is successful
- name: setup security group
cs_securitygroup: name={{ cs_resource_prefix }}-sg
register: sg
- name: verify setup security group
assert:
that:
- sg is successful
- name: setup instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
affinity_group: "{{ cs_resource_prefix }}-ag"
security_group: "{{ cs_resource_prefix }}-sg"
ssh_key: "{{ cs_resource_prefix }}-sshkey"
tags: []
register: instance
- name: verify create instance
assert:
that:
- instance is successful
- name: test instance info in check mode
cs_instance_info:
name: "{{ cs_resource_prefix }}-vm"
register: instance_info
check_mode: true
- name: verify test instance info in check mode
assert:
that:
- instance_info is successful
- instance_info is not changed
- instance_info.instances[0].id == instance.id
- instance_info.instances[0].domain == instance.domain
- instance_info.instances[0].account == instance.account
- instance_info.instances[0].zone == instance.zone
- instance_info.instances[0].name == instance.name
- instance_info.instances[0].service_offering == instance.service_offering
- instance_info.instances[0].host != ""
- name: test instance info
cs_instance_info:
name: "{{ cs_resource_prefix }}-vm"
register: instance_info
- name: verify test instance info
assert:
that:
- instance_info is successful
- instance_info is not changed
- instance_info.instances[0].id == instance.id
- instance_info.instances[0].domain == instance.domain
- instance_info.instances[0].account == instance.account
- instance_info.instances[0].zone == instance.zone
- instance_info.instances[0].name == instance.name
- instance_info.instances[0].service_offering == instance.service_offering
- instance_info.instances[0].host != ""
- name: test instance info for all instances
cs_instance_info:
register: instance_info
- name: verify test instance info
assert:
that:
- instance_info is successful
- instance_info is not changed
- instance_info.instances | length > 0
- '"id" in instance_info.instances[0]'
- '"domain" in instance_info.instances[0]'
- '"account" in instance_info.instances[0]'
- '"zone" in instance_info.instances[0]'
- '"name" in instance_info.instances[0]'
- '"service_offering" in instance_info.instances[0]'
- '"host" in instance_info.instances[0]'