1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/cs_instance/tasks/sshkeys.yml
Matt Martz 4fe08441be Deprecate tests used as filters (#32361)
* Warn on tests used as filters

* Update docs, add aliases for tests that fit more gramatically with test syntax

* Fix rst formatting

* Add successful filter, alias of success

* Remove renamed_deprecation, it was overkill

* Make directory alias for is_dir

* Update tests to use proper jinja test syntax

* Update additional documentation, living outside of YAML files, to reflect proper jinja test syntax

* Add conversion script, porting guide updates, and changelog updates

* Update newly added uses of tests as filters

* No underscore variable

* Convert recent tests as filter changes to win_stat

* Fix some changes related to rebasing a few integration tests

* Make tests_as_filters_warning explicitly accept the name of the test, instead of inferring the name

* Add test for tests_as_filters_warning

* Update tests as filters in newly added/modified tests

* Address recent changes to several integration tests

* Address recent changes in cs_vpc
2017-11-27 17:58:08 -05:00

168 lines
4.7 KiB
YAML

---
- name: test update instance ssh key non existent
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
ssh_key: "{{ cs_resource_prefix }}-sshkey2"
template: "{{ test_cs_instance_template }}"
force: true
register: instance
ignore_errors: true
- name: verify update instance ssh key non existent
assert:
that:
- instance is failed
- 'instance.msg == "SSH key not found: {{ cs_resource_prefix }}-sshkey2"'
- name: test create instance without keypair in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
check_mode: true
register: instance
- name: verify create instance without keypair in check mode
assert:
that:
- instance is successful
- instance is changed
- name: test create instance without keypair
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
register: instance
- name: verify create instance without keypair
assert:
that:
- instance is successful
- instance is changed
- instance.ssh_key is not defined
- name: test create instance without keypair idempotence
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
register: instance
- name: verify create instance without keypair idempotence
assert:
that:
- instance is successful
- instance is not changed
- instance.ssh_key is not defined
- name: setup ssh key2
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey2
register: sshkey
- name: verify setup ssh key2
assert:
that:
- sshkey is successful
- name: test update instance ssh key2 in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
ssh_key: "{{ cs_resource_prefix }}-sshkey2"
force: true
check_mode: true
register: instance
- name: verify update instance ssh key2 in check mode
assert:
that:
- instance is changed
- instance.ssh_key is not defined
- name: test update instance ssh key2
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
ssh_key: "{{ cs_resource_prefix }}-sshkey2"
force: true
register: instance
- name: verify update instance ssh key2
assert:
that:
- instance is changed
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey2"
- name: test update instance ssh key2 idempotence
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
ssh_key: "{{ cs_resource_prefix }}-sshkey2"
force: true
register: instance
- name: verify update instance ssh key2 idempotence
assert:
that:
- instance is not changed
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey2"
- name: cleanup ssh key2
cs_sshkeypair:
name: "{{ cs_resource_prefix }}-sshkey2"
state: absent
register: sshkey2
- name: verify cleanup ssh key2
assert:
that:
- sshkey2 is successful
- name: test update instance ssh key2 idempotence2
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
ssh_key: "{{ cs_resource_prefix }}-sshkey2"
force: true
register: instance
ignore_errors: true
- name: verify update instance ssh key2 idempotence2
assert:
that:
- instance is failed
- 'instance.msg == "SSH key not found: {{ cs_resource_prefix }}-sshkey2"'
- name: test update instance ssh key in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
ssh_key: "{{ cs_resource_prefix }}-sshkey"
force: true
check_mode: true
register: instance
- name: verify update instance ssh key in check mode
assert:
that:
- instance is changed
- instance.ssh_key is not defined
- name: test update instance ssh key
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
ssh_key: "{{ cs_resource_prefix }}-sshkey"
force: true
register: instance
- name: verify update instance ssh key
assert:
that:
- instance is changed
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey"
- name: test update instance ssh key idempotence
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
ssh_key: "{{ cs_resource_prefix }}-sshkey"
force: true
register: instance
- name: verify update instance ssh key idempotence
assert:
that:
- instance is not changed
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey"
- name: cleanup expunge instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-sshkey"
state: expunged
register: instance
- name: verify cleanup expunge instance
assert:
that:
- instance is successful