2017-07-04 15:08:33 +02:00
|
|
|
---
|
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is failed
|
2017-07-04 15:08:33 +02:00
|
|
|
- '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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is successful
|
|
|
|
- instance is changed
|
2017-07-04 15:08:33 +02:00
|
|
|
|
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is successful
|
|
|
|
- instance is changed
|
2017-07-04 15:08:33 +02:00
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is successful
|
|
|
|
- instance is not changed
|
2017-07-04 15:08:33 +02:00
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- sshkey is successful
|
2017-07-04 15:08:33 +02:00
|
|
|
|
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is changed
|
2017-07-04 15:08:33 +02:00
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is changed
|
2017-07-04 15:08:33 +02:00
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is not changed
|
2017-07-04 15:08:33 +02:00
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- sshkey2 is successful
|
2017-07-04 15:08:33 +02:00
|
|
|
|
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is failed
|
2017-07-04 15:08:33 +02:00
|
|
|
- '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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is changed
|
2017-07-04 15:08:33 +02:00
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is changed
|
2017-07-04 15:08:33 +02:00
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is not changed
|
2017-07-04 15:08:33 +02:00
|
|
|
- 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:
|
2017-11-27 23:58:08 +01:00
|
|
|
- instance is successful
|