-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cloud/cs | ||
cs/group1 | ||
cs/group4 |
3 changes: 3 additions & 0 deletions
3
tests/integration/targets/instance_password_reset/meta/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- cs_common |
105 changes: 105 additions & 0 deletions
105
tests/integration/targets/instance_password_reset/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
--- | ||
- name: reset without giving a VM or Zone | ||
ngine_io.cloudstack.instance_password_reset: | ||
ignore_errors: true | ||
register: reset1 | ||
- name: verify that the argument was missing | ||
assert: | ||
that: | ||
- reset1 is failed | ||
- "reset1.msg == 'missing required arguments: vm, zone'" | ||
|
||
- name: reset without giving a VM | ||
ngine_io.cloudstack.instance_password_reset: | ||
zone: "{{ cs_common_zone_basic }}" | ||
ignore_errors: true | ||
register: reset1 | ||
- name: verify that the argument was missing | ||
assert: | ||
that: | ||
- reset1 is failed | ||
- "reset1.msg == 'missing required arguments: vm'" | ||
|
||
- name: disable password_enabled on default template | ||
ngine_io.cloudstack.template: | ||
name: "{{ cs_common_template }}" | ||
template_filter: all | ||
password_enabled: false | ||
zone: "{{ cs_common_zone_basic }}" | ||
|
||
- name: cleanup test VM | ||
ngine_io.cloudstack.instance: | ||
name: test-nopassword | ||
zone: "{{ cs_common_zone_basic }}" | ||
state: expunged | ||
|
||
- name: create test VM | ||
ngine_io.cloudstack.instance: | ||
name: test-nopassword | ||
template: "{{ cs_common_template }}" | ||
service_offering: "{{ cs_common_service_offering }}" | ||
zone: "{{ cs_common_zone_basic }}" | ||
state: started | ||
register: testvm_nopass | ||
until: testvm_nopass is success | ||
retries: 12 | ||
delay: 10 | ||
|
||
- name: stop test VM | ||
ngine_io.cloudstack.instance: | ||
name: test-nopassword | ||
zone: "{{ cs_common_zone_basic }}" | ||
state: stopped | ||
|
||
- name: reset nopassword | ||
ngine_io.cloudstack.instance_password_reset: | ||
vm: test-nopassword | ||
zone: "{{ cs_common_zone_basic }}" | ||
ignore_errors: true | ||
register: reset2 | ||
- name: verify that template was not pw enabled | ||
assert: | ||
that: | ||
- reset2 is failed | ||
- reset2.msg.endswith("the template is not password enabled'") | ||
|
||
- name: enable password_enabled on default template | ||
ngine_io.cloudstack.template: | ||
name: "{{ cs_common_template }}" | ||
template_filter: all | ||
password_enabled: true | ||
zone: "{{ cs_common_zone_basic }}" | ||
|
||
- name: cleanup test VM | ||
ngine_io.cloudstack.instance: | ||
name: test-password | ||
zone: "{{ cs_common_zone_basic }}" | ||
state: expunged | ||
|
||
- name: create test VM | ||
ngine_io.cloudstack.instance: | ||
name: test-password | ||
template: "{{ cs_common_template }}" | ||
service_offering: "{{ cs_common_service_offering }}" | ||
zone: "{{ cs_common_zone_basic }}" | ||
state: started | ||
|
||
- name: stop test VM | ||
ngine_io.cloudstack.instance: | ||
name: test-password | ||
zone: "{{ cs_common_zone_basic }}" | ||
state: stopped | ||
|
||
- name: reset password | ||
ngine_io.cloudstack.instance_password_reset: | ||
vm: test-password | ||
zone: "{{ cs_common_zone_basic }}" | ||
register: reset3 | ||
- name: verify that a password was set | ||
assert: | ||
that: | ||
- reset3 is success | ||
- reset3.password != '' | ||
|
||
- debug: | ||
var: reset3.password |