diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
commit | a453ac31f3428614cceb99027f8efbdb9258a40b (patch) | |
tree | f61f87408f32a8511cbd91799f9cececb53e0374 /collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests | |
parent | Initial commit. (diff) | |
download | ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.tar.xz ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.zip |
Adding upstream version 2.10.7+merged+base+2.10.8+dfsg.upstream/2.10.7+merged+base+2.10.8+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests')
195 files changed, 16113 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_account/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_account/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_account/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_account/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_account/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_account/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_account/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_account/tasks/main.yml new file mode 100644 index 00000000..5bbe54be --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_account/tasks/main.yml @@ -0,0 +1,416 @@ +--- +- name: setup + cs_account: + name: "{{ cs_resource_prefix }}_username" + state: absent + register: acc + +- name: test fail if missing name + action: cs_account + register: acc + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - acc is failed + - 'acc.msg == "missing required arguments: name"' + +- name: test fail if missing params if state=present + cs_account: + name: "{{ cs_resource_prefix }}_user" + register: acc + ignore_errors: true +- name: verify results of fail if missing params if state=present + assert: + that: + - acc is failed + - 'acc.msg == "missing required arguments: email, username, password, first_name, last_name"' + +- name: test create user account in check mode + cs_account: + name: "{{ cs_resource_prefix }}_user" + username: "{{ cs_resource_prefix }}_username" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + network_domain: "example.com" + register: acc + check_mode: true +- name: verify results of create account in check mode + assert: + that: + - acc is changed + +- name: test create user account + cs_account: + name: "{{ cs_resource_prefix }}_user" + username: "{{ cs_resource_prefix }}_username" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + network_domain: "example.com" + register: acc +- name: verify results of create account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "enabled" + - acc.domain == "ROOT" + +- name: test create user account idempotence + cs_account: + name: "{{ cs_resource_prefix }}_user" + username: "{{ cs_resource_prefix }}_username" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + network_domain: "example.com" + register: acc +- name: verify results of create account idempotence + assert: + that: + - acc is not changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "enabled" + - acc.domain == "ROOT" + +- name: test lock user account in check mode + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: locked + register: acc + check_mode: true +- name: verify results of lock user account in check mode + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "enabled" + - acc.domain == "ROOT" + +- name: test lock user account + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: locked + register: acc +- name: verify results of lock user account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "locked" + - acc.domain == "ROOT" + +- name: test lock user account idempotence + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: locked + register: acc +- name: verify results of lock user account idempotence + assert: + that: + - acc is not changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "locked" + - acc.domain == "ROOT" + +- name: test disable user account in check mode + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: disabled + register: acc + check_mode: true +- name: verify results of disable user account in check mode + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "locked" + - acc.domain == "ROOT" + +- name: test disable user account + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: disabled + register: acc +- name: verify results of disable user account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "disabled" + - acc.domain == "ROOT" + +- name: test disable user account idempotence + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: disabled + register: acc +- name: verify results of disable user account idempotence + assert: + that: + - acc is not changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "disabled" + - acc.domain == "ROOT" + +- name: test lock disabled user account in check mode + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: locked + register: acc + check_mode: true +- name: verify results of lock disabled user account in check mode + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "disabled" + - acc.domain == "ROOT" + +- name: test lock disabled user account + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: locked + register: acc +- name: verify results of lock disabled user account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "locked" + - acc.domain == "ROOT" + +- name: test lock disabled user account idempotence + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: locked + register: acc +- name: verify results of lock disabled user account idempotence + assert: + that: + - acc is not changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "locked" + - acc.domain == "ROOT" + +- name: test enable user account in check mode + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: enabled + register: acc + check_mode: true +- name: verify results of enable user account in check mode + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "locked" + - acc.domain == "ROOT" + +- name: test enable user account + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: enabled + register: acc +- name: verify results of enable user account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "enabled" + - acc.domain == "ROOT" + +- name: test enable user account idempotence + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: enabled + register: acc +- name: verify results of enable user account idempotence + assert: + that: + - acc is not changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "enabled" + - acc.domain == "ROOT" + +- name: test remove user account in check mode + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: absent + register: acc + check_mode: true +- name: verify results of remove user account in check mode + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "enabled" + - acc.domain == "ROOT" + +- name: test remove user account + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: absent + register: acc +- name: verify results of remove user account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "enabled" + - acc.domain == "ROOT" + +- name: test remove user account idempotence + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: absent + register: acc +- name: verify results of remove user account idempotence + assert: + that: + - acc is not changed + +- name: test create user disabled account + cs_account: + name: "{{ cs_resource_prefix }}_user" + username: "{{ cs_resource_prefix }}_username" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + network_domain: "example.com" + state: disabled + register: acc +- name: verify results of create disabled account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "disabled" + - acc.domain == "ROOT" + +- name: test remove disabled user account + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: absent + register: acc +- name: verify results of remove disabled user account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "disabled" + - acc.domain == "ROOT" + +- name: test create user locked account + cs_account: + name: "{{ cs_resource_prefix }}_user" + username: "{{ cs_resource_prefix }}_username" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + network_domain: "example.com" + state: locked + register: acc +- name: verify results of create locked account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "locked" + - acc.domain == "ROOT" + +- name: test remove locked user account + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: absent + register: acc +- name: verify results of remove locked user account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "locked" + - acc.domain == "ROOT" + +- name: test create user unlocked/enabled account + cs_account: + name: "{{ cs_resource_prefix }}_user" + username: "{{ cs_resource_prefix }}_username" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + network_domain: "example.com" + state: unlocked + register: acc +- name: verify results of create unlocked/enabled account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "enabled" + - acc.domain == "ROOT" + +- name: test remove unlocked/enabled user account + cs_account: + name: "{{ cs_resource_prefix }}_user" + state: absent + register: acc +- name: verify results of remove unlocked/enabled user account + assert: + that: + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_user" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "enabled" + - acc.domain == "ROOT" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_affinitygroup/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_affinitygroup/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_affinitygroup/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_affinitygroup/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_affinitygroup/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_affinitygroup/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_affinitygroup/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_affinitygroup/tasks/main.yml new file mode 100644 index 00000000..994f21a1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_affinitygroup/tasks/main.yml @@ -0,0 +1,93 @@ +--- +- name: setup + cs_affinitygroup: + name: "{{ cs_resource_prefix }}_ag" + state: absent + register: ag +- name: verify setup + assert: + that: + - ag is successful + +- name: test fail if missing name + cs_affinitygroup: + register: ag + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - ag is failed + - "ag.msg == 'missing required arguments: name'" + +- name: test fail unknown affinity type + cs_affinitygroup: + name: "{{ cs_resource_prefix }}_ag" + affinity_type: unexistent affinity type + register: ag + ignore_errors: true +- name: verify test fail unknown affinity type + assert: + that: + - ag is failed + - "ag.msg == 'affinity group type not found: unexistent affinity type'" + +- name: test present affinity group in check mode + cs_affinitygroup: name={{ cs_resource_prefix }}_ag + register: ag + check_mode: true +- name: verify results of create affinity group in check mode + assert: + that: + - ag is successful + - ag is changed + +- name: test present affinity group + cs_affinitygroup: name={{ cs_resource_prefix }}_ag + register: ag +- name: verify results of create affinity group + assert: + that: + - ag is successful + - ag is changed + - ag.name == "{{ cs_resource_prefix }}_ag" + +- name: test present affinity group is idempotence + cs_affinitygroup: name={{ cs_resource_prefix }}_ag + register: ag +- name: verify results present affinity group is idempotence + assert: + that: + - ag is successful + - ag is not changed + - ag.name == "{{ cs_resource_prefix }}_ag" + +- name: test absent affinity group in check mode + cs_affinitygroup: name={{ cs_resource_prefix }}_ag state=absent + register: ag + check_mode: true +- name: verify results of absent affinity group in check mode + assert: + that: + - ag is successful + - ag is changed + - ag.name == "{{ cs_resource_prefix }}_ag" + +- name: test absent affinity group + cs_affinitygroup: name={{ cs_resource_prefix }}_ag state=absent + register: ag +- name: verify results of absent affinity group + assert: + that: + - ag is successful + - ag is changed + - ag.name == "{{ cs_resource_prefix }}_ag" + +- name: test absent affinity group is idempotence + cs_affinitygroup: name={{ cs_resource_prefix }}_ag state=absent + register: ag +- name: verify results of absent affinity group is idempotence + assert: + that: + - ag is successful + - ag is not changed + - ag.name is undefined diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_cluster/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_cluster/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_cluster/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_cluster/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_cluster/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_cluster/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_cluster/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_cluster/tasks/main.yml new file mode 100644 index 00000000..f911a7be --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_cluster/tasks/main.yml @@ -0,0 +1,317 @@ +--- +- name: setup cluster is absent + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + state: absent + register: cluster +- name: verify setup cluster is absent + assert: + that: + - cluster is successful + +- name: setup zone is present + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + dns1: 8.8.8.8 + dns2: 8.8.4.4 + network_type: Basic + register: zone +- name: verify setup zone is present + assert: + that: + - zone is successful + +- name: setup pod is present + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + start_ip: 10.100.10.101 + gateway: 10.100.10.1 + netmask: 255.255.255.0 + register: pod +- name: verify setup pod is present + assert: + that: + - pod is successful + +- name: test fail if missing name + cs_cluster: + zone: "{{ cs_resource_prefix }}-zone" + register: cluster + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - cluster is failed + - "cluster.msg == 'missing required arguments: name'" + +- name: test fail if pod not found + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + hypervisor: Simulator + cluster_type: CloudManaged + pod: unexistent + register: cluster + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - cluster is failed + - "cluster.msg == 'Pod unexistent not found in zone {{ cs_resource_prefix }}-zone'" + +- name: test create cluster in check mode + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + pod: "{{ cs_resource_prefix }}-pod" + hypervisor: Simulator + cluster_type: CloudManaged + register: cluster_origin + check_mode: true + tags: disable +- name: verify test create cluster in check mode + assert: + that: + - cluster_origin is changed + +- name: test create cluster + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + pod: "{{ cs_resource_prefix }}-pod" + hypervisor: Simulator + cluster_type: CloudManaged + register: cluster_origin + tags: disable +- name: verify test create cluster + assert: + that: + - cluster_origin is changed + - cluster_origin.name == "{{ cs_resource_prefix }}-cluster" + - cluster_origin.zone == "{{ cs_resource_prefix }}-zone" + - cluster_origin.allocation_state == "Enabled" + - cluster_origin.hypervisor == "Simulator" + - cluster_origin.cluster_type == "CloudManaged" + +- name: test create cluster idempotence + cs_cluster: + name: "{{ cs_resource_prefix }}-Cluster" + zone: "{{ cs_resource_prefix }}-Zone" + pod: "{{ cs_resource_prefix }}-pod" + hypervisor: Simulator + cluster_type: CloudManaged + register: cluster +- name: verify test create cluster idempotence + assert: + that: + - cluster.id == cluster_origin.id + - cluster is not changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Enabled" + - cluster_origin.hypervisor == "Simulator" + - cluster.cluster_type == "CloudManaged" + +- name: test update cluster in check mode + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + hypervisor: Simulator + cluster_type: ExternalManaged + register: cluster + check_mode: true +- name: verify test update cluster in check mode + assert: + that: + - cluster is changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Enabled" + - cluster.hypervisor == "Simulator" + - cluster.cluster_type == "CloudManaged" + - cluster.id == cluster_origin.id + +- name: test update cluster + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + hypervisor: Simulator + cluster_type: ExternalManaged + register: cluster +- name: verify test update cluster + assert: + that: + - cluster is changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Enabled" + - cluster.hypervisor == "Simulator" + - cluster.cluster_type == "ExternalManaged" + - cluster.id == cluster_origin.id + +- name: test update cluster idempotence + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + hypervisor: Simulator + cluster_type: ExternalManaged + register: cluster +- name: verify test update cluster idempotence + assert: + that: + - cluster is not changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Enabled" + - cluster.hypervisor == "Simulator" + - cluster.cluster_type == "ExternalManaged" + - cluster.id == cluster_origin.id + +- name: test disable cluster in check mode + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + state: disabled + register: cluster + check_mode: true +- name: verify test disable cluster in check mode + assert: + that: + - cluster is changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Enabled" + - cluster.hypervisor == "Simulator" + - cluster.cluster_type == "ExternalManaged" + - cluster.id == cluster_origin.id + +- name: test disable cluster + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + state: disabled + register: cluster +- name: verify test disable cluster + assert: + that: + - cluster is changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Disabled" + - cluster.hypervisor == "Simulator" + - cluster.cluster_type == "ExternalManaged" + - cluster.id == cluster_origin.id + +- name: test disable cluster idempotence + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + state: disabled + register: cluster +- name: verify test disable cluster idempotence + assert: + that: + - cluster is not changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Disabled" + - cluster.hypervisor == "Simulator" + - cluster.cluster_type == "ExternalManaged" + +- name: test enable cluster in check mode + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + state: enabled + register: cluster + check_mode: true +- name: verify test enable cluster in check mode + assert: + that: + - cluster is changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Disabled" + - cluster.hypervisor == "Simulator" + - cluster.cluster_type == "ExternalManaged" + - cluster.id == cluster_origin.id + +- name: test enable cluster + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + state: enabled + register: cluster +- name: verify test enable cluster + assert: + that: + - cluster is changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Enabled" + - cluster.hypervisor == "Simulator" + - cluster.cluster_type == "ExternalManaged" + - cluster.id == cluster_origin.id + +- name: test enable cluster idempotence + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + state: enabled + register: cluster +- name: verify test enable cluster idempotence + assert: + that: + - cluster is not changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Enabled" + - cluster.hypervisor == "Simulator" + - cluster.cluster_type == "ExternalManaged" + - cluster.id == cluster_origin.id + +- name: test remove cluster in check mode + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + state: absent + register: cluster + check_mode: true +- name: verify test remove cluster in check mode + assert: + that: + - cluster.id == cluster_origin.id + - cluster is changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Enabled" + - cluster_origin.hypervisor == "Simulator" + +- name: test remove cluster + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + state: absent + register: cluster +- name: verify test remove cluster + assert: + that: + - cluster.id == cluster_origin.id + - cluster is changed + - cluster.name == "{{ cs_resource_prefix }}-cluster" + - cluster.zone == "{{ cs_resource_prefix }}-zone" + - cluster.allocation_state == "Enabled" + - cluster_origin.hypervisor == "Simulator" + +- name: test remove cluster idempotence + cs_cluster: + name: "{{ cs_resource_prefix }}-cluster" + zone: "{{ cs_resource_prefix }}-zone" + state: absent + register: cluster +- name: verify test remove cluster idempotence + assert: + that: + - cluster is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_common/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_common/aliases new file mode 100644 index 00000000..136c05e0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_common/aliases @@ -0,0 +1 @@ +hidden diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_common/defaults/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_common/defaults/main.yml new file mode 100644 index 00000000..942316bd --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_common/defaults/main.yml @@ -0,0 +1,6 @@ +--- +cs_resource_prefix: "cs-{{ (ansible_date_time.iso8601_micro | to_uuid).split('-')[0] }}" +cs_common_template: CentOS 5.6 (64-bit) no GUI (Simulator) +cs_common_service_offering: Small Instance +cs_common_zone_adv: Sandbox-simulator-advanced +cs_common_zone_basic: Sandbox-simulator-basic diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_common/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_common/tasks/main.yml new file mode 100644 index 00000000..1b206a07 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_common/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- name: wait for system template available + cs_template: + name: "{{ cs_common_template }}" + state: absent + cross_zones: yes + template_filter: all + register: template + check_mode: true + until: template is changed + retries: 20 + delay: 5 + +- name: smoke test instance + cs_instance: + name: smoke-test-vm + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + register: instance + until: instance is successful + retries: 20 + delay: 5 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/defaults/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/defaults/main.yml new file mode 100644 index 00000000..3cf304ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/defaults/main.yml @@ -0,0 +1,5 @@ +--- +test_cs_configuration_storage: PS0-adv +test_cs_configuration_cluster: C0-basic +test_cs_configuration_account: admin +test_cs_configuration_zone: Sandbox-simulator-basic diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/account.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/account.yml new file mode 100644 index 00000000..8b20918f --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/account.yml @@ -0,0 +1,76 @@ +--- +- name: test configuration account + cs_configuration: + name: allow.public.user.templates + account: "{{ test_cs_configuration_account }}" + value: true + register: config +- name: verify test configuration storage + assert: + that: + - config is successful + +- name: test update configuration account in check mode + cs_configuration: + name: allow.public.user.templates + account: "{{ test_cs_configuration_account }}" + value: false + register: config + check_mode: true +- name: verify update configuration account in check mode + assert: + that: + - config is successful + - config is changed + - config.value == "true" + - config.name == "allow.public.user.templates" + - config.scope == "account" + - config.account == "{{ test_cs_configuration_account }}" + +- name: test update configuration account + cs_configuration: + name: allow.public.user.templates + account: "{{ test_cs_configuration_account }}" + value: false + register: config +- name: verify update configuration account + assert: + that: + - config is successful + - config is changed + - config.value == "false" + - config.name == "allow.public.user.templates" + - config.scope == "account" + - config.account == "{{ test_cs_configuration_account }}" + +- name: test update configuration account idempotence + cs_configuration: + name: allow.public.user.templates + account: "{{ test_cs_configuration_account }}" + value: false + register: config +- name: verify update configuration account idempotence + assert: + that: + - config is successful + - config is not changed + - config.value == "false" + - config.name == "allow.public.user.templates" + - config.scope == "account" + - config.account == "{{ test_cs_configuration_account }}" + +- name: test reset configuration account + cs_configuration: + name: allow.public.user.templates + account: "{{ test_cs_configuration_account }}" + value: true + register: config +- name: verify update configuration account + assert: + that: + - config is successful + - config is changed + - config.value == "true" + - config.name == "allow.public.user.templates" + - config.scope == "account" + - config.account == "{{ test_cs_configuration_account }}" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/cluster.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/cluster.yml new file mode 100644 index 00000000..b8cb2b94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/cluster.yml @@ -0,0 +1,76 @@ +--- +- name: test configuration cluster + cs_configuration: + name: cpu.overprovisioning.factor + cluster: "{{ test_cs_configuration_cluster }}" + value: 1.0 + register: config +- name: verify test configuration cluster + assert: + that: + - config is successful + +- name: test update configuration cluster in check mode + cs_configuration: + name: cpu.overprovisioning.factor + cluster: "{{ test_cs_configuration_cluster }}" + value: 2.0 + register: config + check_mode: true +- name: verify update configuration cluster in check mode + assert: + that: + - config is successful + - config is changed + - config.value == "1.0" + - config.name == "cpu.overprovisioning.factor" + - config.scope == "cluster" + - config.cluster == "{{ test_cs_configuration_cluster }}" + +- name: test update configuration cluster + cs_configuration: + name: cpu.overprovisioning.factor + cluster: "{{ test_cs_configuration_cluster }}" + value: 2.0 + register: config +- name: verify update configuration cluster + assert: + that: + - config is successful + - config is changed + - config.value == "2.0" + - config.name == "cpu.overprovisioning.factor" + - config.scope == "cluster" + - config.cluster == "{{ test_cs_configuration_cluster }}" + +- name: test update configuration cluster idempotence + cs_configuration: + name: cpu.overprovisioning.factor + cluster: "{{ test_cs_configuration_cluster }}" + value: 2.0 + register: config +- name: verify update configuration cluster idempotence + assert: + that: + - config is successful + - config is not changed + - config.value == "2.0" + - config.name == "cpu.overprovisioning.factor" + - config.scope == "cluster" + - config.cluster == "{{ test_cs_configuration_cluster }}" + +- name: test reset configuration cluster + cs_configuration: + name: cpu.overprovisioning.factor + cluster: "{{ test_cs_configuration_cluster }}" + value: 1.0 + register: config +- name: verify reset configuration cluster + assert: + that: + - config is successful + - config is changed + - config.value == "1.0" + - config.name == "cpu.overprovisioning.factor" + - config.scope == "cluster" + - config.cluster == "{{ test_cs_configuration_cluster }}" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/main.yml new file mode 100644 index 00000000..e80c85f9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/main.yml @@ -0,0 +1,204 @@ +--- +- name: test fail if missing name + cs_configuration: + register: config + ignore_errors: true +- name: verify results of fail if missing arguments + assert: + that: + - config is failed + - "config.msg.startswith('missing required arguments: ')" + +- name: test configuration + cs_configuration: + name: network.loadbalancer.haproxy.stats.visibility + value: global + register: config +- name: verify test configuration + assert: + that: + - config is successful + +- name: test update configuration string in check mode + cs_configuration: + name: network.loadbalancer.haproxy.stats.visibility + value: all + register: config + check_mode: true +- name: verify test update configuration string in check mode + assert: + that: + - config is successful + - config is changed + - config.value == "global" + - config.name == "network.loadbalancer.haproxy.stats.visibility" + +- name: test update configuration string + cs_configuration: + name: network.loadbalancer.haproxy.stats.visibility + value: all + register: config +- name: verify test update configuration string + assert: + that: + - config is successful + - config is changed + - config.value == "all" + - config.name == "network.loadbalancer.haproxy.stats.visibility" + +- name: test update configuration string idempotence + cs_configuration: + name: network.loadbalancer.haproxy.stats.visibility + value: all + register: config +- name: verify test update configuration string idempotence + assert: + that: + - config is successful + - config is not changed + - config.value == "all" + - config.name == "network.loadbalancer.haproxy.stats.visibility" + +- name: test reset configuration string + cs_configuration: + name: network.loadbalancer.haproxy.stats.visibility + value: global + register: config +- name: verify test reset configuration string + assert: + that: + - config is successful + - config is changed + - config.value == "global" + - config.name == "network.loadbalancer.haproxy.stats.visibility" + +- name: test configuration + cs_configuration: + name: vmware.recycle.hung.wokervm + value: false + register: config +- name: verify test configuration + assert: + that: + - config is successful + +- name: test update configuration bool in check mode + cs_configuration: + name: vmware.recycle.hung.wokervm + value: true + register: config + check_mode: true +- name: verify test update configuration bool in check mode + assert: + that: + - config is successful + - config is changed + - config.value == "false" + - config.name == "vmware.recycle.hung.wokervm" + +- name: test update configuration bool + cs_configuration: + name: vmware.recycle.hung.wokervm + value: true + register: config +- name: verify test update configuration bool + assert: + that: + - config is successful + - config is changed + - config.value == "true" + - config.name == "vmware.recycle.hung.wokervm" + +- name: test update configuration bool idempotence + cs_configuration: + name: vmware.recycle.hung.wokervm + value: true + register: config +- name: verify test update configuration bool idempotence + assert: + that: + - config is successful + - config is not changed + - config.value == "true" + - config.name == "vmware.recycle.hung.wokervm" + +- name: test reset configuration bool + cs_configuration: + name: vmware.recycle.hung.wokervm + value: false + register: config +- name: verify test reset configuration bool + assert: + that: + - config is successful + - config is changed + - config.value == "false" + - config.name == "vmware.recycle.hung.wokervm" + +- name: test configuration + cs_configuration: + name: agent.load.threshold + value: 0.7 + register: config +- name: verify test configuration + assert: + that: + - config is successful + +- name: test update configuration float in check mode + cs_configuration: + name: agent.load.threshold + value: 0.81 + register: config + check_mode: true +- name: verify update configuration float in check mode + assert: + that: + - config is successful + - config is changed + - config.value == "0.7" + - config.name == "agent.load.threshold" + +- name: test update configuration float + cs_configuration: + name: agent.load.threshold + value: 0.81 + register: config +- name: verify update configuration float + assert: + that: + - config is successful + - config is changed + - config.value == "0.81" + - config.name == "agent.load.threshold" + +- name: test update configuration float idempotence + cs_configuration: + name: agent.load.threshold + value: 0.81 + register: config +- name: verify update configuration float idempotence + assert: + that: + - config is successful + - config is not changed + - config.value == "0.81" + - config.name == "agent.load.threshold" + +- name: reset configuration float + cs_configuration: + name: agent.load.threshold + value: 0.7 + register: config +- name: verify reset configuration float + assert: + that: + - config is successful + - config is changed + - config.value == "0.7" + - config.name == "agent.load.threshold" + +- include: storage.yml +- include: account.yml +- include: zone.yml +- include: cluster.yml diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/storage.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/storage.yml new file mode 100644 index 00000000..e376dcf1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/storage.yml @@ -0,0 +1,76 @@ +--- +- name: test configuration storage + cs_configuration: + name: storage.overprovisioning.factor + storage: "{{ test_cs_configuration_storage }}" + value: 2.0 + register: config +- name: verify test configuration storage + assert: + that: + - config is successful + +- name: test update configuration storage in check mode + cs_configuration: + name: storage.overprovisioning.factor + storage: "{{ test_cs_configuration_storage }}" + value: 3.0 + register: config + check_mode: true +- name: verify update configuration storage in check mode + assert: + that: + - config is successful + - config is changed + - config.value == "2.0" + - config.name == "storage.overprovisioning.factor" + - config.scope == "storagepool" + - config.storage == "{{ test_cs_configuration_storage }}" + +- name: test update configuration storage + cs_configuration: + name: storage.overprovisioning.factor + storage: "{{ test_cs_configuration_storage }}" + value: 3.0 + register: config +- name: verify update configuration storage + assert: + that: + - config is successful + - config is changed + - config.value == "3.0" + - config.name == "storage.overprovisioning.factor" + - config.scope == "storagepool" + - config.storage == "{{ test_cs_configuration_storage }}" + +- name: test update configuration storage idempotence + cs_configuration: + name: storage.overprovisioning.factor + storage: "{{ test_cs_configuration_storage }}" + value: 3.0 + register: config +- name: verify update configuration storage idempotence + assert: + that: + - config is successful + - config is not changed + - config.value == "3.0" + - config.name == "storage.overprovisioning.factor" + - config.scope == "storagepool" + - config.storage == "{{ test_cs_configuration_storage }}" + +- name: test reset configuration storage + cs_configuration: + name: storage.overprovisioning.factor + storage: "{{ test_cs_configuration_storage }}" + value: 2.0 + register: config +- name: verify reset configuration storage + assert: + that: + - config is successful + - config is changed + - config.value == "2.0" + - config.name == "storage.overprovisioning.factor" + - config.scope == "storagepool" + - config.storage == "{{ test_cs_configuration_storage }}" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/zone.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/zone.yml new file mode 100644 index 00000000..cd9333fa --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_configuration/tasks/zone.yml @@ -0,0 +1,59 @@ +--- +- name: test configuration zone + cs_configuration: + name: use.external.dns + zone: "{{ test_cs_configuration_zone }}" + value: false + register: config +- name: verify test configuration zone + assert: + that: + - config is successful + +- name: test update configuration zone + cs_configuration: + name: use.external.dns + zone: "{{ test_cs_configuration_zone }}" + value: true + register: config +- name: verify update configuration zone + assert: + that: + - config is successful + - config is changed + - config.value == "true" + - config.name == "use.external.dns" + - config.scope == "zone" + - config.zone == "{{ test_cs_configuration_zone }}" + +- name: test update configuration zone idempotence + cs_configuration: + name: use.external.dns + zone: "{{ test_cs_configuration_zone }}" + value: true + register: config +- name: verify update configuration zone idempotence + assert: + that: + - config is successful + - config is not changed + - config.value == "true" + - config.name == "use.external.dns" + - config.scope == "zone" + - config.zone == "{{ test_cs_configuration_zone }}" + +- name: test reset configuration zone + cs_configuration: + name: use.external.dns + zone: "{{ test_cs_configuration_zone }}" + value: false + register: config +- name: verify reset configuration zone + assert: + that: + - config is successful + - config is changed + - config.value == "false" + - config.name == "use.external.dns" + - config.scope == "zone" + - config.zone == "{{ test_cs_configuration_zone }}" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_disk_offering/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_disk_offering/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_disk_offering/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_disk_offering/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_disk_offering/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_disk_offering/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_disk_offering/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_disk_offering/tasks/main.yml new file mode 100644 index 00000000..fd55788c --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_disk_offering/tasks/main.yml @@ -0,0 +1,143 @@ +--- +- name: setup disk offering + cs_disk_offering: + name: Small + state: absent + register: do +- name: verify setup disk offering + assert: + that: + - do is successful + +- name: create disk offering in check mode + cs_disk_offering: + name: Small + disk_size: 10 + storage_tags: + - eco + - backup + storage_type: local + register: do + check_mode: true +- name: verify create disk offering in check mode + assert: + that: + - do is changed + +- name: create disk offering + cs_disk_offering: + name: Small + disk_size: 10 + storage_tags: + - eco + - backup + storage_type: local + register: do +- name: verify create disk offering + assert: + that: + - do is changed + - do.name == "Small" + - do.storage_tags == ['eco', 'backup'] + - do.storage_type == "local" + +- name: create disk offering idempotence + cs_disk_offering: + name: Small + disk_size: 10 + storage_tags: + - eco + - backup + storage_type: local + register: do +- name: verify create disk offering idempotence + assert: + that: + - do is not changed + - do.name == "Small" + - do.storage_tags == ['eco', 'backup'] + - do.storage_type == "local" + +- name: update disk offering in check mode + cs_disk_offering: + name: Small + disk_size: 10 + display_text: Small 10GB + register: do + check_mode: true +- name: verify create update offering in check mode + assert: + that: + - do is changed + - do.name == "Small" + - do.storage_tags == ['eco', 'backup'] + - do.storage_type == "local" + +- name: update disk offering + cs_disk_offering: + name: Small + disk_size: 10 + display_text: Small 10GB + register: do +- name: verify update disk offerin + assert: + that: + - do is changed + - do.name == "Small" + - do.display_text == "Small 10GB" + - do.storage_tags == ['eco', 'backup'] + - do.storage_type == "local" + +- name: update disk offering idempotence + cs_disk_offering: + name: Small + disk_size: 10 + display_text: Small 10GB + register: do +- name: verify update disk offering idempotence + assert: + that: + - do is not changed + - do.name == "Small" + - do.display_text == "Small 10GB" + - do.storage_tags == ['eco', 'backup'] + - do.storage_type == "local" + +- name: remove disk offering in check mode + cs_disk_offering: + name: Small + state: absent + check_mode: true + register: do +- name: verify remove disk offering in check mode + assert: + that: + - do is changed + - do.name == "Small" + - do.display_text == "Small 10GB" + - do.storage_tags == ['eco', 'backup'] + - do.storage_type == "local" + +- name: remove disk offering + cs_disk_offering: + name: Small + state: absent + register: do +- name: verify remove disk offering + assert: + that: + - do is changed + - do.name == "Small" + - do.display_text == "Small 10GB" + - do.storage_tags == ['eco', 'backup'] + - do.storage_type == "local" + +- name: remove disk offering idempotence + cs_disk_offering: + name: Small + state: absent + register: do +- name: verify remove disk offering idempotence + assert: + that: + - do is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_domain/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_domain/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_domain/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_domain/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_domain/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_domain/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_domain/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_domain/tasks/main.yml new file mode 100644 index 00000000..e51ca0d4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_domain/tasks/main.yml @@ -0,0 +1,241 @@ +--- +- name: setup + cs_domain: + path: "{{ cs_resource_prefix }}_domain" + state: absent + register: dom +- name: verify setup + assert: + that: + - dom is successful + +- name: test fail if missing name + action: cs_domain + register: dom + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - dom is failed + - 'dom.msg == "missing required arguments: path"' + +- name: test fail if ends with / + cs_domain: + path: "{{ cs_resource_prefix }}_domain/" + register: dom + ignore_errors: true +- name: verify results of fail if ends with / + assert: + that: + - dom is failed + - dom.msg == "Path '{{ cs_resource_prefix }}_domain/' must not end with /" + +- name: test create a domain in check mode + cs_domain: + path: "{{ cs_resource_prefix }}_domain" + register: dom + check_mode: true +- name: verify results of test create a domain in check mode + assert: + that: + - dom is changed + +- name: test create a domain + cs_domain: + path: "{{ cs_resource_prefix }}_domain" + register: dom +- name: verify results of test create a domain + assert: + that: + - dom is changed + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain" + - dom.name == "{{ cs_resource_prefix }}_domain" + +- name: test create a domain idempotence + cs_domain: + path: "{{ cs_resource_prefix }}_domain" + register: dom +- name: verify results of test create a domain idempotence + assert: + that: + - dom is not changed + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain" + - dom.name == "{{ cs_resource_prefix }}_domain" + +- name: test create a domain idempotence2 + cs_domain: + path: "/{{ cs_resource_prefix }}_domain" + register: dom +- name: verify results of test create a domain idempotence2 + assert: + that: + - dom is not changed + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain" + - dom.name == "{{ cs_resource_prefix }}_domain" + +- name: test fail to create a subdomain for inexistent domain + cs_domain: + path: ROOT/inexistent/{{ cs_resource_prefix }}_subdomain + register: dom + ignore_errors: true +- name: test fail to create a subdomain for inexistent domain + assert: + that: + - dom is failed + - dom.msg == "Parent domain path ROOT/inexistent does not exist" + +- name: test create a subdomain in check mode + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain + register: dom + check_mode: true +- name: verify results of test create a domain in check mode + assert: + that: + - dom is changed + +- name: test create a subdomain + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain + register: dom +- name: verify results of test create a domain + assert: + that: + - dom is changed + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain" + - dom.name == "{{ cs_resource_prefix }}_subdomain" + +- name: test create a subdomain idempotence + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain + register: dom +- name: verify results of test create a subdomain idempotence + assert: + that: + - dom is not changed + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain" + - dom.name == "{{ cs_resource_prefix }}_subdomain" + +- name: test update a subdomain in check mode + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain + network_domain: domain.example.com + register: dom + check_mode: true +- name: verify results of test update a subdomain in check mode + assert: + that: + - dom is changed + - dom.network_domain is undefined + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain" + - dom.name == "{{ cs_resource_prefix }}_subdomain" + +- name: test update a subdomain + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain + network_domain: domain.example.com + register: dom +- name: verify results of test update a subdomain + assert: + that: + - dom is changed + - dom.network_domain == "domain.example.com" + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain" + - dom.name == "{{ cs_resource_prefix }}_subdomain" + +- name: test update a subdomain idempotence + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain + network_domain: domain.example.com + register: dom +- name: verify results of test update a subdomain idempotence + assert: + that: + - dom is not changed + - dom.network_domain == "domain.example.com" + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain" + - dom.name == "{{ cs_resource_prefix }}_subdomain" + +- name: test delete a subdomain in check mode + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain + state: absent + register: dom + check_mode: true +- name: verify results of test delete a subdomain in check mode + assert: + that: + - dom is changed + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain" + - dom.name == "{{ cs_resource_prefix }}_subdomain" + +- name: test delete a subdomain + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain + state: absent + register: dom +- name: verify results of test delete a subdomain + assert: + that: + - dom is changed + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain" + - dom.name == "{{ cs_resource_prefix }}_subdomain" + +- name: test delete a subdomain idempotence + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain + state: absent + register: dom +- name: verify results of test delete a subdomain idempotence + assert: + that: + - dom is not changed + +- name: test create a subdomain 2 + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain + register: dom +- name: verify results of test create a subdomain 2 + assert: + that: + - dom is changed + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain" + - dom.name == "{{ cs_resource_prefix }}_subdomain" + +- name: test delete a domain with clean up in check mode + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain + state: absent + clean_up: true + register: dom + check_mode: true +- name: verify results of test delete a domain with clean up in check mode + assert: + that: + - dom is changed + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain" + - dom.name == "{{ cs_resource_prefix }}_domain" + +- name: test delete a domain with clean up + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain + state: absent + clean_up: true + register: dom +- name: verify results of test delete a domain with clean up + assert: + that: + - dom is changed + - dom.path == "ROOT/{{ cs_resource_prefix }}_domain" + - dom.name == "{{ cs_resource_prefix }}_domain" + +- name: test delete a domain with clean up idempotence + cs_domain: + path: ROOT/{{ cs_resource_prefix }}_domain + state: absent + clean_up: true + register: dom +- name: verify results of test delete a domain with clean up idempotence + assert: + that: + - dom is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/defaults/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/defaults/main.yml new file mode 100644 index 00000000..f5999305 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/defaults/main.yml @@ -0,0 +1,3 @@ +--- +cs_firewall_ip_address: 10.100.212.5 +cs_firewall_network: ansible test diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/tasks/main.yml new file mode 100644 index 00000000..5061ef89 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_firewall/tasks/main.yml @@ -0,0 +1,447 @@ +--- +- name: network setup + cs_network: + name: "{{ cs_firewall_network }}" + network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService + network_domain: example.com + zone: "{{ cs_common_zone_adv }}" + register: net + +- name: setup instance to get network in implementation state + cs_instance: + name: "{{ cs_resource_prefix }}-vm-cs-firewall" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + networks: + - "{{ net.name }}" + register: instance + until: instance is success + retries: 20 + delay: 5 +- name: verify instance setup + assert: + that: + - instance is successful + +- name: public ip address setup + cs_ip_address: + network: ansible test + zone: "{{ cs_common_zone_adv }}" + register: ip_address +- name: verify public ip address setup + assert: + that: + - ip_address is successful + +- name: set ip address as fact + set_fact: + cs_firewall_ip_address: "{{ ip_address.ip_address }}" + +- name: setup 80 + cs_firewall: + port: 80 + ip_address: "{{ cs_firewall_ip_address }}" + zone: "{{ cs_common_zone_adv }}" + state: absent + +- name: setup 5300 + cs_firewall: + ip_address: "{{ cs_firewall_ip_address }}" + protocol: udp + start_port: 5300 + end_port: 5333 + cidrs: + - 1.2.3.0/24 + - 4.5.6.0/24 + zone: "{{ cs_common_zone_adv }}" + state: absent + +- name: setup all + cs_firewall: + network: "{{ cs_firewall_network }}" + protocol: all + type: egress + zone: "{{ cs_common_zone_adv }}" + state: absent + +- name: test fail if missing params + action: cs_firewall + register: fw + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - fw is failed + - "fw.msg == 'one of the following is required: ip_address, network'" + +- name: test fail if missing params + cs_firewall: + ip_address: "{{ cs_firewall_ip_address }}" + zone: "{{ cs_common_zone_adv }}" + register: fw + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - fw is failed + - "fw.msg == \"missing required argument for protocol 'tcp': start_port or end_port\"" + +- name: test fail if missing params network egress + cs_firewall: + type: egress + zone: "{{ cs_common_zone_adv }}" + register: fw + ignore_errors: true +- name: verify results of fail if missing params ip_address + assert: + that: + - fw is failed + - "fw.msg == 'one of the following is required: ip_address, network'" + +- name: test present firewall rule ingress 80 in check mode + cs_firewall: + port: 80 + ip_address: "{{ cs_firewall_ip_address }}" + zone: "{{ cs_common_zone_adv }}" + register: fw + check_mode: true +- name: verify results of present firewall rule ingress 80 in check mode + assert: + that: + - fw is changed + +- name: test present firewall rule ingress 80 + cs_firewall: + port: 80 + ip_address: "{{ cs_firewall_ip_address }}" + zone: "{{ cs_common_zone_adv }}" + register: fw +- name: verify results of present firewall rule ingress 80 + assert: + that: + - fw is changed + - fw.cidr == "0.0.0.0/0" + - fw.cidrs == [ '0.0.0.0/0' ] + - fw.ip_address == "{{ cs_firewall_ip_address }}" + - fw.protocol == "tcp" + - fw.start_port == 80 + - fw.end_port == 80 + - fw.type == "ingress" + +- name: test present firewall rule ingress 80 idempotence + cs_firewall: + port: 80 + ip_address: "{{ cs_firewall_ip_address }}" + zone: "{{ cs_common_zone_adv }}" + register: fw +- name: verify results of present firewall rule ingress 80 idempotence + assert: + that: + - fw is not changed + - fw.cidr == "0.0.0.0/0" + - fw.cidrs == [ '0.0.0.0/0' ] + - fw.ip_address == "{{ cs_firewall_ip_address }}" + - fw.protocol == "tcp" + - fw.start_port == 80 + - fw.end_port == 80 + - fw.type == "ingress" + +- name: test present firewall rule ingress 5300 in check mode + cs_firewall: + ip_address: "{{ cs_firewall_ip_address }}" + protocol: udp + start_port: 5300 + end_port: 5333 + cidrs: + - 1.2.3.0/24 + - 4.5.6.0/24 + zone: "{{ cs_common_zone_adv }}" + register: fw + check_mode: true +- name: verify results of present firewall rule ingress 5300 in check mode + assert: + that: + - fw is changed + +- name: test present firewall rule ingress 5300 + cs_firewall: + ip_address: "{{ cs_firewall_ip_address }}" + protocol: udp + start_port: 5300 + end_port: 5333 + cidrs: + - 1.2.3.0/24 + - 4.5.6.0/24 + zone: "{{ cs_common_zone_adv }}" + register: fw +- name: verify results of present firewall rule ingress 5300 + assert: + that: + - fw is changed + - fw.cidr == "1.2.3.0/24,4.5.6.0/24" + - fw.cidrs == [ '1.2.3.0/24', '4.5.6.0/24' ] + - fw.ip_address == "{{ cs_firewall_ip_address }}" + - fw.protocol == "udp" + - fw.start_port == 5300 + - fw.end_port == 5333 + - fw.type == "ingress" + +- name: test present firewall rule ingress 5300 idempotence + cs_firewall: + ip_address: "{{ cs_firewall_ip_address }}" + protocol: udp + start_port: 5300 + end_port: 5333 + cidrs: + - 1.2.3.0/24 + - 4.5.6.0/24 + zone: "{{ cs_common_zone_adv }}" + register: fw +- name: verify results of present firewall rule ingress 5300 idempotence + assert: + that: + - fw is not changed + - fw.cidr == "1.2.3.0/24,4.5.6.0/24" + - fw.cidrs == [ '1.2.3.0/24', '4.5.6.0/24' ] + - fw.ip_address == "{{ cs_firewall_ip_address }}" + - fw.protocol == "udp" + - fw.start_port == 5300 + - fw.end_port == 5333 + - fw.type == "ingress" + +- name: test present firewall rule egress all in check mode + cs_firewall: + network: "{{ cs_firewall_network }}" + protocol: all + type: egress + zone: "{{ cs_common_zone_adv }}" + register: fw + check_mode: true +- name: verify results of present firewall rule egress all in check mode + assert: + that: + - fw is changed + +- name: test present firewall rule egress all + cs_firewall: + network: "{{ cs_firewall_network }}" + protocol: all + type: egress + zone: "{{ cs_common_zone_adv }}" + register: fw +- name: verify results of present firewall rule egress all + assert: + that: + - fw is changed + - fw.cidr == "0.0.0.0/0" or fw.cidr == "10.1.1.0/24" + - fw.cidrs == [ '0.0.0.0/0' ] or fw.cidrs == [ '10.1.1.0/24' ] + - fw.network == "{{ cs_firewall_network }}" + - fw.protocol == "all" + - fw.type == "egress" + +- name: test present firewall rule egress all idempotence + cs_firewall: + network: "{{ cs_firewall_network }}" + protocol: all + type: egress + zone: "{{ cs_common_zone_adv }}" + register: fw +- name: verify results of present firewall rule egress all idempotence + assert: + that: + - fw is not changed + - fw.cidr == "0.0.0.0/0" or fw.cidr == "10.1.1.0/24" + - fw.cidrs == [ '0.0.0.0/0' ] or fw.cidrs == [ '10.1.1.0/24' ] + - fw.network == "{{ cs_firewall_network }}" + - fw.protocol == "all" + - fw.type == "egress" + +- name: test absent firewall rule ingress 80 in check mode + cs_firewall: + port: 80 + ip_address: "{{ cs_firewall_ip_address }}" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: fw + check_mode: true +- name: verify results of absent firewall rule ingress 80 in check mode + assert: + that: + - fw is changed + - fw.cidr == "0.0.0.0/0" + - fw.cidrs == [ '0.0.0.0/0' ] + - fw.ip_address == "{{ cs_firewall_ip_address }}" + - fw.protocol == "tcp" + - fw.start_port == 80 + - fw.end_port == 80 + - fw.type == "ingress" + +- name: test absent firewall rule ingress 80 + cs_firewall: + port: 80 + ip_address: "{{ cs_firewall_ip_address }}" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: fw +- name: verify results of absent firewall rule ingress 80 + assert: + that: + - fw is changed + - fw.cidr == "0.0.0.0/0" + - fw.cidrs == [ '0.0.0.0/0' ] + - fw.ip_address == "{{ cs_firewall_ip_address }}" + - fw.protocol == "tcp" + - fw.start_port == 80 + - fw.end_port == 80 + - fw.type == "ingress" + +- name: test absent firewall rule ingress 80 idempotence + cs_firewall: + port: 80 + ip_address: "{{ cs_firewall_ip_address }}" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: fw +- name: verify results of absent firewall rule ingress 80 idempotence + assert: + that: + - fw is not changed + +- name: test absent firewall rule ingress 5300 in check mode + cs_firewall: + ip_address: "{{ cs_firewall_ip_address }}" + protocol: udp + start_port: 5300 + end_port: 5333 + cidrs: + - 1.2.3.0/24 + - 4.5.6.0/24 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: fw + check_mode: true +- name: verify results of absent firewall rule ingress 5300 in check mode + assert: + that: + - fw is changed + - fw.cidr == "1.2.3.0/24,4.5.6.0/24" + - fw.cidrs == [ '1.2.3.0/24', '4.5.6.0/24' ] + - fw.ip_address == "{{ cs_firewall_ip_address }}" + - fw.protocol == "udp" + - fw.start_port == 5300 + - fw.end_port == 5333 + - fw.type == "ingress" + +- name: test absent firewall rule ingress 5300 + cs_firewall: + ip_address: "{{ cs_firewall_ip_address }}" + protocol: udp + start_port: 5300 + end_port: 5333 + cidrs: + - 1.2.3.0/24 + - 4.5.6.0/24 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: fw +- name: verify results of absent firewall rule ingress 5300 + assert: + that: + - fw is changed + - fw.cidr == "1.2.3.0/24,4.5.6.0/24" + - fw.cidrs == [ '1.2.3.0/24', '4.5.6.0/24' ] + - fw.ip_address == "{{ cs_firewall_ip_address }}" + - fw.protocol == "udp" + - fw.start_port == 5300 + - fw.end_port == 5333 + - fw.type == "ingress" + +- name: test absent firewall rule ingress 5300 idempotence + cs_firewall: + ip_address: "{{ cs_firewall_ip_address }}" + protocol: udp + start_port: 5300 + end_port: 5333 + cidrs: + - 1.2.3.0/24 + - 4.5.6.0/24 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: fw +- name: verify results of absent firewall rule ingress 5300 idempotence + assert: + that: + - fw is not changed + +- name: test absent firewall rule egress all in check mode + cs_firewall: + network: "{{ cs_firewall_network }}" + protocol: all + type: egress + state: absent + zone: "{{ cs_common_zone_adv }}" + register: fw + check_mode: true +- name: verify results of absent firewall rule egress all in check mode + assert: + that: + - fw is changed + - fw.cidr == "0.0.0.0/0" or fw.cidr == "10.1.1.0/24" + - fw.cidrs == [ '0.0.0.0/0' ] or fw.cidrs == [ '10.1.1.0/24' ] + - fw.network == "{{ cs_firewall_network }}" + - fw.protocol == "all" + - fw.type == "egress" + +- name: test absent firewall rule egress all + cs_firewall: + network: "{{ cs_firewall_network }}" + protocol: all + type: egress + state: absent + zone: "{{ cs_common_zone_adv }}" + register: fw +- name: verify results of absent firewall rule egress all + assert: + that: + - fw is changed + - fw.cidr == "0.0.0.0/0" or fw.cidr == "10.1.1.0/24" + - fw.cidrs == [ '0.0.0.0/0' ] or fw.cidrs == [ '10.1.1.0/24' ] + - fw.network == "{{ cs_firewall_network }}" + - fw.protocol == "all" + - fw.type == "egress" + +- name: test absent firewall rule egress all idempotence + cs_firewall: + network: "{{ cs_firewall_network }}" + protocol: all + type: egress + zone: "{{ cs_common_zone_adv }}" + state: absent + register: fw +- name: verify results of absent firewall rule egress all idempotence + assert: + that: + - fw is not changed + +- name: cleanup instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-cs-firewall" + zone: "{{ cs_common_zone_adv }}" + state: expunged + register: instance +- name: verify instance cleanup + assert: + that: + - instance is successful + +- name: network cleanup + cs_network: + name: "{{ cs_firewall_network }}" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: net +- name: verify network cleanup + assert: + that: + - net is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_host/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_host/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_host/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_host/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_host/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_host/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_host/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_host/tasks/main.yml new file mode 100644 index 00000000..c47d006d --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_host/tasks/main.yml @@ -0,0 +1,438 @@ +--- +- name: test fail missing params + cs_host: + zone: "{{ cs_common_zone_basic }}" + register: host + ignore_errors: true +- name: verify test fail missing url if host is not existent + assert: + that: + - host is failed + - 'host.msg == "missing required arguments: name"' + +- name: test fail missing params if host is not existent + cs_host: + name: sim + zone: "{{ cs_common_zone_basic }}" + register: host + ignore_errors: true +- name: verify test fail missing params if host is not existent + assert: + that: + - host is failed + - 'host.msg == "missing required arguments: password, username, hypervisor, pod"' + +- name: test create a host in check mode + cs_host: + name: sim + zone: "{{ cs_common_zone_basic }}" + url: "http://sim/c0-basic/h2" + cluster: C0-basic + pod: POD0-basic + username: root + password: password + hypervisor: Simulator + allocation_state: enabled + host_tags: + - perf + - gpu + register: host + check_mode: true +- name: verify test create a host in check mode + assert: + that: + - host is changed + +- name: test create a host + cs_host: + name: sim + zone: "{{ cs_common_zone_basic }}" + url: "http://sim/c0-basic/h2" + cluster: C0-basic + pod: POD0-basic + username: root + password: password + hypervisor: Simulator + allocation_state: enabled + host_tags: + - perf + - gpu + register: host +- name: verify test create a host + assert: + that: + - host is changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - "host.name.startswith('SimulatedAgent.')" + - host.host_tags == ['perf', 'gpu'] + +# This is special in simulator mode, we can not predict the full hostname. +# That is why we gather the infos from the returns and use a fact. +- name: assume the sim would resolve to the IP address + set_fact: + host_hostname: "{{ host.name }}" + host_ip_address: "{{ host.ip_address }}" + +- name: test create a host idempotence + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + url: "http://sim/c0-basic/h2" + cluster: C0-basic + pod: POD0-basic + username: admin + password: password + hypervisor: Simulator + allocation_state: enabled + host_tags: + - perf + - gpu + register: host +- name: verify test create a host idempotence + assert: + that: + - host is not changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu'] + +- name: test update host in check mode + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + url: "http://sim/c0-basic/h2" + cluster: C0-basic + pod: POD0-basic + username: admin + password: password + hypervisor: Simulator + allocation_state: enabled + host_tags: + - perf + - gpu + - x2 + register: host + check_mode: true +- name: verify test update a host in check mode + assert: + that: + - host is changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu'] + +- name: test update host + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + url: "http://sim/c0-basic/h2" + cluster: C0-basic + pod: POD0-basic + username: admin + password: password + hypervisor: Simulator + allocation_state: enabled + host_tags: + - perf + - gpu + - x2 + register: host +- name: verify test update a host in check mode + assert: + that: + - host is changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu', 'x2'] + +- name: test update host idempotence + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + url: "http://sim/c0-basic/h2" + cluster: C0-basic + pod: POD0-basic + username: admin + password: password + hypervisor: Simulator + allocation_state: enabled + host_tags: + - perf + - gpu + - x2 + register: host +- name: verify test update a host idempotence + assert: + that: + - host is not changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu', 'x2'] + +# FIXME: Removing by empty list seems to be an issue in the used lib cs underneath, disabled +- name: test update host remove host_tags + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + url: "http://sim/c0-basic/h2" + cluster: C0-basic + pod: POD0-basic + username: admin + password: password + hypervisor: Simulator + allocation_state: enabled + host_tags: [] + register: host + when: false +- name: verify test update host remove host_tags + assert: + that: + - host is changed + - host.host_tags|length == 0 + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + when: false + +# FIXME: Removing by empty list seems to be an issue in the used lib cs underneath, disabled +- name: test update host remove host_tags idempotence + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + url: "http://sim/c0-basic/h2" + cluster: C0-basic + pod: POD0-basic + username: admin + password: password + hypervisor: Simulator + allocation_state: enabled + host_tags: [] + register: host + when: false +- name: verify test update host remove host_tags idempotence + assert: + that: + - host is not changed + - len(host.host_tags) == 0 + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + when: false + + +- name: test put host in maintenance in check mode + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + cluster: C0-basic + pod: POD0-basic + allocation_state: maintenance + check_mode: true + register: host +- name: verify test put host in maintenance in check mode + assert: + that: + - host is changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu', 'x2'] + +- name: test put host in maintenance + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + cluster: C0-basic + pod: POD0-basic + allocation_state: maintenance + register: host +- name: verify test put host in maintenance + assert: + that: + - host is changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'maintenance' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu', 'x2'] + +- name: test put host in maintenance idempotence + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + cluster: C0-basic + pod: POD0-basic + allocation_state: maintenance + register: host +- name: verify test put host in maintenance idempotence + assert: + that: + - host is not changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'maintenance' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu', 'x2'] + +- name: test put host out of maintenance in check mode + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + cluster: C0-basic + pod: POD0-basic + allocation_state: enabled + check_mode: true + register: host +- name: verify test put host out of maintenance in check mode + assert: + that: + - host is changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'maintenance' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu', 'x2'] + +- name: test put host out of maintenance + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + cluster: C0-basic + pod: POD0-basic + allocation_state: enabled + register: host +- name: verify test put host out of maintenance + assert: + that: + - host is changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu', 'x2'] + +- name: test put host out of maintenance idempotence + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + cluster: C0-basic + pod: POD0-basic + allocation_state: enabled + register: host +- name: verify test put host out of maintenance idempotence + assert: + that: + - host is not changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu', 'x2'] + +- name: test remove host in check mode + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + cluster: C0-basic + pod: POD0-basic + state: absent + check_mode: true + register: host +- name: verify test remove a host in check mode + assert: + that: + - host is changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu', 'x2'] + +- name: test remove host + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + cluster: C0-basic + pod: POD0-basic + state: absent + register: host +- name: verify test remove a host + assert: + that: + - host is changed + - host.cluster == 'C0-basic' + - host.pod == 'POD0-basic' + - host.hypervisor == 'Simulator' + - host.allocation_state == 'enabled' + - host.zone == 'Sandbox-simulator-basic' + - host.state == 'Up' + - host.name == '{{ host_hostname }}' + - host.host_tags == ['perf', 'gpu', 'x2'] + +- name: test remove host idempotence + cs_host: + name: "{{ host_hostname }}" + zone: "{{ cs_common_zone_basic }}" + cluster: C0-basic + pod: POD0-basic + state: absent + register: host +- name: verify test remove a host idempotenc + assert: + that: + - host is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_image_store/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_image_store/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_image_store/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_image_store/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_image_store/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_image_store/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_image_store/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_image_store/tasks/main.yml new file mode 100644 index 00000000..8d1eaa07 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_image_store/tasks/main.yml @@ -0,0 +1,166 @@ +--- +- name: setup image store is absent + cs_image_store: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: sp +- name: verify setup image store is absent + assert: + that: + - sp is successful + +- name: test fail if missing params + cs_image_store: + register: ss + ignore_errors: true +- name: verify test fail if missing params + assert: + that: + - ss is failed + - "'name' in ss.msg" + - "'zone' in ss.msg" + - "'missing required arguments: ' in ss.msg" + +- name: setup image store with wrong parameters + cs_image_store: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: present + ignore_errors: true + register: ss +- name: verify setup image store with wrong parameters + assert: + that: + - ss is failed + - "ss.msg == 'state is present but all of the following are missing: url, provider'" + +- name: setup image store in check mode + cs_image_store: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + url: "nfs://nfs-mount.domain/share/images/" + provider: "NFS" + state: present + check_mode: true + register: ss +- name: verify setup image store in check mode + assert: + that: + - ss is successful + - ss is changed + +- name: setup image store + cs_image_store: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + url: "nfs://nfs-mount.domain/share/images/" + provider: "NFS" + state: present + register: ss +- name: verify setup image store + assert: + that: + - ss is successful + - ss is changed + - "ss.url == 'nfs://nfs-mount.domain/share/images/'" + - "ss.provider_name == 'NFS'" + - "ss.zone == cs_common_zone_adv" + - "ss.protocol == 'nfs'" + +- name: setup image store idempotence + cs_image_store: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + url: "nfs://nfs-mount.domain/share/images/" + provider: "NFS" + state: present + register: ss +- name: verify setup image store idempotence + assert: + that: + - ss is successful + - ss is not changed + - "ss.url == 'nfs://nfs-mount.domain/share/images/'" + - "ss.provider_name == 'NFS'" + - "ss.zone == cs_common_zone_adv" + - "ss.protocol == 'nfs'" + - "ss.name == 'storage_pool_adv'" + +- name: image store not recreated + cs_image_store: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + url: "nfs://nfs-mount.domain/share2/images/" + provider: "NFS" + state: present + register: ss +- name: verify image store not recreated + assert: + that: + - ss is successful + - ss is not changed + - "ss.url == 'nfs://nfs-mount.domain/share/images/'" + - "ss.name == 'storage_pool_adv'" + - "ss.zone == cs_common_zone_adv" + +- name: recreate image store + cs_image_store: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + url: "nfs://nfs-mount.domain/share2/images/" + provider: "NFS" + force_recreate: yes + state: present + register: ss +- name: verify setup image store idempotence + assert: + that: + - ss is successful + - ss is changed + - "ss.url == 'nfs://nfs-mount.domain/share2/images/'" + - "ss.name == 'storage_pool_adv'" + - "ss.zone == cs_common_zone_adv" + +- name: delete the image store in check_mode + cs_image_store: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: ss + check_mode: yes +- name: verify results for delete the image store in check_mode + assert: + that: + - ss is successful + - ss is changed + - "ss.name == 'storage_pool_adv'" + - "ss.zone == cs_common_zone_adv" + +- name: delete the image store + cs_image_store: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: ss +- name: verify results for delete the image store + assert: + that: + - ss is successful + - ss is changed + - "ss.name == 'storage_pool_adv'" + - "ss.zone == cs_common_zone_adv" + +- name: delete the image store idempotence + cs_image_store: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: ss +- name: verify delete the image store idempotence + assert: + that: + - ss is successful + - ss is not changed + - ss.name is undefined + - "ss.zone == cs_common_zone_adv"
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/defaults/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/defaults/main.yml new file mode 100644 index 00000000..4db5c7c9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/defaults/main.yml @@ -0,0 +1,5 @@ +--- +instance_number: 1 +test_cs_instance_template: "{{ cs_common_template }}" +test_cs_instance_offering_1: Small Instance +test_cs_instance_offering_2: Medium Instance diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/absent.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/absent.yml new file mode 100644 index 00000000..ea94b4d8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/absent.yml @@ -0,0 +1,124 @@ +--- +- name: test destroy instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: instance + check_mode: true +- name: verify destroy instance in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.state != "Destroyed" + +- name: test destroy instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: instance +- name: verify destroy instance + assert: + that: + - instance is successful + - instance is changed + - instance.state == "Destroyed" + +- name: test destroy instance idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: instance +- name: verify destroy instance idempotence + assert: + that: + - instance is successful + - instance is not changed + +- name: test recover to stopped state and update a deleted instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + state: stopped + register: instance + check_mode: true +- name: verify test recover to stopped state and update a deleted instance in check mode + assert: + that: + - instance is successful + - instance is changed + +- name: test recover to stopped state and update a deleted instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + state: stopped + register: instance +- name: verify test recover to stopped state and update a deleted instance + assert: + that: + - instance is successful + - instance is changed + - instance.state == "Stopped" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test recover to stopped state and update a deleted instance idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + state: stopped + register: instance +- name: verify test recover to stopped state and update a deleted instance idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.state == "Stopped" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test expunge instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: expunged + register: instance + check_mode: true +- name: verify test expunge instance in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.state == "Stopped" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test expunge instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: expunged + register: instance +- name: verify test expunge instance + assert: + that: + - instance is successful + - instance is changed + - instance.state == "Stopped" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test expunge instance idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: expunged + register: instance +- name: verify test expunge instance idempotence + assert: + that: + - instance is successful + - instance is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/absent_display_name.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/absent_display_name.yml new file mode 100644 index 00000000..8bea0ae4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/absent_display_name.yml @@ -0,0 +1,47 @@ +--- +- name: test destroy instance with display_name + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: instance +- name: verify destroy instance with display_name + assert: + that: + - instance is successful + - instance is changed + - instance.state == "Destroyed" + +- name: test destroy instance with display_name idempotence + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: instance +- name: verify destroy instance with display_name idempotence + assert: + that: + - instance is successful + - instance is not changed + +- name: test recover to stopped state and update a deleted instance with display_name + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + state: stopped + register: instance +- name: verify test recover to stopped state and update a deleted instance with display_name + assert: + that: + - instance is successful + - instance is changed + - instance.state == "Stopped" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +# force expunge, only works with admin permissions +- cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: expunged + failed_when: false diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/cleanup.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/cleanup.yml new file mode 100644 index 00000000..655aab60 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/cleanup.yml @@ -0,0 +1,36 @@ +--- +- name: cleanup ssh key + cs_sshkeypair: + name: "{{ cs_resource_prefix }}-sshkey" + state: absent + register: sshkey +- name: verify cleanup ssh key + assert: + that: + - sshkey is successful + +- name: cleanup affinity group + cs_affinitygroup: + name: "{{ cs_resource_prefix }}-ag" + state: absent + register: ag + until: ag is successful + retries: 20 + delay: 5 +- name: verify cleanup affinity group + assert: + that: + - ag is successful + +- name: cleanup security group ...take a while unless instance is expunged + cs_securitygroup: + name: "{{ cs_resource_prefix }}-sg" + state: absent + register: sg + until: sg is successful + retries: 100 + delay: 10 +- name: verify cleanup security group + assert: + that: + - sg is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/host.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/host.yml new file mode 100644 index 00000000..5d4a89c2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/host.yml @@ -0,0 +1,143 @@ +--- +- name: setup ensure running instance to get host infos + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + state: started + register: running_instance + +- name: setup ensure stopped instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: stopped + +- name: setup zone facts + cs_zone_info: + name: "{{ cs_common_zone_basic }}" + register: zone_info + +- name: setup find the host name + shell: cs listHosts type=routing zoneid="{{ zone_info.zones[0].id }}" + args: + chdir: "{{ playbook_dir }}" + register: host + +- name: host convert from json + set_fact: + host_json: "{{ host.stdout | from_json }}" + +- name: select a host on which the instance was not running on + set_fact: + host: "{{ host_json | json_query('host[?name!=`' + running_instance.host + '`] | [0]') }}" + +- debug: + msg: "from current host {{ running_instance.host }} to new host {{ host.name }}" + +- name: test starting instance on new host in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + host: "{{ host.name }}" + state: started + register: instance + check_mode: true +- name: verify test starting instance on new host in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.host is not defined + - instance.state == "Stopped" + +- name: test starting instance on new host + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + host: "{{ host.name }}" + state: started + register: instance +- name: verify test starting instance on new host + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.host == "{{ host.name }}" + - instance.state == "Running" + +- name: test starting instance on new host idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + host: "{{ host.name }}" + state: started + register: instance +- name: verify test starting instance on new host idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.host == "{{ host.name }}" + - instance.state == "Running" + +- name: select a host on which the instance is not running on + set_fact: + host: "{{ host_json | json_query('host[?name!=`' + instance.host + '`] | [0]') }}" + +- debug: + msg: "from current host {{ instance.host }} to new host {{ host.name }}" + +- name: test force update running instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + host: "{{ host.name }}" + force: true + register: instance + check_mode: true +- name: verify force update running instance in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.host != "{{ host.name }}" + - instance.state == "Running" + +- name: test force update running instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + host: "{{ host.name }}" + force: true + register: instance +- name: verify force update running instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.host == "{{ host.name }}" + - instance.state == "Running" + +- name: test force update running instance idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + host: "{{ host.name }}" + force: true + register: instance +- name: verify force update running instance idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.host == "{{ host.name }}" + - instance.state == "Running" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/main.yml new file mode 100644 index 00000000..681e60ab --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/main.yml @@ -0,0 +1,19 @@ +--- +- import_tasks: setup.yml + +- import_tasks: present.yml +- import_tasks: tags.yml +- import_tasks: absent.yml + +- import_tasks: present_display_name.yml +- import_tasks: absent_display_name.yml + +# TODO: These tests randomly fail in all kinds of unexpected states. +# This needs to be verified by the cloudstack community. +# - import_tasks: host.yml + +- import_tasks: sshkeys.yml + +- import_tasks: project.yml + +- import_tasks: cleanup.yml diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/present.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/present.yml new file mode 100644 index 00000000..b800945f --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/present.yml @@ -0,0 +1,342 @@ +--- +- name: setup instance to be absent + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: expunged + register: instance +- name: verify instance to be absent + assert: + that: + - instance is successful + +- name: test create instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + 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" + user_data: | + #cloud-config + package_upgrade: true + packages: + - tmux + tags: [] + register: instance + check_mode: true +- name: verify create instance in check mode + assert: + that: + - instance is successful + - instance is changed + +- name: test create instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + 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" + user_data: | + #cloud-config + package_upgrade: true + packages: + - tmux + tags: [] + register: instance +- name: verify create instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + - instance.ssh_key == "{{ cs_resource_prefix }}-sshkey" + - not instance.tags + +- name: test create instance idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + 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" + user_data: | + #cloud-config + package_upgrade: true + packages: + - tmux + tags: [] + register: instance +- name: verify create instance idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + - instance.ssh_key == "{{ cs_resource_prefix }}-sshkey" + - not instance.tags + +- name: gather host infos of running instance + cs_instance_info: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + +- name: test running instance not updated in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_2 }}" + register: instance + check_mode: true +- name: verify running instance not updated in check mode + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test running instance not updated + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_2 }}" + register: instance +- name: verify running instance not updated + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test stopping instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: stopped + register: instance + check_mode: true +- name: verify stopping instance in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test stopping instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: stopped + register: instance +- name: verify stopping instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Stopped" + +- name: test stopping instance idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: stopped + register: instance +- name: verify stopping instance idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.state == "Stopped" + +- name: test updating stopped instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}" + service_offering: "{{ test_cs_instance_offering_2 }}" + register: instance + check_mode: true +- name: verify updating stopped instance in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Stopped" + +- name: test updating stopped instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}" + service_offering: "{{ test_cs_instance_offering_2 }}" + register: instance +- name: verify updating stopped instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Stopped" + +- name: test updating stopped instance idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}" + service_offering: "{{ test_cs_instance_offering_2 }}" + register: instance +- name: verify updating stopped instance idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Stopped" + +- name: test starting instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: started + register: instance +- name: verify starting instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Running" + +- name: test starting instance idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: started + register: instance +- name: verify starting instance idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Running" + +- name: test force update running instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + force: true + register: instance + check_mode: true +- name: verify force update running instance in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Running" + +- name: test force update running instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + force: true + register: instance +- name: verify force update running instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test force update running instance idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + force: true + register: instance +- name: verify force update running instance idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test restore instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + state: restored + register: instance + check_mode: true +- name: verify restore instance in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test restore instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + state: restored + register: instance +- name: verify restore instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/present_display_name.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/present_display_name.yml new file mode 100644 index 00000000..1daa4c7f --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/present_display_name.yml @@ -0,0 +1,190 @@ +--- +- name: setup instance with display_name to be absent + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: expunged + register: instance +- name: verify instance with display_name to be absent + assert: + that: + - instance is successful + +- name: test create instance with display_name + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + 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 with display_name + assert: + that: + - instance is successful + - instance is changed + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + - instance.ssh_key == "{{ cs_resource_prefix }}-sshkey" + - not instance.tags + +- name: test create instance with display_name idempotence + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + 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 with display_name idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + - instance.ssh_key == "{{ cs_resource_prefix }}-sshkey" + - not instance.tags + +- name: test running instance with display_name not updated + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_2 }}" + register: instance +- name: verify running instance with display_name not updated + assert: + that: + - instance is successful + - instance is not changed + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test stopping instance with display_name + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: stopped + register: instance +- name: verify stopping instance with display_name + assert: + that: + - instance is successful + - instance is changed + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Stopped" + +- name: test stopping instance with display_name idempotence + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: stopped + register: instance +- name: verify stopping instance idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.state == "Stopped" + +- name: test updating stopped instance with display_name + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_2 }}" + register: instance +- name: verify updating stopped instance with display_name + assert: + that: + - instance is successful + - instance is changed + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Stopped" + +- name: test starting instance with display_name + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: started + register: instance +- name: verify starting instance with display_name + assert: + that: + - instance is successful + - instance is changed + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Running" + +- name: test starting instance with display_name idempotence + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + state: started + register: instance +- name: verify starting instance with display_name idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Running" + +- name: test force update running instance with display_name + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + force: true + register: instance +- name: verify force update running instance with display_name + assert: + that: + - instance is successful + - instance is changed + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test force update running instance with display_name idempotence + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + force: true + register: instance +- name: verify force update running instance with display_name idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test restore instance with display_name + cs_instance: + display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + state: restored + register: instance +- name: verify restore instance with display_name + assert: + that: + - instance is successful + - instance is changed + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/project.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/project.yml new file mode 100644 index 00000000..edb5abf5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/project.yml @@ -0,0 +1,589 @@ +--- +- name: setup create project + cs_project: + name: "{{ cs_resource_prefix }}-prj" + register: prj +- name: verify test create project + assert: + that: + - prj is successful + +- name: setup instance in project to be absent + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: absent + register: instance +- name: verify instance in project to be absent + assert: + that: + - instance is successful + +- name: setup ssh key in project + cs_sshkeypair: + name: "{{ cs_resource_prefix }}-sshkey-prj" + project: "{{ cs_resource_prefix }}-prj" + register: sshkey +- name: verify setup ssh key in project + assert: + that: + - sshkey is successful + +- name: setup affinity group in project + cs_affinitygroup: + name: "{{ cs_resource_prefix }}-ag-prj" + project: "{{ cs_resource_prefix }}-prj" + register: ag +- name: verify setup affinity group in project + assert: + that: + - ag is successful + +- name: setup security group in project + cs_securitygroup: + name: "{{ cs_resource_prefix }}-sg-prj" + project: "{{ cs_resource_prefix }}-prj" + register: sg +- name: verify setup security group in project + assert: + that: + - sg is successful + +- name: test create instance in project in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + affinity_group: "{{ cs_resource_prefix }}-ag-prj" + security_group: "{{ cs_resource_prefix }}-sg-prj" + project: "{{ cs_resource_prefix }}-prj" + ssh_key: "{{ cs_resource_prefix }}-sshkey-prj" + tags: [] + register: instance + check_mode: true +- name: verify create instance in project in check mode + assert: + that: + - instance is successful + - instance is changed + +- name: test create instance in project + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + affinity_group: "{{ cs_resource_prefix }}-ag-prj" + security_group: "{{ cs_resource_prefix }}-sg-prj" + project: "{{ cs_resource_prefix }}-prj" + ssh_key: "{{ cs_resource_prefix }}-sshkey-prj" + tags: [] + register: instance +- name: verify create instance in project + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + - instance.ssh_key == "{{ cs_resource_prefix }}-sshkey-prj" + - not instance.tags + +- name: test create instance in project idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + affinity_group: "{{ cs_resource_prefix }}-ag-prj" + security_group: "{{ cs_resource_prefix }}-sg-prj" + project: "{{ cs_resource_prefix }}-prj" + ssh_key: "{{ cs_resource_prefix }}-sshkey-prj" + tags: [] + register: instance +- name: verify create instance in project idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + - instance.ssh_key == "{{ cs_resource_prefix }}-sshkey-prj" + - not instance.tags + +- name: test running instance in project not updated in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_2 }}" + project: "{{ cs_resource_prefix }}-prj" + register: instance + check_mode: true +- name: verify running instance in project not updated in check mode + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + + +- name: test running instance in project not updated + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_2 }}" + project: "{{ cs_resource_prefix }}-prj" + register: instance +- name: verify running instance in project not updated + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test stopping instance in project in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: stopped + register: instance + check_mode: true +- name: verify stopping instance in project in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test stopping instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: stopped + register: instance +- name: verify stopping instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Stopped" + +- name: test stopping instance in project idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: stopped + register: instance +- name: verify stopping instance in project idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.state == "Stopped" + +- name: test updating stopped instance in project in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}" + project: "{{ cs_resource_prefix }}-prj" + service_offering: "{{ test_cs_instance_offering_2 }}" + register: instance + check_mode: true +- name: verify updating stopped instance in project in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Stopped" + +- name: test updating stopped instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}" + project: "{{ cs_resource_prefix }}-prj" + service_offering: "{{ test_cs_instance_offering_2 }}" + register: instance +- name: verify updating stopped instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Stopped" + +- name: test updating stopped instance in project idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}" + project: "{{ cs_resource_prefix }}-prj" + service_offering: "{{ test_cs_instance_offering_2 }}" + register: instance +- name: verify updating stopped instance in project idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Stopped" + +- name: test starting instance in project in check mdoe + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: started + register: instance + check_mode: true +- name: verify starting instance in project in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Stopped" + +- name: test starting instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: started + register: instance +- name: verify starting instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Running" + +- name: test starting instance in project idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: started + register: instance +- name: verify starting instance in project idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Running" + +- name: test force update running instance in project in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + project: "{{ cs_resource_prefix }}-prj" + force: true + register: instance + check_mode: true +- name: verify force update running instance in project in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_2 }}" + - instance.state == "Running" + +- name: test force update running instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + project: "{{ cs_resource_prefix }}-prj" + force: true + register: instance +- name: verify force update running instance + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test force update running instance in project idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + project: "{{ cs_resource_prefix }}-prj" + force: true + register: instance +- name: verify force update running instance in project idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + - instance.state == "Running" + +- name: test restore instance in project in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + project: "{{ cs_resource_prefix }}-prj" + state: restored + register: instance + check_mode: true +- name: verify restore instance in project in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test restore instance in project + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + project: "{{ cs_resource_prefix }}-prj" + state: restored + register: instance +- name: verify restore instance in project + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + - instance.project == "{{ cs_resource_prefix }}-prj" + - instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test destroy instance in project in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: absent + register: instance + check_mode: true +- name: verify destroy instance in project in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.state != "Destroyed" + +- name: test destroy instance in project + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: absent + register: instance +- name: verify destroy instance in project + assert: + that: + - instance is successful + - instance is changed + - instance.state == "Destroyed" + +- name: test destroy instance in project idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: absent + register: instance +- name: verify destroy instance in project idempotence + assert: + that: + - instance is successful + - instance is not changed + +- name: test recover in project to stopped state and update a deleted instance in project in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + service_offering: "{{ test_cs_instance_offering_1 }}" + state: stopped + register: instance + check_mode: true +- name: verify test recover to stopped state and update a deleted instance in project in check mode + assert: + that: + - instance is successful + - instance is changed + +- name: test recover to stopped state and update a deleted instance in project + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + service_offering: "{{ test_cs_instance_offering_1 }}" + state: stopped + register: instance +- name: verify test recover to stopped state and update a deleted instance in project + assert: + that: + - instance is successful + - instance is changed + - instance.state == "Stopped" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test recover to stopped state and update a deleted instance in project idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + service_offering: "{{ test_cs_instance_offering_1 }}" + state: stopped + register: instance +- name: verify test recover to stopped state and update a deleted instance in project idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.state == "Stopped" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test expunge instance in project in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: expunged + register: instance + check_mode: true +- name: verify test expunge instance in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.state == "Stopped" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test expunge instance in project + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: expunged + register: instance +- name: verify test expunge instance in project + assert: + that: + - instance is successful + - instance is changed + - instance.state == "Stopped" + - instance.service_offering == "{{ test_cs_instance_offering_1 }}" + +- name: test expunge instance in project idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + project: "{{ cs_resource_prefix }}-prj" + state: expunged + register: instance +- name: verify test expunge instance in project idempotence + assert: + that: + - instance is successful + - instance is not changed + +- name: cleanup ssh key in project + cs_sshkeypair: + name: "{{ cs_resource_prefix }}-sshkey-prj" + project: "{{ cs_resource_prefix }}-prj" + state: absent + register: sshkey +- name: verify cleanup ssh key in project + assert: + that: + - sshkey is successful + +- name: cleanup affinity group in project + cs_affinitygroup: + name: "{{ cs_resource_prefix }}-ag-prj" + project: "{{ cs_resource_prefix }}-prj" + state: absent + register: ag + until: ag is successful + retries: 20 + delay: 5 +- name: verify cleanup affinity group in project + assert: + that: + - ag is successful + +- name: cleanup security group in project ...take a while unless instance in project is expunged + cs_securitygroup: + name: "{{ cs_resource_prefix }}-sg-prj" + project: "{{ cs_resource_prefix }}-prj" + state: absent + register: sg + until: sg is successful + retries: 100 + delay: 10 +- name: verify cleanup security group in project + assert: + that: + - sg is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/setup.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/setup.yml new file mode 100644 index 00000000..6600f0f9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/setup.yml @@ -0,0 +1,27 @@ +--- +- 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 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/sshkeys.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/sshkeys.yml new file mode 100644 index 00000000..89202773 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/sshkeys.yml @@ -0,0 +1,181 @@ +--- +- name: test update instance ssh key non existent + cs_instance: + name: "{{ cs_resource_prefix }}-vm-sshkey" + zone: "{{ cs_common_zone_basic }}" + ssh_key: "{{ cs_resource_prefix }}-sshkey-does-not-exist" + 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 }}-sshkey-does-not-exist"' + +- name: test create instance without keypair in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-sshkey" + zone: "{{ cs_common_zone_basic }}" + 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" + zone: "{{ cs_common_zone_basic }}" + 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" + zone: "{{ cs_common_zone_basic }}" + 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" + zone: "{{ cs_common_zone_basic }}" + 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" + zone: "{{ cs_common_zone_basic }}" + 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" + zone: "{{ cs_common_zone_basic }}" + 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" + zone: "{{ cs_common_zone_basic }}" + 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" + zone: "{{ cs_common_zone_basic }}" + 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" + zone: "{{ cs_common_zone_basic }}" + 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" + zone: "{{ cs_common_zone_basic }}" + 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" + zone: "{{ cs_common_zone_basic }}" + state: expunged + register: instance +- name: verify cleanup expunge instance + assert: + that: + - instance is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/tags.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/tags.yml new file mode 100644 index 00000000..667e5a8b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance/tasks/tags.yml @@ -0,0 +1,140 @@ +--- +- name: test add tags to instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + tags: + - { key: "{{ cs_resource_prefix }}-tag1", value: "{{ cs_resource_prefix }}-value1" } + - { key: "{{ cs_resource_prefix }}-tag2", value: "{{ cs_resource_prefix }}-value2" } + register: instance + check_mode: true +- name: verify add tags to instance in check mode + assert: + that: + - instance is successful + - instance is changed + - not instance.tags + +- name: test add tags to instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + template: "{{ test_cs_instance_template }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + tags: + - { key: "{{ cs_resource_prefix }}-tag1", value: "{{ cs_resource_prefix }}-value1" } + - { key: "{{ cs_resource_prefix }}-tag2", value: "{{ cs_resource_prefix }}-value2" } + register: instance +- name: verify add tags to instance + assert: + that: + - instance is successful + - instance is changed + - instance.tags|length == 2 + - "instance.tags[0]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag1' ]" + - "instance.tags[1]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag1' ]" + - "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]" + - "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]" + +- name: test tags to instance idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + tags: + - { key: "{{ cs_resource_prefix }}-tag1", value: "{{ cs_resource_prefix }}-value1" } + - { key: "{{ cs_resource_prefix }}-tag2", value: "{{ cs_resource_prefix }}-value2" } + register: instance +- name: verify tags to instance idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.tags|length == 2 + - "instance.tags[0]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag1' ]" + - "instance.tags[1]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag1' ]" + - "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]" + - "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]" + +- name: test change tags of instance in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + tags: + - { key: "{{ cs_resource_prefix }}-tag2", value: "{{ cs_resource_prefix }}-value2" } + - { key: "{{ cs_resource_prefix }}-tag3", value: "{{ cs_resource_prefix }}-value3" } + register: instance + check_mode: true +- name: verify tags to instance idempotence in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.tags|length == 2 + - "instance.tags[0]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag1' ]" + - "instance.tags[1]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag1' ]" + - "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]" + - "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]" + +- name: test change tags of instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + tags: + - { key: "{{ cs_resource_prefix }}-tag2", value: "{{ cs_resource_prefix }}-value2" } + - { key: "{{ cs_resource_prefix }}-tag3", value: "{{ cs_resource_prefix }}-value3" } + register: instance +- name: verify tags to instance idempotence + assert: + that: + - instance is successful + - instance is changed + - instance.tags|length == 2 + - "instance.tags[0]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag3' ]" + - "instance.tags[1]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag3' ]" + - "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value3' ]" + - "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value3' ]" + +- name: test not touch tags of instance if no param tags + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + register: instance +- name: verify not touch tags of instance if no param tags + assert: + that: + - instance is successful + - instance is not changed + - instance.tags|length == 2 + - "instance.tags[0]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag3' ]" + - "instance.tags[1]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag3' ]" + - "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value3' ]" + - "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value3' ]" + +- name: test remove tags in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + tags: [] + register: instance + check_mode: true +- name: verify remove tags in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.tags|length != 0 + +- name: test remove tags + cs_instance: + name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" + zone: "{{ cs_common_zone_basic }}" + tags: [] + register: instance +- name: verify remove tags + assert: + that: + - instance is successful + - instance is changed + - instance.tags|length == 0 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/defaults/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/defaults/main.yml new file mode 100644 index 00000000..490c6c14 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/defaults/main.yml @@ -0,0 +1,3 @@ +--- +test_cs_instance_template: "{{ cs_common_template }}" +test_cs_instance_offering_1: Small Instance diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/tasks/main.yml new file mode 100644 index 00000000..c56caf5a --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_info/tasks/main.yml @@ -0,0 +1,80 @@ +--- +- name: setup ssh key + cs_sshkeypair: + name: "{{ cs_resource_prefix }}-sshkey" + register: sshkey + +- name: setup affinity group + cs_affinitygroup: + name: "{{ cs_resource_prefix }}-ag" + +- name: setup security group + cs_securitygroup: + name: "{{ cs_resource_prefix }}-sg" + +- 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: [] + zone: "{{ cs_common_zone_basic }}" + register: instance + until: instance is successful + retries: 20 + delay: 5 + +- 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]' diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic/tasks/main.yml new file mode 100644 index 00000000..83b564e1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic/tasks/main.yml @@ -0,0 +1,306 @@ +--- +- name: setup network + cs_network: + name: "net_nic" + zone: "{{ cs_common_zone_adv }}" + network_offering: DefaultSharedNetworkOffering + network_domain: example.com + vlan: 1234 + start_ip: 10.100.123.11 + end_ip: 10.100.123.250 + gateway: 10.100.123.1 + netmask: 255.255.255.0 + register: net +- name: verify setup network + assert: + that: + - net is successful + - net.name == "net_nic" + +- name: setup instance + cs_instance: + name: "instance-nic-vm" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + network: "net_nic" + state: stopped + register: instance +- name: verify setup instance + assert: + that: + - instance is successful + - instance.name == "instance-nic-vm" + - instance.state == "Stopped" + +- name: setup network 2 + cs_network: + name: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + network_offering: DefaultSharedNetworkOffering + network_domain: example.com + vlan: 1235 + start_ip: 10.100.124.11 + end_ip: 10.100.124.250 + gateway: 10.100.124.1 + netmask: 255.255.255.0 + register: net +- name: verify setup network 2 + assert: + that: + - net is successful + - net.name == "net_nic2" + +- name: setup absent nic + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: nic +- name: verify setup absent nic + assert: + that: + - nic is successful + +- name: test fail missing params + cs_instance_nic: + ignore_errors: true + register: nic +- name: verify test fail missing params + assert: + that: + - nic is failed + - "nic.msg.startswith('missing required arguments: ')" + +- name: test create nic in check mode + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + check_mode: yes + register: nic +- name: verify test create nic in check mode + assert: + that: + - nic is successful + - nic is changed + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + +- name: test create nic + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + ip_address: 10.100.124.42 + zone: "{{ cs_common_zone_adv }}" + register: nic +- name: verify test create nic + assert: + that: + - nic is successful + - nic is changed + - nic.ip_address == "10.100.124.42" + - nic.netmask == "255.255.255.0" + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + - nic.mac_address is defined + +- name: test create nic idempotence + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + ip_address: 10.100.124.42 + zone: "{{ cs_common_zone_adv }}" + register: nic +- name: verify test create nic idempotence + assert: + that: + - nic is successful + - nic is not changed + - nic.ip_address == "10.100.124.42" + - nic.netmask == "255.255.255.0" + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + - nic.mac_address is defined + +- name: test create nic without ip address idempotence + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + register: nic +- name: verify test create nic without ip address idempotence + assert: + that: + - nic is successful + - nic is not changed + - nic.ip_address == "10.100.124.42" + - nic.netmask == "255.255.255.0" + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + - nic.mac_address is defined + +- name: test update nic in check mode + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + ip_address: 10.100.124.23 + zone: "{{ cs_common_zone_adv }}" + check_mode: yes + register: nic +- name: verify test update nic in check mode + assert: + that: + - nic is successful + - nic is changed + - nic.ip_address == "10.100.124.42" + - nic.netmask == "255.255.255.0" + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + - nic.mac_address is defined + +- name: test update nic + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + ip_address: 10.100.124.23 + zone: "{{ cs_common_zone_adv }}" + register: nic +- name: verify test update nic + assert: + that: + - nic is successful + - nic is changed + - nic.ip_address == "10.100.124.23" + - nic.netmask == "255.255.255.0" + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + - nic.mac_address is defined + +- name: test update nic idempotence + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + ip_address: 10.100.124.23 + zone: "{{ cs_common_zone_adv }}" + register: nic +- name: verify test update nic idempotence + assert: + that: + - nic is successful + - nic is not changed + - nic.ip_address == "10.100.124.23" + - nic.netmask == "255.255.255.0" + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + - nic.mac_address is defined + +- name: test update nic without ip address idempotence + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + register: nic +- name: verify test update nic without ip address idempotence + assert: + that: + - nic is successful + - nic is not changed + - nic.ip_address == "10.100.124.23" + - nic.netmask == "255.255.255.0" + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + - nic.mac_address is defined + +- name: test remove nic in check mode + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + state: absent + check_mode: yes + register: nic +- name: verify test remove nic in check mode + assert: + that: + - nic is successful + - nic is changed + - nic.ip_address == "10.100.124.23" + - nic.netmask == "255.255.255.0" + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + - nic.mac_address is defined + +- name: test remove nic + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: nic +- name: verify test remove nic + assert: + that: + - nic is successful + - nic is changed + - nic.ip_address == "10.100.124.23" + - nic.netmask == "255.255.255.0" + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + - nic.mac_address is defined + +- name: test remove nic idempotence + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: nic +- name: verify test remove nic idempotence + assert: + that: + - nic is successful + - nic is not changed + +- name: cleanup instance + cs_instance: + name: "instance-nic-vm" + state: expunged + register: instance +- name: verify cleanup instance + assert: + that: + - instance is successful + +- name: cleanup network + cs_network: + name: "net_nic" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: net +- name: verify cleanup network + assert: + that: + - net is successful + +- name: cleanup network 2 + cs_network: + name: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: net +- name: verify cleanup network 2 + assert: + that: + - net is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic_secondaryip/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic_secondaryip/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic_secondaryip/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic_secondaryip/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic_secondaryip/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic_secondaryip/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic_secondaryip/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic_secondaryip/tasks/main.yml new file mode 100644 index 00000000..22241e64 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_nic_secondaryip/tasks/main.yml @@ -0,0 +1,221 @@ +--- +- name: setup network + cs_network: + name: "net_nic" + zone: "{{ cs_common_zone_adv }}" + network_offering: DefaultSharedNetworkOffering + network_domain: example.com + vlan: "1234" + start_ip: 10.100.123.11 + end_ip: 10.100.123.250 + gateway: 10.100.123.1 + netmask: 255.255.255.0 + register: net +- name: verify setup network + assert: + that: + - net is successful + - net.name == "net_nic" + +- name: setup instance + cs_instance: + name: "instance-nic-vm" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + network: "net_nic" + state: stopped + register: instance +- name: verify setup instance + assert: + that: + - instance is successful + - instance.name == "instance-nic-vm" + - instance.state == "Stopped" + +- name: setup network 2 + cs_network: + name: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + network_offering: DefaultSharedNetworkOffering + network_domain: example.com + vlan: "1235" + start_ip: 10.100.124.11 + end_ip: 10.100.124.250 + gateway: 10.100.124.1 + netmask: 255.255.255.0 + register: net +- name: verify setup network 2 + assert: + that: + - net is successful + - net.name == "net_nic2" + +- name: setup nic + cs_instance_nic: + vm: "instance-nic-vm" + network: "net_nic2" + ip_address: 10.100.124.42 + zone: "{{ cs_common_zone_adv }}" + register: nic +- name: verify test create nic + assert: + that: + - nic is successful + - nic.ip_address == "10.100.124.42" + - nic.netmask == "255.255.255.0" + - nic.network == "net_nic2" + - nic.vm == "instance-nic-vm" + - nic.zone == "{{ cs_common_zone_adv }}" + - nic.mac_address is defined + +- name: setup remove secondary ip + cs_instance_nic_secondaryip: + vm: "instance-nic-vm" + network: "net_nic2" + vm_guest_ip: 10.100.124.43 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: sip +- name: verify setup remove secondary ip + assert: + that: + - sip is successful + +- name: test add secondary ip in check mode + cs_instance_nic_secondaryip: + vm: "instance-nic-vm" + network: "net_nic2" + vm_guest_ip: 10.100.124.43 + zone: "{{ cs_common_zone_adv }}" + check_mode: true + register: sip +- name: verify test add secondary ip in check mode + assert: + that: + - sip is successful + - sip is changed + - sip.network == "net_nic2" + - sip.vm == "instance-nic-vm" + - sip.zone == "{{ cs_common_zone_adv }}" + +- name: test add secondary ip + cs_instance_nic_secondaryip: + vm: "instance-nic-vm" + network: "net_nic2" + vm_guest_ip: 10.100.124.43 + zone: "{{ cs_common_zone_adv }}" + register: sip +- name: verify test add secondary ip + assert: + that: + - sip is successful + - sip is changed + - sip.vm_guest_ip == "10.100.124.43" + - sip.network == "net_nic2" + - sip.vm == "instance-nic-vm" + - sip.zone == "{{ cs_common_zone_adv }}" + +- name: test add secondary ip idempotence + cs_instance_nic_secondaryip: + vm: "instance-nic-vm" + network: "net_nic2" + vm_guest_ip: 10.100.124.43 + zone: "{{ cs_common_zone_adv }}" + register: sip +- name: verify test add secondary ip idempotence + assert: + that: + - sip is successful + - sip is not changed + - sip.vm_guest_ip == "10.100.124.43" + - sip.network == "net_nic2" + - sip.vm == "instance-nic-vm" + - sip.zone == "{{ cs_common_zone_adv }}" + +- name: test remove secondary ip in check mode + cs_instance_nic_secondaryip: + vm: "instance-nic-vm" + network: "net_nic2" + vm_guest_ip: 10.100.124.43 + zone: "{{ cs_common_zone_adv }}" + state: absent + check_mode: true + register: sip +- name: verify test remove secondary ip in check mode + assert: + that: + - sip is successful + - sip is changed + - sip.vm_guest_ip == "10.100.124.43" + - sip.network == "net_nic2" + - sip.vm == "instance-nic-vm" + - sip.zone == "{{ cs_common_zone_adv }}" + +- name: test remove secondary ip + cs_instance_nic_secondaryip: + vm: "instance-nic-vm" + network: "net_nic2" + vm_guest_ip: 10.100.124.43 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: sip +- name: verify test remove secondary ip + assert: + that: + - sip is successful + - sip is changed + - sip.vm_guest_ip == "10.100.124.43" + - sip.network == "net_nic2" + - sip.vm == "instance-nic-vm" + - sip.zone == "{{ cs_common_zone_adv }}" + +- name: test remove secondary ip idempotence + cs_instance_nic_secondaryip: + vm: "instance-nic-vm" + network: "net_nic2" + vm_guest_ip: 10.100.124.43 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: sip +- name: verify test remove secondary ip idempotence + assert: + that: + - sip is successful + - sip is not changed + - sip.network == "net_nic2" + - sip.vm == "instance-nic-vm" + - sip.zone == "{{ cs_common_zone_adv }}" + +- name: cleanup instance + cs_instance: + name: "instance-nic-vm" + zone: "{{ cs_common_zone_adv }}" + state: expunged + register: instance +- name: verify cleanup instance + assert: + that: + - instance is successful + +- name: cleanup network + cs_network: + name: "net_nic" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: net +- name: verify cleanup network + assert: + that: + - net is successful + +- name: cleanup network 2 + cs_network: + name: "net_nic2" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: net +- name: verify cleanup network 2 + assert: + that: + - net is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_password_reset/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_password_reset/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_password_reset/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_password_reset/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_password_reset/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_password_reset/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_password_reset/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_password_reset/tasks/main.yml new file mode 100644 index 00000000..8a9155b0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instance_password_reset/tasks/main.yml @@ -0,0 +1,94 @@ +--- +- name: reset without giving a VM + action: cs_instance_password_reset + ignore_errors: yes + 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 + cs_template: + name: "{{ cs_common_template }}" + template_filter: all + password_enabled: no + zone: "{{ cs_common_zone_adv }}" + +- name: cleanup test VM + cs_instance: + name: test-nopassword + zone: "{{ cs_common_zone_adv }}" + state: expunged + +- name: create test VM + cs_instance: + name: test-nopassword + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + state: started + register: testvm_nopass + until: testvm_nopass is success + retries: 12 + delay: 10 + +- name: stop test VM + cs_instance: + name: test-nopassword + zone: "{{ cs_common_zone_adv }}" + state: stopped + +- name: reset nopassword + cs_instance_password_reset: + vm: test-nopassword + zone: "{{ cs_common_zone_adv }}" + ignore_errors: yes + 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 + cs_template: + name: "{{ cs_common_template }}" + template_filter: all + password_enabled: yes + zone: "{{ cs_common_zone_adv }}" + +- name: cleanup test VM + cs_instance: + name: test-password + zone: "{{ cs_common_zone_adv }}" + state: expunged + +- name: create test VM + cs_instance: + name: test-password + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + state: started + +- name: stop test VM + cs_instance: + name: test-password + zone: "{{ cs_common_zone_adv }}" + state: stopped + +- name: reset password + cs_instance_password_reset: + vm: test-password + zone: "{{ cs_common_zone_adv }}" + register: reset3 +- name: verify that a password was set + assert: + that: + - reset3 is success + - reset3.password != '' + +- debug: + var: reset3.password diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instancegroup/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instancegroup/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instancegroup/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instancegroup/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instancegroup/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instancegroup/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instancegroup/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instancegroup/tasks/main.yml new file mode 100644 index 00000000..6ba31751 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_instancegroup/tasks/main.yml @@ -0,0 +1,79 @@ +--- +- name: setup + cs_instancegroup: name={{ cs_resource_prefix }}_ig state=absent + register: ig +- name: verify setup + assert: + that: + - ig is successful + +- name: test fail if missing name + action: cs_instancegroup + register: ig + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - ig is failed + - "ig.msg == 'missing required arguments: name'" + +- name: test present instance group in check mode + cs_instancegroup: name={{ cs_resource_prefix }}_ig + register: ig + check_mode: true +- name: verify results of create instance group in check mode + assert: + that: + - ig is successful + - ig is changed + +- name: test present instance group + cs_instancegroup: name={{ cs_resource_prefix }}_ig + register: ig +- name: verify results of create instance group + assert: + that: + - ig is successful + - ig is changed + - ig.name == "{{ cs_resource_prefix }}_ig" + +- name: test present instance group is idempotence + cs_instancegroup: name={{ cs_resource_prefix }}_ig + register: ig +- name: verify results present instance group is idempotence + assert: + that: + - ig is successful + - ig is not changed + - ig.name == "{{ cs_resource_prefix }}_ig" + +- name: test absent instance group in check mode + cs_instancegroup: name={{ cs_resource_prefix }}_ig state=absent + register: ig + check_mode: true +- name: verify results of absent instance group in check mode + assert: + that: + - ig is successful + - ig is changed + - ig.name == "{{ cs_resource_prefix }}_ig" + +- name: test absent instance group + cs_instancegroup: name={{ cs_resource_prefix }}_ig state=absent + register: ig +- name: verify results of absent instance group + assert: + that: + - ig is successful + - ig is changed + - ig.name == "{{ cs_resource_prefix }}_ig" + +- name: test absent instance group is idempotence + cs_instancegroup: name={{ cs_resource_prefix }}_ig state=absent + register: ig +- name: verify results of absent instance group is idempotence + assert: + that: + - ig is successful + - ig is not changed + - ig.name is undefined diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/tasks/main.yml new file mode 100644 index 00000000..48ccd023 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/tasks/main.yml @@ -0,0 +1,19 @@ +--- +- name: test fail vpc and network mutually exclusive + cs_ip_address: + network: "{{ cs_resource_prefix }}_net_vpc" + vpc: "foobar" + zone: "{{ cs_common_zone_adv }}" + ignore_errors: yes + register: ip_address +- name: verify test fail vpc and network mutually exclusive + assert: + that: + - ip_address is failed + - 'ip_address.msg == "parameters are mutually exclusive: vpc|network"' + +- name: run test for network setup + import_tasks: network.yml + +- name: run test for vpc setup + import_tasks: vpc.yml diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/tasks/network.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/tasks/network.yml new file mode 100644 index 00000000..e87ff972 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/tasks/network.yml @@ -0,0 +1,240 @@ +--- +- name: setup ensure the test network is absent + cs_network: + name: ipaddr_test_network + state: absent + zone: "{{ cs_common_zone_adv }}" + +- name: setup create the test network + cs_network: + name: ipaddr_test_network + network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService + state: present + zone: "{{ cs_common_zone_adv }}" + register: base_network +- name: setup verify create the test network + assert: + that: + - base_network is successful + +- name: setup instance to get network in implementation state + cs_instance: + name: "{{ cs_resource_prefix }}-vm-cs-ip-address" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + networks: + - "{{ base_network.name }}" + register: instance + until: instance is success + retries: 20 + delay: 5 +- name: verify instance setup + assert: + that: + - instance is successful + +- name: setup clean ip_address with tags + cs_ip_address: + state: absent + tags: + - key: unique_id + value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861" + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + +- name: setup associate ip_address for SNAT + cs_ip_address: + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + register: ip_address_snat + +- name: test associate ip_address in check mode + cs_ip_address: + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + check_mode: true + register: ip_address +- name: verify test associate ip_address in check mode + assert: + that: + - ip_address is successful + - ip_address is changed + +- name: test associate ip_address + cs_ip_address: + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + register: ip_address +- name: verify test associate ip_address + assert: + that: + - ip_address is successful + - ip_address is changed + - ip_address.ip_address is defined + +- name: test associate ip_address with tags in check mode + cs_ip_address: + network: ipaddr_test_network + tags: + - key: unique_id + value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861" + zone: "{{ cs_common_zone_adv }}" + register: ip_address_tag + check_mode: true +- name: verify test associate ip_address with tags in check mode + assert: + that: + - ip_address_tag is successful + - ip_address_tag is changed + +- name: test associate ip_address with tags + cs_ip_address: + network: ipaddr_test_network + tags: + - key: unique_id + value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861" + zone: "{{ cs_common_zone_adv }}" + register: ip_address_tag +- name: verify test associate ip_address with tags + assert: + that: + - ip_address_tag is successful + - ip_address_tag is changed + - ip_address_tag.ip_address is defined + - ip_address_tag.tags.0.key == "unique_id" + - ip_address_tag.tags.0.value == "adacd65e-7868-5ebf-9f8b-e6e0ea779861" + +- name: test associate ip_address with tags idempotence + cs_ip_address: + network: ipaddr_test_network + tags: + - key: unique_id + value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861" + zone: "{{ cs_common_zone_adv }}" + register: ip_address_tag +- name: verify test associate ip_address with tags idempotence + assert: + that: + - ip_address_tag is successful + - ip_address_tag is not changed + - ip_address_tag.ip_address is defined + - ip_address_tag.state == "Allocated" + - ip_address_tag.tags.0.key == "unique_id" + - ip_address_tag.tags.0.value == "adacd65e-7868-5ebf-9f8b-e6e0ea779861" + +- name: test disassiociate ip_address with missing param ip_address + cs_ip_address: + state: absent + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + ignore_errors: true + register: ip_address_err +- name: verify test disassiociate ip_address with missing param ip_address + assert: + that: + - ip_address_err is failed + - 'ip_address_err.msg == "state is absent but any of the following are missing: ip_address, tags"' + +- name: test disassociate ip_address in check mode + cs_ip_address: + state: absent + ip_address: "{{ ip_address.ip_address }}" + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + check_mode: true + register: ip_address +- name: verify test disassociate ip_address in check mode + assert: + that: + - ip_address is successful + - ip_address is changed + +- name: test disassociate ip_address + cs_ip_address: + state: absent + ip_address: "{{ ip_address.ip_address }}" + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + register: ip_address +- name: verify test disassociate ip_address + assert: + that: + - ip_address is successful + - ip_address is changed + +- name: test disassociate ip_address idempotence + cs_ip_address: + state: absent + ip_address: "{{ ip_address.ip_address }}" + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + register: ip_address +- name: verify test disassociate ip_address idempotence + assert: + that: + - ip_address is successful + - ip_address is not changed + +- name: test disassociate ip_address with tags with check mode + cs_ip_address: + state: absent + tags: + - key: unique_id + value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861" + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + check_mode: true + register: ip_address +- name: verify test disassociate ip_address with tags in check mode + assert: + that: + - ip_address is successful + - ip_address is changed + +- name: test disassociate ip_address with tags + cs_ip_address: + state: absent + tags: + - key: unique_id + value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861" + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + register: ip_address +- name: verify test disassociate ip_address with tags + assert: + that: + - ip_address is successful + - ip_address is changed + +- name: test disassociate ip_address with tags idempotence + cs_ip_address: + state: absent + tags: + - key: unique_id + value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861" + network: ipaddr_test_network + zone: "{{ cs_common_zone_adv }}" + register: ip_address +- name: verify test disassociate ip_address with tags idempotence + assert: + that: + - ip_address is successful + - ip_address is not changed + +- name: cleanup instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-cs-ip-address" + zone: "{{ cs_common_zone_adv }}" + state: expunged + register: instance +- name: verify instance cleanup + assert: + that: + - instance is successful + +- name: clean the test network + cs_network: + name: ipaddr_test_network + state: absent + zone: "{{ cs_common_zone_adv }}" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/tasks/vpc.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/tasks/vpc.yml new file mode 100644 index 00000000..3a089ebd --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_ip_address/tasks/vpc.yml @@ -0,0 +1,121 @@ +--- +- name: setup vpc + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc_ip_address" + cidr: 10.10.111.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify setup vpc + assert: + that: + - vpc is successful + +- name: setup clean ip_address with tags + cs_ip_address: + state: absent + vpc: "{{ cs_resource_prefix }}_vpc_ip_address" + tags: + - key: unique_id + value: "86cdce4c-dce7-11e8-8394-00262df3bf70" + zone: "{{ cs_common_zone_adv }}" + +- name: test associate ip_address in vpc with tags in check mode + cs_ip_address: + vpc: "{{ cs_resource_prefix }}_vpc_ip_address" + tags: + - key: unique_id + value: "86cdce4c-dce7-11e8-8394-00262df3bf70" + zone: "{{ cs_common_zone_adv }}" + register: ip_address_tag + check_mode: yes +- name: verify test associate ip_address in vpc with tags in check mode + assert: + that: + - ip_address_tag is successful + - ip_address_tag is changed + +- name: test associate ip_address in vpc with tags + cs_ip_address: + vpc: "{{ cs_resource_prefix }}_vpc_ip_address" + tags: + - key: unique_id + value: "86cdce4c-dce7-11e8-8394-00262df3bf70" + zone: "{{ cs_common_zone_adv }}" + register: ip_address_tag +- name: verify test associate ip_address in vpc with tags + assert: + that: + - ip_address_tag is successful + - ip_address_tag is changed + - ip_address_tag.ip_address is defined + - ip_address_tag.tags.0.key == "unique_id" + - ip_address_tag.tags.0.value == "86cdce4c-dce7-11e8-8394-00262df3bf70" + +- name: test associate ip_address in vpc with tags idempotence + cs_ip_address: + vpc: "{{ cs_resource_prefix }}_vpc_ip_address" + tags: + - key: unique_id + value: "86cdce4c-dce7-11e8-8394-00262df3bf70" + zone: "{{ cs_common_zone_adv }}" + register: ip_address_tag +- name: verify test associate ip_address in vpc with tags idempotence + assert: + that: + - ip_address_tag is successful + - ip_address_tag is not changed + - ip_address_tag.ip_address is defined + - ip_address_tag.state == "Allocated" + - ip_address_tag.tags.0.key == "unique_id" + - ip_address_tag.tags.0.value == "86cdce4c-dce7-11e8-8394-00262df3bf70" + +- name: test disassociate ip_address in vpc in check mode + cs_ip_address: + state: absent + ip_address: "{{ ip_address_tag.ip_address }}" + vpc: "{{ cs_resource_prefix }}_vpc_ip_address" + zone: "{{ cs_common_zone_adv }}" + check_mode: true + register: ip_address +- name: verify test disassociate ip_address in vpc in check mode + assert: + that: + - ip_address is successful + - ip_address is changed + +- name: test disassociate ip_address in vpc + cs_ip_address: + state: absent + ip_address: "{{ ip_address_tag.ip_address }}" + vpc: "{{ cs_resource_prefix }}_vpc_ip_address" + zone: "{{ cs_common_zone_adv }}" + register: ip_address +- name: verify test disassociate ip_address in vpc + assert: + that: + - ip_address is successful + - ip_address is changed + +- name: test disassociate ip_address in vpc idempotence + cs_ip_address: + state: absent + ip_address: "{{ ip_address_tag.ip_address }}" + vpc: "{{ cs_resource_prefix }}_vpc_ip_address" + zone: "{{ cs_common_zone_adv }}" + register: ip_address +- name: verify test disassociate ip_address in vpc idempotence + assert: + that: + - ip_address is successful + - ip_address is not changed + +- name: cleanup vpc + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc_ip_address" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpc +- name: verify cleanup vpc + assert: + that: + - vpc is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/tasks/main.yml new file mode 100644 index 00000000..de279224 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/tasks/main.yml @@ -0,0 +1,143 @@ +--- +- name: setup iso + cs_iso: + name: "{{ cs_resource_prefix }}-iso" + cross_zones: true + state: absent + register: iso +- name: verify setup iso + assert: + that: + - iso is successful + +- name: test download iso in check mode + cs_iso: + name: "{{ cs_resource_prefix }}-iso" + url: "{{ cs_iso_url }}" + os_type: Debian GNU/Linux 7(64-bit) + cross_zones: true + register: iso + check_mode: true +- name: verify test download iso in check mode + assert: + that: + - iso is changed + +- name: test download iso + cs_iso: + name: "{{ cs_resource_prefix }}-iso" + url: "{{ cs_iso_url }}" + os_type: Debian GNU/Linux 7(64-bit) + cross_zones: true + register: iso +- name: verify test download iso + assert: + that: + - iso is changed + - iso.name == "{{ cs_resource_prefix }}-iso" + - iso.display_text == "{{ cs_resource_prefix }}-iso" + - iso.cross_zones == true + +- name: test download iso idempotence + cs_iso: + name: "{{ cs_resource_prefix }}-iso" + url: "{{ cs_iso_url }}" + os_type: Debian GNU/Linux 7(64-bit) + cross_zones: true + register: iso +- name: verify test download iso idempotence + assert: + that: + - iso is not changed + - iso.name == "{{ cs_resource_prefix }}-iso" + - iso.display_text == "{{ cs_resource_prefix }}-iso" + - iso.cross_zones == true + +- name: test update iso in check mdoe + cs_iso: + name: "{{ cs_resource_prefix }}-iso" + display_text: "{{ cs_resource_prefix }}-iso display_text" + url: "{{ cs_iso_url }}" + os_type: CentOS 7 + cross_zones: true + register: iso + check_mode: true +- name: verify test update iso in check mode + assert: + that: + - iso is changed + - iso.name == "{{ cs_resource_prefix }}-iso" + - iso.display_text == "{{ cs_resource_prefix }}-iso" + - iso.cross_zones == true + +- name: test update iso + cs_iso: + name: "{{ cs_resource_prefix }}-iso" + display_text: "{{ cs_resource_prefix }}-iso display_text" + url: "{{ cs_iso_url }}" + os_type: CentOS 7 + cross_zones: true + register: iso +- name: verify test update iso + assert: + that: + - iso is changed + - iso.name == "{{ cs_resource_prefix }}-iso" + - iso.display_text == "{{ cs_resource_prefix }}-iso display_text" + - iso.cross_zones == true + +- name: test update iso idempotence + cs_iso: + name: "{{ cs_resource_prefix }}-iso" + display_text: "{{ cs_resource_prefix }}-iso display_text" + url: "{{ cs_iso_url }}" + os_type: CentOS 7 + cross_zones: true + register: iso +- name: verify test update iso idempotence + assert: + that: + - iso is not changed + - iso.name == "{{ cs_resource_prefix }}-iso" + - iso.display_text == "{{ cs_resource_prefix }}-iso display_text" + - iso.cross_zones == true + +- name: test remove iso in check mode + cs_iso: + name: "{{ cs_resource_prefix }}-iso" + state: absent + cross_zones: true + register: iso + check_mode: true +- name: verify test remove iso in check mode + assert: + that: + - iso is changed + - iso.name == "{{ cs_resource_prefix }}-iso" + - iso.display_text == "{{ cs_resource_prefix }}-iso display_text" + - iso.cross_zones == true + +- name: test remove iso + cs_iso: + name: "{{ cs_resource_prefix }}-iso" + state: absent + cross_zones: true + register: iso +- name: verify test remove iso + assert: + that: + - iso is changed + - iso.name == "{{ cs_resource_prefix }}-iso" + - iso.display_text == "{{ cs_resource_prefix }}-iso display_text" + - iso.cross_zones == true + +- name: test remove iso idempotence + cs_iso: + name: "{{ cs_resource_prefix }}-iso" + state: absent + cross_zones: true + register: iso +- name: verify test remove iso idempotence + assert: + that: + - iso is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/vars/main b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/vars/main new file mode 100644 index 00000000..1670b14c --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_iso/vars/main @@ -0,0 +1,2 @@ +--- +cs_iso_url: https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.6.0-amd64-netinst.iso diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_loadbalancer_rule/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_loadbalancer_rule/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_loadbalancer_rule/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_loadbalancer_rule/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_loadbalancer_rule/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_loadbalancer_rule/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_loadbalancer_rule/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_loadbalancer_rule/tasks/main.yml new file mode 100644 index 00000000..13d2f005 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_loadbalancer_rule/tasks/main.yml @@ -0,0 +1,392 @@ +--- +- name: ensure instance is expunged + cs_instance: + name: "{{ cs_resource_prefix }}-vm-lb" + zone: "{{ cs_common_zone_adv }}" + state: expunged + register: instance +- name: verify ensure instance is expunged + assert: + that: + - instance is successful + +- name: ensure network is absent + cs_network: + name: "{{ cs_resource_prefix }}_net_lb" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: lb_net +- name: verify ensure network is absent + assert: + that: + - lb_net is successful + +- name: test create network for lb + cs_network: + name: "{{ cs_resource_prefix }}_net_lb" + zone: "{{ cs_common_zone_adv }}" + network_offering: Offering for Isolated networks with Source Nat service enabled + register: lb_net +- name: verify test create network for lb + assert: + that: + - lb_net is successful + - lb_net is changed + - lb_net.name == "{{ cs_resource_prefix }}_net_lb" + +- name: setup instance in lb + cs_instance: + name: "{{ cs_resource_prefix }}-vm-lb" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + network: "{{ cs_resource_prefix }}_net_lb" + register: instance + until: instance is success + retries: 20 + delay: 5 +- name: verify setup instance in lb + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-lb" + - instance.state == "Running" + +- name: setup get ip address for lb + cs_ip_address: + network: "{{ cs_resource_prefix }}_net_lb" + zone: "{{ cs_common_zone_adv }}" + register: ip_address +- name: verify setup get ip address in lb + assert: + that: + - ip_address is successful + +- name: setup lb rule absent + cs_loadbalancer_rule: + name: "{{ cs_resource_prefix }}_lb" + public_ip: "{{ ip_address.ip_address }}" + state: absent + register: lb +- name: verify setup lb rule absent + assert: + that: + - lb is successful + +- name: test rule requires params + cs_loadbalancer_rule: + ignore_errors: true + register: lb +- name: verify test rule requires params + assert: + that: + - lb is failed + - "lb.msg.startswith('missing required arguments: ')" + + +- name: test create rule in check mode + cs_loadbalancer_rule: + name: "{{ cs_resource_prefix }}_lb" + public_ip: "{{ ip_address.ip_address }}" + algorithm: roundrobin + public_port: 80 + private_port: 8080 + register: lb + check_mode: true +- name: verify test create rule in check mode + assert: + that: + - lb is successful + - lb is changed + +- name: test create rule + cs_loadbalancer_rule: + name: "{{ cs_resource_prefix }}_lb" + public_ip: "{{ ip_address.ip_address }}" + algorithm: roundrobin + public_port: 80 + private_port: 8080 + register: lb +- name: verify test create rule + assert: + that: + - lb is successful + - lb is changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "roundrobin" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + +- name: test create rule idempotence + cs_loadbalancer_rule: + name: "{{ cs_resource_prefix }}_lb" + public_ip: "{{ ip_address.ip_address }}" + algorithm: roundrobin + public_port: 80 + private_port: 8080 + register: lb +- name: verify test create rule idempotence + assert: + that: + - lb is successful + - lb is not changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "roundrobin" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + +- name: test update rule in check mode + cs_loadbalancer_rule: + name: "{{ cs_resource_prefix }}_lb" + public_ip: "{{ ip_address.ip_address }}" + algorithm: source + public_port: 80 + private_port: 8080 + register: lb + check_mode: true +- name: verify test update rule in check mode + assert: + that: + - lb is successful + - lb is changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "roundrobin" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + +- name: test update rule + cs_loadbalancer_rule: + name: "{{ cs_resource_prefix }}_lb" + public_ip: "{{ ip_address.ip_address }}" + algorithm: source + public_port: 80 + private_port: 8080 + register: lb +- name: verify test update rule + assert: + that: + - lb is successful + - lb is changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "source" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + +- name: test update rule idempotence + cs_loadbalancer_rule: + name: "{{ cs_resource_prefix }}_lb" + public_ip: "{{ ip_address.ip_address }}" + algorithm: source + public_port: 80 + private_port: 8080 + register: lb +- name: verify test update rule idempotence + assert: + that: + - lb is successful + - lb is not changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "source" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + +- name: test rule member requires params + cs_loadbalancer_rule_member: + ignore_errors: true + register: lb +- name: verify test rule requires params + assert: + that: + - lb is failed + - "lb.msg.startswith('missing required arguments: ')" + +- name: test add members to rule in check mode + cs_loadbalancer_rule_member: + name: "{{ cs_resource_prefix }}_lb" + vm: "{{ cs_resource_prefix }}-vm-lb" + register: lb + check_mode: true +- name: verify add members to rule in check mode + assert: + that: + - lb is successful + - lb is changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "source" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + - "'{{ cs_resource_prefix }}-vm-lb' not in lb.vms" + +- name: test add members to rule + cs_loadbalancer_rule_member: + name: "{{ cs_resource_prefix }}_lb" + vm: "{{ cs_resource_prefix }}-vm-lb" + register: lb +- name: verify add members to rule + assert: + that: + - lb is successful + - lb is changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "source" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + - "'{{ cs_resource_prefix }}-vm-lb' in lb.vms" + +- name: test add members to rule idempotence + cs_loadbalancer_rule_member: + name: "{{ cs_resource_prefix }}_lb" + vm: "{{ cs_resource_prefix }}-vm-lb" + register: lb +- name: verify add members to rule idempotence + assert: + that: + - lb is successful + - lb is not changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "source" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + - "'{{ cs_resource_prefix }}-vm-lb' in lb.vms" + +- name: test remove members to rule in check mode + cs_loadbalancer_rule_member: + name: "{{ cs_resource_prefix }}_lb" + vm: "{{ cs_resource_prefix }}-vm-lb" + state: absent + register: lb + check_mode: true +- name: verify remove members to rule in check mode + assert: + that: + - lb is successful + - lb is changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "source" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + - "'{{ cs_resource_prefix }}-vm-lb' in lb.vms" + +- name: test remove members to rule + cs_loadbalancer_rule_member: + name: "{{ cs_resource_prefix }}_lb" + vm: "{{ cs_resource_prefix }}-vm-lb" + state: absent + register: lb +- name: verify remove members to rule + assert: + that: + - lb is successful + - lb is changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "source" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + - "'{{ cs_resource_prefix }}-vm-lb' not in lb.vms" + +- name: test remove members to rule idempotence + cs_loadbalancer_rule_member: + name: "{{ cs_resource_prefix }}_lb" + vm: "{{ cs_resource_prefix }}-vm-lb" + state: absent + register: lb +- name: verify remove members to rule + assert: + that: + - lb is successful + - lb is not changed + +- name: test remove rule in check mode + cs_loadbalancer_rule: + name: "{{ cs_resource_prefix }}_lb" + public_ip: "{{ ip_address.ip_address }}" + state: absent + register: lb + check_mode: true +- name: verify remove rule in check mode + assert: + that: + - lb is successful + - lb is changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "source" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + +- name: test remove rule + cs_loadbalancer_rule: + name: "{{ cs_resource_prefix }}_lb" + public_ip: "{{ ip_address.ip_address }}" + state: absent + register: lb +- name: verify remove rule + assert: + that: + - lb is successful + - lb is changed + - lb.name == "{{ cs_resource_prefix }}_lb" + - lb.algorithm == "source" + - lb.public_ip == "{{ ip_address.ip_address }}" + - lb.public_port == 80 + - lb.private_port == 8080 + +- name: test remove rule idempotence + cs_loadbalancer_rule: + name: "{{ cs_resource_prefix }}_lb" + public_ip: "{{ ip_address.ip_address }}" + state: absent + register: lb +- name: verify remove rule idempotence + assert: + that: + - lb is successful + - lb is not changed + +- name: cleanup ip address + cs_ip_address: + network: "{{ cs_resource_prefix }}_net_lb" + zone: "{{ cs_common_zone_adv }}" + ip_address: "{{ ip_address.ip_address }}" + state: absent + register: ip_address +- name: verify cleanup ip address + assert: + that: + - ip_address is successful + - instance is changed + +- name: cleanup instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-lb" + zone: "{{ cs_common_zone_adv }}" + state: expunged + register: instance +- name: verify cleanup instance + assert: + that: + - instance is successful + - instance is changed + +- name: cleanup network + cs_network: + name: "{{ cs_resource_prefix }}_net_lb" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: lb_net +- name: verify cleanup network + assert: + that: + - lb_net is successful + - lb_net is changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/tasks/main.yml new file mode 100644 index 00000000..cfe24c41 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/tasks/main.yml @@ -0,0 +1,3 @@ +--- + +- include_tasks: vpc_network_tier.yml diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/tasks/vpc_network_tier.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/tasks/vpc_network_tier.yml new file mode 100644 index 00000000..4854cae9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network/tasks/vpc_network_tier.yml @@ -0,0 +1,299 @@ +--- +- name: setup cleanup vpc network tier + cs_network: + name: vpc tier 1 + zone: "{{ cs_common_zone_adv }}" + vpc: vpc_network_test + state: absent + ignore_errors: yes + +- name: setup cleanup existing vpc + cs_vpc: + name: vpc_network_test + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpc +- name: verify cleanup existing vpc + assert: + that: + - vpc is successful + +- name: setup vpc + cs_vpc: + name: vpc_network_test + cidr: 10.43.0.0/16 + zone: "{{ cs_common_zone_adv }}" + vpc_offering: Redundant VPC offering + network_domain: cs2sandbox.simulator.example.com + register: vpc +- name: verify setup vpc + assert: + that: + - vpc is successful + +- name: setup network acl + cs_network_acl: + name: my_network_acl1 + vpc: vpc_network_test + zone: "{{ cs_common_zone_adv }}" + register: acl +- name: verify setup network acl + assert: + that: + - acl is successful + +- name: setup network acl rule + cs_network_acl_rule: + network_acl: my_network_acl1 + rule_position: 1 + vpc: vpc_network_test + traffic_type: ingress + action_policy: allow + port: 80 + cidr: 0.0.0.0/0 + zone: "{{ cs_common_zone_adv }}" + register: acl_rule +- name: verify setup network acl rule + assert: + that: + - acl_rule is successful + +- name: setup vpc network tier + cs_network: + name: vpc tier 1 + zone: "{{ cs_common_zone_adv }}" + vpc: vpc_network_test + state: absent + register: network +- name: verify setup vpc network tier + assert: + that: + - network is successful + +- name: test fail vpc network tier if vpc not given + cs_network: + name: vpc tier 1 + zone: "{{ cs_common_zone_adv }}" + network_domain: cs2sandbox.simulator.example.com + network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks + gateway: 10.43.0.1 + netmask: 255.255.255.0 + acl: my_network_acl1 + check_mode: yes + register: network + ignore_errors: yes +- name: verify test fail vpc network tier if vpc not given + assert: + that: + - network is failed + - "network.msg == 'Missing required params: vpc'" + +- name: test create a vpc network tier in check mode + cs_network: + name: vpc tier 1 + zone: "{{ cs_common_zone_adv }}" + network_domain: cs2sandbox.simulator.example.com + vpc: vpc_network_test + network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks + gateway: 10.43.0.1 + netmask: 255.255.255.0 + check_mode: yes + register: network +- name: verify test create a vpc network tier in check mode + assert: + that: + - network is changed + +- name: test create a vpc network tier + cs_network: + name: vpc tier 1 + zone: "{{ cs_common_zone_adv }}" + network_domain: cs2sandbox.simulator.example.com + vpc: vpc_network_test + network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks + gateway: 10.43.0.1 + netmask: 255.255.255.0 + register: network +- name: verify test create a vpc network tier + assert: + that: + - network is changed + - network.acl_type == 'Account' + - not network.acl + - network.broadcast_domain_type == 'Vlan' + - network.cidr == '10.43.0.0/24' + - network.gateway == '10.43.0.1' + - network.display_text == 'vpc tier 1' + - network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks' + - network.vpc == 'vpc_network_test' + - network.network_domain == 'cs2sandbox.simulator.example.com' + +- name: test create a vpc network tier idempotence + cs_network: + name: vpc tier 1 + zone: "{{ cs_common_zone_adv }}" + network_domain: cs2sandbox.simulator.example.com + vpc: vpc_network_test + network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks + gateway: 10.43.0.1 + netmask: 255.255.255.0 + register: network +- name: verify test create a vpc network tier idempotence + assert: + that: + - network is not changed + - network.acl_type == 'Account' + - not network.acl + - network.broadcast_domain_type == 'Vlan' + - network.cidr == '10.43.0.0/24' + - network.gateway == '10.43.0.1' + - network.display_text == 'vpc tier 1' + - network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks' + - network.vpc == 'vpc_network_test' + - network.network_domain == 'cs2sandbox.simulator.example.com' + +- name: test update a vpc network tier in check mode + cs_network: + name: vpc tier 1 + display_text: vpc tier 1 description + zone: "{{ cs_common_zone_adv }}" + network_domain: cs2sandbox.simulator.example.com + vpc: vpc_network_test + network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks + gateway: 10.43.0.1 + netmask: 255.255.255.0 + acl: my_network_acl1 + check_mode: yes + register: network +- name: verify test update a vpc network tier in check mode + assert: + that: + - network is changed + - network.acl_type == 'Account' + - network.acl == 'my_network_acl1' + - network.broadcast_domain_type == 'Vlan' + - network.cidr == '10.43.0.0/24' + - network.gateway == '10.43.0.1' + - network.display_text == 'vpc tier 1' + - network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks' + - network.vpc == 'vpc_network_test' + - network.network_domain == 'cs2sandbox.simulator.example.com' + +- name: test update a vpc network tier + cs_network: + name: vpc tier 1 + display_text: vpc tier 1 description + zone: "{{ cs_common_zone_adv }}" + network_domain: cs2sandbox.simulator.example.com + vpc: vpc_network_test + network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks + gateway: 10.43.0.1 + netmask: 255.255.255.0 + acl: my_network_acl1 + register: network +- name: verify test update a vpc network tier + assert: + that: + - network is changed + - network.acl_type == 'Account' + - network.acl == 'my_network_acl1' + - network.broadcast_domain_type == 'Vlan' + - network.cidr == '10.43.0.0/24' + - network.gateway == '10.43.0.1' + - network.display_text == 'vpc tier 1 description' + - network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks' + - network.vpc == 'vpc_network_test' + - network.network_domain == 'cs2sandbox.simulator.example.com' + +- name: test update a vpc network tier idempotence + cs_network: + name: vpc tier 1 + display_text: vpc tier 1 description + zone: "{{ cs_common_zone_adv }}" + network_domain: cs2sandbox.simulator.example.com + vpc: vpc_network_test + network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks + gateway: 10.43.0.1 + netmask: 255.255.255.0 + acl: my_network_acl1 + register: network +- name: verify test update a vpc network tier idempotence + assert: + that: + - network is not changed + - network.acl_type == 'Account' + - network.acl == 'my_network_acl1' + - network.broadcast_domain_type == 'Vlan' + - network.cidr == '10.43.0.0/24' + - network.gateway == '10.43.0.1' + - network.display_text == 'vpc tier 1 description' + - network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks' + - network.vpc == 'vpc_network_test' + - network.network_domain == 'cs2sandbox.simulator.example.com' + +- name: test absent a vpc network tier in check mode + cs_network: + name: vpc tier 1 + zone: "{{ cs_common_zone_adv }}" + vpc: vpc_network_test + state: absent + register: network + check_mode: yes +- name: verify test absent a vpc network tier in check mode + assert: + that: + - network is changed + - network.acl_type == 'Account' + - network.acl == 'my_network_acl1' + - network.broadcast_domain_type == 'Vlan' + - network.cidr == '10.43.0.0/24' + - network.gateway == '10.43.0.1' + - network.display_text == 'vpc tier 1 description' + - network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks' + - network.vpc == 'vpc_network_test' + - network.network_domain == 'cs2sandbox.simulator.example.com' + +- name: test absent a vpc network tier + cs_network: + name: vpc tier 1 + zone: "{{ cs_common_zone_adv }}" + vpc: vpc_network_test + state: absent + register: network +- name: verify test absent a vpc network tier + assert: + that: + - network is changed + - network.acl_type == 'Account' + - network.acl == 'my_network_acl1' + - network.broadcast_domain_type == 'Vlan' + - network.cidr == '10.43.0.0/24' + - network.gateway == '10.43.0.1' + - network.display_text == 'vpc tier 1 description' + - network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks' + - network.vpc == 'vpc_network_test' + - network.network_domain == 'cs2sandbox.simulator.example.com' + +- name: test absent a vpc network tier idempotence + cs_network: + name: vpc tier 1 + zone: "{{ cs_common_zone_adv }}" + vpc: vpc_network_test + state: absent + register: network +- name: verify test absent a vpc network tier idempotence + assert: + that: + - network is not changed + +- name: cleanup vpc + cs_vpc: + name: vpc_network_test + cidr: 10.43.0.0/16 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpc +- name: verify cleanup vpc + assert: + that: + - vpc is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl/tasks/main.yml new file mode 100644 index 00000000..7104a7cb --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl/tasks/main.yml @@ -0,0 +1,120 @@ +--- +- name: setup vpc + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text" + cidr: 10.10.0.0/16 + vpc_offering: Redundant VPC offering + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify setup vpc + assert: + that: + - vpc is successful + +- name: setup network acl absent + cs_network_acl: + name: "{{ cs_resource_prefix }}_acl" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: acl +- name: verify setup network acl absent + assert: + that: + - acl is successful + +- name: test fail missing param name and vpc for network acl + cs_network_acl: + ignore_errors: true + register: acl +- name: verify test fail missing param name and vpc for network acl + assert: + that: + - acl is failed + - "acl.msg.startswith('missing required arguments: ')" + +- name: test create network acl in check mode + cs_network_acl: + name: "{{ cs_resource_prefix }}_acl" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: acl + check_mode: true +- name: verify test create network acl in check mode + assert: + that: + - acl is successful + - acl is changed + +- name: test create network acl + cs_network_acl: + name: "{{ cs_resource_prefix }}_acl" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: acl +- name: verify test create network acl + assert: + that: + - acl is successful + - acl is changed + - acl.vpc == "{{ cs_resource_prefix }}_vpc" + - acl.name == "{{ cs_resource_prefix }}_acl" + +- name: test create network acl idempotence + cs_network_acl: + name: "{{ cs_resource_prefix }}_acl" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: acl +- name: verify test create network acl idempotence + assert: + that: + - acl is successful + - acl is not changed + - acl.vpc == "{{ cs_resource_prefix }}_vpc" + - acl.name == "{{ cs_resource_prefix }}_acl" + +- name: test remove network acl in check mode + cs_network_acl: + name: "{{ cs_resource_prefix }}_acl" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: acl + check_mode: true +- name: verify test remove network acl in check mode + assert: + that: + - acl is successful + - acl is changed + - acl.vpc == "{{ cs_resource_prefix }}_vpc" + - acl.name == "{{ cs_resource_prefix }}_acl" + +- name: test remove network acl + cs_network_acl: + name: "{{ cs_resource_prefix }}_acl" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: acl +- name: verify test remove network acl + assert: + that: + - acl is successful + - acl is changed + - acl.vpc == "{{ cs_resource_prefix }}_vpc" + - acl.name == "{{ cs_resource_prefix }}_acl" + +- name: test remove network acl idempotence + cs_network_acl: + name: "{{ cs_resource_prefix }}_acl" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: acl +- name: verify test remove network acl idempotence + assert: + that: + - acl is successful + - acl is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl_rule/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl_rule/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl_rule/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl_rule/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl_rule/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl_rule/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl_rule/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl_rule/tasks/main.yml new file mode 100644 index 00000000..06f5f5ae --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_acl_rule/tasks/main.yml @@ -0,0 +1,548 @@ +--- +- name: setup vpc + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify setup vpc + assert: + that: + - vpc is successful + +- name: setup network acl + cs_network_acl: + name: "{{ cs_resource_prefix }}_acl" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: acl +- name: verify setup network acl + assert: + that: + - acl is successful + +- name: setup network acl rule + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: acl_rule +- name: verify setup network acl rule + assert: + that: + - acl_rule is successful + +- name: test fail missing params + cs_network_acl_rule: + ignore_errors: true + register: acl_rule +- name: verify test fail missing param + assert: + that: + - acl_rule is failed + - "acl_rule.msg.startswith('missing required arguments: ')" + +- name: test fail missing params for tcp + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: ingress + action_policy: allow + cidr: 0.0.0.0/0 + zone: "{{ cs_common_zone_adv }}" + ignore_errors: true + register: acl_rule +- name: verify test fail missing param for tcp + assert: + that: + - acl_rule is failed + - "acl_rule.msg == 'protocol is tcp but the following are missing: start_port, end_port'" + +- name: test fail missing params for icmp + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: ingress + action_policy: allow + cidr: 0.0.0.0/0 + protocol: icmp + zone: "{{ cs_common_zone_adv }}" + ignore_errors: true + register: acl_rule +- name: verify test fail missing param for icmp + assert: + that: + - acl_rule is failed + - "acl_rule.msg == 'protocol is icmp but the following are missing: icmp_type, icmp_code'" + +- name: test fail missing params for by number + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: ingress + action_policy: allow + cidr: 0.0.0.0/0 + protocol: by_number + zone: "{{ cs_common_zone_adv }}" + ignore_errors: true + register: acl_rule +- name: verify test fail missing param for by number + assert: + that: + - acl_rule is failed + - "acl_rule.msg == 'protocol is by_number but the following are missing: protocol_number'" + +- name: test create network acl rule in check mode + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: ingress + action_policy: allow + port: 80 + cidr: 0.0.0.0/0 + zone: "{{ cs_common_zone_adv }}" + register: acl_rule + check_mode: true +- name: verify test create network acl rule in check mode + assert: + that: + - acl_rule is successful + - acl_rule is changed + +- name: test create network acl rule + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: ingress + action_policy: allow + port: 80 + cidr: 0.0.0.0/0 + zone: "{{ cs_common_zone_adv }}" + register: acl_rule +- name: verify test create network acl rule + assert: + that: + - acl_rule is successful + - acl_rule is changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.start_port == 80 + - acl_rule.end_port == 80 + - acl_rule.action_policy == "allow" + - acl_rule.cidr == "0.0.0.0/0" + - acl_rule.traffic_type == "ingress" + - acl_rule.rule_position == 1 + +- name: test create network acl rule idempotence + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: ingress + action_policy: allow + port: 80 + cidr: 0.0.0.0/0 + zone: "{{ cs_common_zone_adv }}" + register: acl_rule +- name: verify test create network acl idempotence + assert: + that: + - acl_rule is successful + - acl_rule is not changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.start_port == 80 + - acl_rule.end_port == 80 + - acl_rule.action_policy == "allow" + - acl_rule.cidr == "0.0.0.0/0" + - acl_rule.traffic_type == "ingress" + - acl_rule.rule_position == 1 + +- name: test change network acl rule in check mode + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: deny + port: 81 + cidrs: + - 1.2.3.0/24 + - 3.2.1.0/24 + zone: "{{ cs_common_zone_adv }}" + register: acl_rule + check_mode: true +- name: verify test change network acl rule in check mode + assert: + that: + - acl_rule is successful + - acl_rule is changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.start_port == 80 + - acl_rule.end_port == 80 + - acl_rule.action_policy == "allow" + - acl_rule.cidr == "0.0.0.0/0" + - acl_rule.cidrs == [ "0.0.0.0/0" ] + - acl_rule.traffic_type == "ingress" + - acl_rule.rule_position == 1 + +- name: test change network acl rule + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: deny + port: 81 + protocol: udp + cidrs: + - 1.2.3.0/24 + - 3.2.1.0/24 + zone: "{{ cs_common_zone_adv }}" + register: acl_rule +- name: verify test change network acl rule + assert: + that: + - acl_rule is successful + - acl_rule is changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.start_port == 81 + - acl_rule.end_port == 81 + - acl_rule.action_policy == "deny" + - acl_rule.cidr == "1.2.3.0/24,3.2.1.0/24" + - acl_rule.cidrs == [ "1.2.3.0/24", "3.2.1.0/24" ] + - acl_rule.traffic_type == "egress" + - acl_rule.protocol == "udp" + - acl_rule.rule_position == 1 + +- name: test change network acl rule idempotence + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: deny + port: 81 + protocol: udp + cidrs: + - 1.2.3.0/24 + - 3.2.1.0/24 + zone: "{{ cs_common_zone_adv }}" + register: acl_rule +- name: verify test change network acl idempotence + assert: + that: + - acl_rule is successful + - acl_rule is not changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.start_port == 81 + - acl_rule.end_port == 81 + - acl_rule.action_policy == "deny" + - acl_rule.cidr == "1.2.3.0/24,3.2.1.0/24" + - acl_rule.cidrs == [ "1.2.3.0/24", "3.2.1.0/24" ] + - acl_rule.traffic_type == "egress" + - acl_rule.protocol == "udp" + - acl_rule.rule_position == 1 + +- name: test change network acl by protocol number in check mode + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: deny + protocol: by_number + protocol_number: 8 + port: 81 + cidr: 0.0.0.0/0 + zone: "{{ cs_common_zone_adv }}" + register: acl_rule + check_mode: true +- name: verify test change network acl by protocol number in check mode + assert: + that: + - acl_rule is successful + - acl_rule is changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.start_port == 81 + - acl_rule.end_port == 81 + - acl_rule.action_policy == "deny" + - acl_rule.cidr == "1.2.3.0/24,3.2.1.0/24" + - acl_rule.traffic_type == "egress" + - acl_rule.protocol == "udp" + - acl_rule.rule_position == 1 + +- name: test change network acl by protocol number + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: deny + protocol: by_number + protocol_number: 8 + port: 81 + cidr: 0.0.0.0/0 + zone: "{{ cs_common_zone_adv }}" + register: acl_rule +- name: verify test change network acl by protocol number + assert: + that: + - acl_rule is successful + - acl_rule is changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.start_port == 81 + - acl_rule.end_port == 81 + - acl_rule.action_policy == "deny" + - acl_rule.cidr == "0.0.0.0/0" + - acl_rule.traffic_type == "egress" + - acl_rule.protocol == "by_number" + - acl_rule.protocol_number == 8 + - acl_rule.rule_position == 1 + +- name: test change network acl by protocol number idempotence + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: deny + protocol: by_number + protocol_number: 8 + port: 81 + cidr: 0.0.0.0/0 + zone: "{{ cs_common_zone_adv }}" + register: acl_rule +- name: verify test change network acl by protocol number idempotence + assert: + that: + - acl_rule is successful + - acl_rule is not changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.start_port == 81 + - acl_rule.end_port == 81 + - acl_rule.action_policy == "deny" + - acl_rule.cidr == "0.0.0.0/0" + - acl_rule.traffic_type == "egress" + - acl_rule.protocol == "by_number" + - acl_rule.protocol_number == 8 + - acl_rule.rule_position == 1 + + +- name: test create 2nd network acl rule in check mode + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 2 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: allow + cidr: 10.23.12.0/24 + zone: "{{ cs_common_zone_adv }}" + protocol: all + register: acl_rule + check_mode: true +- name: verify test create 2nd network acl rule in check mode + assert: + that: + - acl_rule is successful + - acl_rule is changed + +- name: test create 2nd network acl rule + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 2 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: allow + cidr: 10.23.12.0/24 + zone: "{{ cs_common_zone_adv }}" + protocol: all + register: acl_rule +- name: verify test create 2nd network acl rule + assert: + that: + - acl_rule is successful + - acl_rule is changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.action_policy == "allow" + - acl_rule.cidr == "10.23.12.0/24" + - acl_rule.traffic_type == "egress" + - acl_rule.protocol == "all" + - acl_rule.rule_position == 2 + +- name: test create 2nd network acl rule idempotence + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 2 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: allow + cidr: 10.23.12.0/24 + zone: "{{ cs_common_zone_adv }}" + protocol: all + register: acl_rule +- name: verify test create 2nd network acl rule idempotence + assert: + that: + - acl_rule is successful + - acl_rule is not changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.action_policy == "allow" + - acl_rule.cidr == "10.23.12.0/24" + - acl_rule.traffic_type == "egress" + - acl_rule.protocol == "all" + - acl_rule.rule_position == 2 + +- name: test update 2nd network acl rule to icmp + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 2 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: allow + cidr: 10.23.12.0/24 + zone: "{{ cs_common_zone_adv }}" + protocol: icmp + icmp_type: 0 + icmp_code: 8 + register: acl_rule +- name: verify test create 2nd network acl rule + assert: + that: + - acl_rule is successful + - acl_rule is changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.action_policy == "allow" + - acl_rule.cidr == "10.23.12.0/24" + - acl_rule.traffic_type == "egress" + - acl_rule.protocol == "icmp" + - acl_rule.icmp_type == 0 + - acl_rule.icmp_code == 8 + - acl_rule.rule_position == 2 + +- name: test update 2nd network acl rule to icmp idempotence + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 2 + vpc: "{{ cs_resource_prefix }}_vpc" + traffic_type: egress + action_policy: allow + cidr: 10.23.12.0/24 + zone: "{{ cs_common_zone_adv }}" + protocol: icmp + icmp_type: 0 + icmp_code: 8 + register: acl_rule +- name: verify test create 2nd network acl rule idempotence + assert: + that: + - acl_rule is successful + - acl_rule is not changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.action_policy == "allow" + - acl_rule.cidr == "10.23.12.0/24" + - acl_rule.traffic_type == "egress" + - acl_rule.protocol == "icmp" + - acl_rule.icmp_type == 0 + - acl_rule.icmp_code == 8 + - acl_rule.rule_position == 2 + +- name: test absent network acl rule in check mode + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: acl_rule + check_mode: true +- name: verify test absent network acl rule in check mode + assert: + that: + - acl_rule is successful + - acl_rule is changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.start_port == 81 + - acl_rule.end_port == 81 + - acl_rule.action_policy == "deny" + - acl_rule.cidr == "0.0.0.0/0" + - acl_rule.traffic_type == "egress" + - acl_rule.rule_position == 1 + +- name: test absent network acl rule + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: acl_rule +- name: verify test absent network acl rule + assert: + that: + - acl_rule is successful + - acl_rule is changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.start_port == 81 + - acl_rule.end_port == 81 + - acl_rule.action_policy == "deny" + - acl_rule.cidr == "0.0.0.0/0" + - acl_rule.traffic_type == "egress" + - acl_rule.rule_position == 1 + +- name: test absent network acl rule idempotence + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 1 + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: acl_rule +- name: verify test absent network acl rule idempotence + assert: + that: + - acl_rule is successful + - acl_rule is not changed + +- name: test absent 2nd network acl rule + cs_network_acl_rule: + network_acl: "{{ cs_resource_prefix }}_acl" + rule_position: 2 + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: acl_rule +- name: verify test absent 2nd network acl rule + assert: + that: + - acl_rule is successful + - acl_rule is changed + - acl_rule.vpc == "{{ cs_resource_prefix }}_vpc" + - acl_rule.network_acl == "{{ cs_resource_prefix }}_acl" + - acl_rule.action_policy == "allow" + - acl_rule.cidr == "10.23.12.0/24" + - acl_rule.traffic_type == "egress" + - acl_rule.protocol == "icmp" + - acl_rule.icmp_type == 0 + - acl_rule.icmp_code == 8 + - acl_rule.rule_position == 2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_offering/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_offering/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_offering/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_offering/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_offering/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_offering/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_offering/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_offering/tasks/main.yml new file mode 100644 index 00000000..62d9d3e9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_network_offering/tasks/main.yml @@ -0,0 +1,434 @@ +--- +- name: setup + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + state: absent + register: netoffer +- name: verify setup + assert: + that: + - netoffer is successful + +- name: test fail if missing name + action: cs_network_offering + register: netoffer + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - netoffer is failed + - 'netoffer.msg == "missing required arguments: name"' + +- name: test fail if missing params + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + register: netoffer + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - netoffer is failed + - 'netoffer.msg == "missing required arguments: display_text, guest_ip_type, supported_services, service_providers"' + +- name: test create network offer in check mode + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description" + guest_ip_type: Isolated + max_connections: 300 + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + register: netoffer + check_mode: yes +- name: verify results of network offer in check mode + assert: + that: + - netoffer is successful + - netoffer is changed + +- name: test create network offer + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description" + guest_ip_type: Isolated + max_connections: 300 + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + register: netoffer +- name: verify results of network offer + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description" + +- name: test create network offer idempotence + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description" + guest_ip_type: Isolated + max_connections: 300 + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + register: netoffer +- name: verify results of create network offer idempotence + assert: + that: + - netoffer is successful + - netoffer is not changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description" + +- name: test enabling existing network offer in check_mode + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + state: enabled + register: netoffer + check_mode: yes +- name: verify results of enabling existing network offer in check_mode + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description" + +- name: test enabling existing network offer + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + state: enabled + register: netoffer +- name: verify results of enabling existing network offer + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Enabled" + - netoffer.display_text == "network offering description" + +- name: test enabling existing network offer idempotence + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + state: enabled + register: netoffer +- name: verify results of enabling existing network idempotence + assert: + that: + - netoffer is successful + - netoffer is not changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Enabled" + - netoffer.display_text == "network offering description" + +- name: test disabling network offer in check_mode + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description" + guest_ip_type: Isolated + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: netoffer + check_mode: yes +- name: verify results of disabling network offer in check_mode + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Enabled" + - netoffer.display_text == "network offering description" + +- name: test disabling network offer + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description" + guest_ip_type: Isolated + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: netoffer +- name: verify results of disabling network offer + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description" + +- name: test disabling network offer idempotence + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description" + guest_ip_type: Isolated + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: netoffer +- name: verify results of disabling network idempotence + assert: + that: + - netoffer is successful + - netoffer is not changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description" + +- name: test rename network offer in check_mode + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description renamed" + guest_ip_type: Isolated + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: netoffer + check_mode: yes +- name: verify results of rename network offer in check_mode + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description" + +- name: test rename network offer + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description renamed" + guest_ip_type: Isolated + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: netoffer +- name: verify results of rename network offer + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description renamed" + +- name: test rename network offer idempotence + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description renamed" + guest_ip_type: Isolated + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: netoffer +- name: verify results of rename network offer idempotence + assert: + that: + - netoffer is successful + - netoffer is not changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description renamed" + +- name: test update offer with minimal params in check_mode + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description update" + max_connections: 400 + register: netoffer + check_mode: yes +- name: verify results of update offer with minimal params in check_mode + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description renamed" + - netoffer.max_connections == 300 + +- name: test update offer with minimal params + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description update" + max_connections: 400 + register: netoffer +- name: verify results of update offer with minimal params + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description update" + - netoffer.max_connections == 400 + +- name: test update offer with minimal params idempotency + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description update" + max_connections: 400 + register: netoffer +- name: verify results of update offer with minimal params idempotency + assert: + that: + - netoffer is successful + - netoffer is not changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description update" + - netoffer.max_connections == 400 + +- name: test remove network offer in check_mode + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + state: absent + register: netoffer + check_mode: yes +- name: verify results of rename network offer in check_mode + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description update" + +- name: test remove network offer + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + state: absent + register: netoffer +- name: verify results of rename network offer + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Disabled" + - netoffer.display_text == "network offering description update" + +- name: test remove network offer idempotence + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + state: absent + register: netoffer +- name: verify results of rename network offer idempotence + assert: + that: + - netoffer is successful + - netoffer is not changed + +- name: test create enabled network offer in check mode + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description" + guest_ip_type: Isolated + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: enabled + register: netoffer + check_mode: yes +- name: verify results of create enabled network offer in check mode + assert: + that: + - netoffer is successful + - netoffer is changed + +- name: test create enabled network offer + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description" + guest_ip_type: Isolated + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: enabled + register: netoffer +- name: verify results of create enabled network offer + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Enabled" + - netoffer.display_text == "network offering description" + +- name: test create enabled network offer idempotence + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + display_text: "network offering description" + guest_ip_type: Isolated + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: enabled + register: netoffer +- name: verify results of create enabled network offer idempotence + assert: + that: + - netoffer is successful + - netoffer is not changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Enabled" + - netoffer.display_text == "network offering description" + +- name: remove network offer + cs_network_offering: + name: "{{ cs_resource_prefix }}_name" + state: absent + register: netoffer +- name: verify results of remove network offer + assert: + that: + - netoffer is successful + - netoffer is changed + - netoffer.name == "{{ cs_resource_prefix }}_name" + - netoffer.guest_ip_type == "Isolated" + - netoffer.state == "Enabled" + - netoffer.display_text == "network offering description" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_physical_network/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_physical_network/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_physical_network/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_physical_network/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_physical_network/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_physical_network/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_physical_network/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_physical_network/tasks/main.yml new file mode 100644 index 00000000..4b986a6b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_physical_network/tasks/main.yml @@ -0,0 +1,232 @@ +--- +# Create a new zone - the default one is enabled +- name: assure zone for tests + cs_zone: + name: cs-test-zone + state: present + dns1: 8.8.8.8 + network_type: Advanced + register: cszone + +- name: ensure the zone is disabled + cs_zone: + name: "{{ cszone.name }}" + state: disabled + register: cszone + +- name: ensure a network is absent + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + state: absent + +- name: setup a network in check_mode + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + isolation_method: VLAN + broadcast_domain_range: ZONE + check_mode: yes + register: pn +- name: validate setup a network + assert: + that: + - pn is changed + - pn.zone == cszone.name + +- name: setup a network + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + isolation_method: VLAN + broadcast_domain_range: ZONE + register: pn +- name: validate setup a network + assert: + that: + - pn is changed + - pn.name == 'net01' + - pn.broadcast_domain_range == 'ZONE' + - pn.isolation_method == 'VLAN' + - pn.zone == cszone.name + - pn.state == 'Disabled' + +- name: setup a network idempotence + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + isolation_method: VLAN + broadcast_domain_range: ZONE + register: pn +- name: validate setup a network idempotence + assert: + that: + - pn is not changed + - pn.name == 'net01' + - pn.broadcast_domain_range == 'ZONE' + - pn.isolation_method == 'VLAN' + - pn.zone == cszone.name + - pn.state == 'Disabled' + +- name: set a tag on a network + cs_physical_network: + name: net01 + tag: overlay + zone: "{{ cszone.name }}" + ignore_errors: true + register: pn +- name: validate set a tag on a network + assert: + that: + - pn is changed + - pn.name == 'net01' + - pn.broadcast_domain_range == 'ZONE' + - pn.isolation_method == 'VLAN' + - pn.zone == cszone.name + - pn.tags == 'overlay' + - pn.state == 'Disabled' + +- name: Remove tag on a network + cs_physical_network: + name: net01 + tag: "" + zone: "{{ cszone.name }}" + register: pn +- name: validate remove tag on a network + assert: + that: + - pn is changed + - pn.name == 'net01' + - pn.broadcast_domain_range == 'ZONE' + - pn.isolation_method == 'VLAN' + - pn.zone == cszone.name + - pn.tags is undefined + - pn.state == 'Disabled' + +- name: ensure a network is enabled with specific nsps enabled in check mode + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + isolation_method: VLAN + vlan: 100-200,300-400 + broadcast_domain_range: ZONE + state: enabled + nsps_enabled: + - virtualrouter + - internallbvm + - vpcvirtualrouter + check_mode: yes + register: pn +- name: validate ensure a network is enabled with specific nsps enabled in check mode + assert: + that: + - pn is changed + - pn.name == 'net01' + - pn.zone == cszone.name + - "'internallbvm' in pn.nsps_enabled" + - "'virtualrouter' in pn.nsps_enabled" + - "'vpcvirtualrouter' in pn.nsps_enabled" + +- name: ensure a network is enabled with specific nsps enabled + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + isolation_method: VLAN + vlan: 100-200,300-400 + broadcast_domain_range: ZONE + state: enabled + nsps_enabled: + - virtualrouter + - internallbvm + - vpcvirtualrouter + register: pn +- name: validate ensure a network is enabled with specific nsps enabled + assert: + that: + - pn is changed + - pn.name == 'net01' + - pn.broadcast_domain_range == 'ZONE' + - pn.isolation_method == 'VLAN' + - pn.zone == cszone.name + - pn.vlan == '100-200,300-400' + - pn.state == 'Enabled' + - "'internallbvm' in pn.nsps_enabled" + - "'virtualrouter' in pn.nsps_enabled" + - "'vpcvirtualrouter' in pn.nsps_enabled" + +- name: ensure a network is disabled + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + state: disabled + register: pn +- name: validate ensure a network is disabled + assert: + that: + - pn is changed + - pn.name == 'net01' + - pn.broadcast_domain_range == 'ZONE' + - pn.isolation_method == 'VLAN' + - pn.zone == cszone.name + - pn.tags is undefined + - pn.state == 'Disabled' + +- name: ensure a network is enabled + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + state: enabled + register: pn +- name: validate ensure a network is enabled + assert: + that: + - pn is changed + - pn.name == 'net01' + - pn.broadcast_domain_range == 'ZONE' + - pn.isolation_method == 'VLAN' + - pn.zone == cszone.name + - pn.tags is undefined + - pn.state == 'Enabled' + +- name: ensure a network is not absent in check mode + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + state: absent + check_mode: yes + register: pn +- name: validate ensure a network is absent + assert: + that: + - pn is changed + - pn.zone == cszone.name + +- name: ensure a network is absent + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + state: absent + register: pn +- name: validate ensure a network is absent + assert: + that: + - pn is changed + - pn.zone == cszone.name + - pn.name == 'net01' + +- name: ensure a network is absent idempotence + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + state: absent + register: pn +- name: validate ensure a network is absent idempotence + assert: + that: + - pn is not changed + - pn.zone == cszone.name + +- name: cleanup zone + cs_zone: + name: "{{ cszone.name }}" + state: absent diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_pod/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_pod/aliases new file mode 100644 index 00000000..c89c86d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_pod/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_pod/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_pod/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_pod/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_pod/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_pod/tasks/main.yml new file mode 100644 index 00000000..600bc22b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_pod/tasks/main.yml @@ -0,0 +1,301 @@ +--- +- name: setup zone is present + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + dns1: 8.8.8.8 + dns2: 8.8.4.4 + network_type: Basic + register: zone +- name: verify setup zone is present + assert: + that: + - zone is successful + +- name: setup pod is absent + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + state: absent + register: pod +- name: verify setup pod is absent + assert: + that: + - pod is successful + +- name: test fail if missing name + cs_pod: + register: pod + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - pod is failed + - "pod.msg == 'missing required arguments: name'" + + +- name: test create pod in check mode + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + start_ip: 10.100.10.101 + gateway: 10.100.10.1 + netmask: 255.255.255.0 + register: pod_origin + check_mode: true +- name: verify test create pod in check mode + assert: + that: + - pod_origin is changed + - pod_origin.zone == "{{ cs_resource_prefix }}-zone" + +- name: test create pod + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + start_ip: 10.100.10.101 + gateway: 10.100.10.1 + netmask: 255.255.255.0 + register: pod_origin +- name: verify test create pod + assert: + that: + - pod_origin is changed + - pod_origin.allocation_state == "Enabled" + - pod_origin.start_ip == "10.100.10.101" + - pod_origin.end_ip == "10.100.10.254" + - pod_origin.gateway == "10.100.10.1" + - pod_origin.netmask == "255.255.255.0" + - pod_origin.zone == "{{ cs_resource_prefix }}-zone" + +- name: test create pod idempotence + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + start_ip: 10.100.10.101 + gateway: 10.100.10.1 + netmask: 255.255.255.0 + register: pod +- name: verify test create pod idempotence + assert: + that: + - pod is not changed + - pod.allocation_state == "Enabled" + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.1" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test update pod in check mode + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + gateway: 10.100.10.2 + netmask: 255.255.255.0 + register: pod + check_mode: true +- name: verify test update pod in check mode + assert: + that: + - pod is changed + - pod.allocation_state == "Enabled" + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.1" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test update pod + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + gateway: 10.100.10.2 + netmask: 255.255.255.0 + register: pod +- name: verify test update pod + assert: + that: + - pod is changed + - pod.allocation_state == "Enabled" + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.2" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test update pod idempotence + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + gateway: 10.100.10.2 + netmask: 255.255.255.0 + register: pod +- name: verify test update pod idempotence + assert: + that: + - pod is not changed + - pod.allocation_state == "Enabled" + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.2" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test disable pod in check mode + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + state: disabled + register: pod + check_mode: true +- name: verify test enable pod in check mode + assert: + that: + - pod is changed + - pod.allocation_state == "Enabled" + - pod.id == pod_origin.id + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.2" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test disable pod + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + state: disabled + register: pod +- name: verify test enable pod + assert: + that: + - pod is changed + - pod.allocation_state == "Disabled" + - pod.id == pod_origin.id + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.2" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test disable pod idempotence + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + state: disabled + register: pod +- name: verify test enable pod idempotence + assert: + that: + - pod is not changed + - pod.allocation_state == "Disabled" + - pod.id == pod_origin.id + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.2" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test enable pod in check mode + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + state: enabled + register: pod + check_mode: true +- name: verify test disable pod in check mode + assert: + that: + - pod is changed + - pod.allocation_state == "Disabled" + - pod.id == pod_origin.id + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.2" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test enable pod + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + state: enabled + register: pod +- name: verify test disable pod + assert: + that: + - pod is changed + - pod.allocation_state == "Enabled" + - pod.id == pod_origin.id + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.2" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + + +- name: test enable pod idempotence + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + state: enabled + register: pod +- name: verify test enabled pod idempotence + assert: + that: + - pod is not changed + - pod.allocation_state == "Enabled" + - pod.id == pod_origin.id + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.2" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test absent pod in check mode + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + state: absent + register: pod + check_mode: true +- name: verify test create pod in check mode + assert: + that: + - pod is changed + - pod.id == pod_origin.id + - pod.allocation_state == "Enabled" + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.2" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test absent pod + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + state: absent + register: pod +- name: verify test create pod + assert: + that: + - pod is changed + - pod.id == pod_origin.id + - pod.allocation_state == "Enabled" + - pod.start_ip == "10.100.10.101" + - pod.end_ip == "10.100.10.254" + - pod.gateway == "10.100.10.2" + - pod.netmask == "255.255.255.0" + - pod.zone == "{{ cs_resource_prefix }}-zone" + +- name: test absent pod idempotence + cs_pod: + name: "{{ cs_resource_prefix }}-pod" + zone: "{{ cs_resource_prefix }}-zone" + state: absent + register: pod +- name: verify test absent pod idempotence + assert: + that: + - pod is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/defaults/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/defaults/main.yml new file mode 100644 index 00000000..89842c55 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/defaults/main.yml @@ -0,0 +1,3 @@ +--- +cs_portforward_public_ip: "10.100.212.5" +cs_portforward_vm: "cs-{{ cs_resource_prefix }}-pf-vm" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/tasks/main.yml new file mode 100644 index 00000000..d1b6946e --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_portforward/tasks/main.yml @@ -0,0 +1,255 @@ +--- +- name: network setup + cs_network: + name: ansible test + network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService + network_domain: example.com + zone: "{{ cs_common_zone_adv }}" + register: net +- name: verify network setup + assert: + that: + - net is successful + +- name: instance setup + cs_instance: + name: "{{ cs_portforward_vm }}" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + network: "ansible test" + register: instance +- name: verify instance setup + assert: + that: + - instance is successful + +- name: public ip address setup + cs_ip_address: + network: ansible test + zone: "{{ cs_common_zone_adv }}" + register: ip_address +- name: verify public ip address setup + assert: + that: + - ip_address is successful + +- name: set ip address as fact + set_fact: + cs_portforward_public_ip: "{{ ip_address.ip_address }}" + +- name: clear existing port forwarding + cs_portforward: + ip_address: "{{ cs_portforward_public_ip }}" + public_port: 80 + private_port: 8080 + state: absent + zone: "{{ cs_common_zone_adv }}" + register: pf +- name: verify clear existing port forwarding + assert: + that: + - pf is successful + +- name: test fail if missing params + action: cs_portforward + register: pf + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - pf is failed + - 'pf.msg.startswith("missing required arguments: ")' + +- name: test present port forwarding in check mode + cs_portforward: + ip_address: "{{ cs_portforward_public_ip }}" + public_port: 80 + vm: "{{ cs_portforward_vm }}" + private_port: 8080 + zone: "{{ cs_common_zone_adv }}" + register: pf + check_mode: true +- name: verify results of present port forwarding in check mode + assert: + that: + - pf is successful + - pf is changed + +- name: test present port forwarding + cs_portforward: + ip_address: "{{ cs_portforward_public_ip }}" + public_port: 80 + vm: "{{ cs_portforward_vm }}" + private_port: 8080 + zone: "{{ cs_common_zone_adv }}" + register: pf +- name: verify results of present port forwarding + assert: + that: + - pf is successful + - pf is changed + - pf.vm_name == "{{ cs_portforward_vm }}" + - pf.ip_address == "{{ cs_portforward_public_ip }}" + - pf.public_port == 80 + - pf.public_end_port == 80 + - pf.private_port == 8080 + - pf.private_end_port == 8080 + +- name: test present port forwarding idempotence + cs_portforward: + ip_address: "{{ cs_portforward_public_ip }}" + public_port: 80 + vm: "{{ cs_portforward_vm }}" + private_port: 8080 + zone: "{{ cs_common_zone_adv }}" + register: pf +- name: verify results of present port forwarding idempotence + assert: + that: + - pf is successful + - pf is not changed + - pf.vm_name == "{{ cs_portforward_vm }}" + - pf.ip_address == "{{ cs_portforward_public_ip }}" + - pf.public_port == 80 + - pf.public_end_port == 80 + - pf.private_port == 8080 + - pf.private_end_port == 8080 + +- name: test change port forwarding in check mode + cs_portforward: + ip_address: "{{ cs_portforward_public_ip }}" + public_port: 80 + vm: "{{ cs_portforward_vm }}" + private_port: 8888 + zone: "{{ cs_common_zone_adv }}" + register: pf + check_mode: true +- name: verify results of change port forwarding in check mode + assert: + that: + - pf is successful + - pf is changed + - pf.vm_name == "{{ cs_portforward_vm }}" + - pf.ip_address == "{{ cs_portforward_public_ip }}" + - pf.public_port == 80 + - pf.public_end_port == 80 + - pf.private_port == 8080 + - pf.private_end_port == 8080 + +- name: test change port forwarding + cs_portforward: + ip_address: "{{ cs_portforward_public_ip }}" + public_port: 80 + vm: "{{ cs_portforward_vm }}" + private_port: 8888 + zone: "{{ cs_common_zone_adv }}" + register: pf +- name: verify results of change port forwarding + assert: + that: + - pf is successful + - pf is changed + - pf.vm_name == "{{ cs_portforward_vm }}" + - pf.ip_address == "{{ cs_portforward_public_ip }}" + - pf.public_port == 80 + - pf.public_end_port == 80 + - pf.private_port == 8888 + - pf.private_end_port == 8888 + +- name: test change port forwarding idempotence + cs_portforward: + ip_address: "{{ cs_portforward_public_ip }}" + public_port: 80 + vm: "{{ cs_portforward_vm }}" + private_port: 8888 + zone: "{{ cs_common_zone_adv }}" + register: pf +- name: verify results of change port forwarding idempotence + assert: + that: + - pf is successful + - pf is not changed + - pf.vm_name == "{{ cs_portforward_vm }}" + - pf.ip_address == "{{ cs_portforward_public_ip }}" + - pf.public_port == 80 + - pf.public_end_port == 80 + - pf.private_port == 8888 + - pf.private_end_port == 8888 + +- name: test absent port forwarding in check mode + cs_portforward: + ip_address: "{{ cs_portforward_public_ip }}" + public_port: 80 + private_port: 8888 + state: absent + zone: "{{ cs_common_zone_adv }}" + register: pf + check_mode: true +- name: verify results of absent port forwarding in check mode + assert: + that: + - pf is successful + - pf is changed + - pf.vm_name == "{{ cs_portforward_vm }}" + - pf.ip_address == "{{ cs_portforward_public_ip }}" + - pf.public_port == 80 + - pf.public_end_port == 80 + - pf.private_port == 8888 + - pf.private_end_port == 8888 + +- name: test absent port forwarding + cs_portforward: + ip_address: "{{ cs_portforward_public_ip }}" + public_port: 80 + private_port: 8888 + state: absent + zone: "{{ cs_common_zone_adv }}" + register: pf +- name: verify results of absent port forwarding + assert: + that: + - pf is successful + - pf is changed + - pf.vm_name == "{{ cs_portforward_vm }}" + - pf.ip_address == "{{ cs_portforward_public_ip }}" + - pf.public_port == 80 + - pf.public_end_port == 80 + - pf.private_port == 8888 + - pf.private_end_port == 8888 + +- name: test absent port forwarding idempotence + cs_portforward: + ip_address: "{{ cs_portforward_public_ip }}" + public_port: 80 + private_port: 8888 + state: absent + zone: "{{ cs_common_zone_adv }}" + register: pf +- name: verify results of absent port forwarding idempotence + assert: + that: + - pf is successful + - pf is not changed + +- name: instance cleanup + cs_instance: + name: "{{ cs_portforward_vm }}" + zone: "{{ cs_common_zone_adv }}" + state: expunged + register: instance +- name: verify instance cleanup + assert: + that: + - instance is successful + +- name: network cleanup + cs_network: + name: ansible test + zone: "{{ cs_common_zone_adv }}" + state: absent + register: net +- name: verify network cleanup + assert: + that: + - net is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_project/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_project/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_project/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_project/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_project/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_project/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_project/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_project/tasks/main.yml new file mode 100644 index 00000000..7ece89d4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_project/tasks/main.yml @@ -0,0 +1,149 @@ +--- +- name: ensure project does not exist + cs_project: + name: "{{ cs_resource_prefix }}-prj" + state: absent + register: prj +- name: verify project did not exist + assert: + that: + - prj is successful + +- name: test create project in check mode + cs_project: + name: "{{ cs_resource_prefix }}-prj" + register: prj + check_mode: true +- name: verify test create project in check mode + assert: + that: + - prj is changed + +- name: test create project + cs_project: + name: "{{ cs_resource_prefix }}-prj" + register: prj +- name: verify test create project + assert: + that: + - prj is changed + - prj.name == "{{ cs_resource_prefix }}-prj" + +- name: test create project idempotence + cs_project: + name: "{{ cs_resource_prefix }}-prj" + register: prj +- name: verify test create project idempotence + assert: + that: + - prj is not changed + - prj.name == "{{ cs_resource_prefix }}-prj" + +- name: test suspend project in check mode + cs_project: + name: "{{ cs_resource_prefix }}-prj" + state: suspended + register: prj + check_mode: true +- name: verify test suspend project in check mode + assert: + that: + - prj is changed + - prj.name == "{{ cs_resource_prefix }}-prj" + - prj.state != "Suspended" + +- name: test suspend project + cs_project: + name: "{{ cs_resource_prefix }}-prj" + state: suspended + register: prj +- name: verify test suspend project + assert: + that: + - prj is changed + - prj.name == "{{ cs_resource_prefix }}-prj" + - prj.state == "Suspended" + +- name: test suspend project idempotence + cs_project: + name: "{{ cs_resource_prefix }}-prj" + state: suspended + register: prj +- name: verify test suspend project idempotence + assert: + that: + - prj is not changed + - prj.name == "{{ cs_resource_prefix }}-prj" + - prj.state == "Suspended" + +- name: test activate project in check mode + cs_project: + name: "{{ cs_resource_prefix }}-prj" + state: active + register: prj + check_mode: true +- name: verify test activate project in check mode + assert: + that: + - prj is changed + - prj.name == "{{ cs_resource_prefix }}-prj" + - prj.state != "Active" + +- name: test activate project + cs_project: + name: "{{ cs_resource_prefix }}-prj" + state: active + register: prj +- name: verify test activate project + assert: + that: + - prj is changed + - prj.name == "{{ cs_resource_prefix }}-prj" + - prj.state == "Active" + +- name: test activate project idempotence + cs_project: + name: "{{ cs_resource_prefix }}-prj" + state: active + register: prj +- name: verify test activate project idempotence + assert: + that: + - prj is not changed + - prj.name == "{{ cs_resource_prefix }}-prj" + - prj.state == "Active" + +- name: test delete project in check mode + cs_project: + name: "{{ cs_resource_prefix }}-prj" + state: absent + register: prj + check_mode: true +- name: verify test delete project in check mode + assert: + that: + - prj is changed + - prj.name == "{{ cs_resource_prefix }}-prj" + - prj.state == "Active" + +- name: test delete project + cs_project: + name: "{{ cs_resource_prefix }}-prj" + state: absent + register: prj +- name: verify test delete project + assert: + that: + - prj is changed + - prj.name == "{{ cs_resource_prefix }}-prj" + - prj.state == "Active" + +- name: test delete project idempotence + cs_project: + name: "{{ cs_resource_prefix }}-prj" + state: absent + register: prj +- name: verify test delete project idempotence + assert: + that: + - prj is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_region/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_region/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_region/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_region/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_region/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_region/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_region/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_region/tasks/main.yml new file mode 100644 index 00000000..d7283083 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_region/tasks/main.yml @@ -0,0 +1,154 @@ +--- +- name: setup + cs_region: + id: 2 + state: absent + register: region +- name: verify setup + assert: + that: + - region is successful + +- name: test fail if missing params + cs_region: + register: region + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - region is failed + - "region.msg.startswith('missing required arguments: ')" + +- name: test create region in check mode + cs_region: + id: 2 + name: geneva + endpoint: https://cloud.gva.example.com + register: region + check_mode: true +- name: verify test create region in check mode + assert: + that: + - region is changed + +- name: test create region in check mode + cs_region: + id: 2 + name: geneva + endpoint: https://cloud.gva.example.com + register: region +- name: verify test create region in check mode + assert: + that: + - region is changed + - region.name == 'geneva' + - region.id == 2 + - region.endpoint == 'https://cloud.gva.example.com' + - region.gslb_service_enabled == true + - region.portable_ip_service_enabled == false + +- name: test create region idempotence + cs_region: + id: 2 + name: geneva + endpoint: https://cloud.gva.example.com + register: region +- name: verify test create region idempotence + assert: + that: + - region is not changed + - region.name == 'geneva' + - region.id == 2 + - region.endpoint == 'https://cloud.gva.example.com' + - region.gslb_service_enabled == true + - region.portable_ip_service_enabled == false + +- name: test update region in check mode + cs_region: + id: 2 + name: zuerich + endpoint: https://cloud.zrh.example.com + register: region + check_mode: true +- name: verify test update region in check mode + assert: + that: + - region is changed + - region.name == 'geneva' + - region.id == 2 + - region.endpoint == 'https://cloud.gva.example.com' + - region.gslb_service_enabled == true + - region.portable_ip_service_enabled == false + +- name: test update region + cs_region: + id: 2 + name: zuerich + endpoint: https://cloud.zrh.example.com + register: region +- name: verify test update region + assert: + that: + - region is changed + - region.name == 'zuerich' + - region.id == 2 + - region.endpoint == 'https://cloud.zrh.example.com' + - region.gslb_service_enabled == true + - region.portable_ip_service_enabled == false + +- name: test update region idempotence + cs_region: + id: 2 + name: zuerich + endpoint: https://cloud.zrh.example.com + register: region +- name: verify test update region idempotence + assert: + that: + - region is not changed + - region.name == 'zuerich' + - region.id == 2 + - region.endpoint == 'https://cloud.zrh.example.com' + - region.gslb_service_enabled == true + - region.portable_ip_service_enabled == false + +- name: test remove region in check mdoe + cs_region: + id: 2 + state: absent + register: region + check_mode: true +- name: verify test remove region in check mode + assert: + that: + - region is changed + - region.name == 'zuerich' + - region.id == 2 + - region.endpoint == 'https://cloud.zrh.example.com' + - region.gslb_service_enabled == true + - region.portable_ip_service_enabled == false + +- name: test remove region + cs_region: + id: 2 + state: absent + register: region +- name: verify test remove region + assert: + that: + - region is changed + - region.name == 'zuerich' + - region.id == 2 + - region.endpoint == 'https://cloud.zrh.example.com' + - region.gslb_service_enabled == true + - region.portable_ip_service_enabled == false + +- name: test remove region idempotence + cs_region: + id: 2 + state: absent + register: region +- name: verify test remove region idempotence + assert: + that: + - region is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/tasks/cpu.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/tasks/cpu.yml new file mode 100644 index 00000000..baa736b4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/tasks/cpu.yml @@ -0,0 +1,122 @@ +--- +- name: setup cpu limits account + cs_resourcelimit: + type: cpu + limit: 20 + account: "{{ cs_resource_prefix }}_user" + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify setup cpu limits account + assert: + that: + - rl is successful + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.account == "{{ cs_resource_prefix }}_user" + - rl.limit == 20 + - rl.resource_type == "cpu" + +- name: setup cpu limits for domain + cs_resourcelimit: + type: cpu + limit: -1 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify setup cpu limits for domain + assert: + that: + - rl is successful + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == -1 + - rl.resource_type == "cpu" + +- name: set cpu limits for domain in check mode + cs_resourcelimit: + type: cpu + limit: 12 + domain: "{{ cs_resource_prefix }}-domain" + register: rl + check_mode: true +- name: verify set cpu limits for domain in check mode + assert: + that: + - rl is changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == -1 + - rl.resource_type == "cpu" + +- name: set cpu limits for domain + cs_resourcelimit: + type: cpu + limit: 12 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify set cpu limits for domain + assert: + that: + - rl is changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 12 + - rl.resource_type == "cpu" + +- name: set cpu limits for domain idempotence + cs_resourcelimit: + type: cpu + limit: 12 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify set cpu limits for domain + assert: + that: + - rl is not changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 12 + - rl.resource_type == "cpu" + +- name: set cpu limits for account in check mode + cs_resourcelimit: + type: cpu + limit: 10 + account: "{{ cs_resource_prefix }}_user" + domain: "{{ cs_resource_prefix }}-domain" + register: rl + check_mode: true +- name: verify set cpu limits for account in check mode + assert: + that: + - rl is changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.account == "{{ cs_resource_prefix }}_user" + - rl.limit == 20 + - rl.resource_type == "cpu" + +- name: set cpu limits for account + cs_resourcelimit: + type: cpu + limit: 10 + account: "{{ cs_resource_prefix }}_user" + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify set cpu limits for account + assert: + that: + - rl is changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.account == "{{ cs_resource_prefix }}_user" + - rl.limit == 10 + - rl.resource_type == "cpu" + +- name: set cpu limits for account idempotence + cs_resourcelimit: + type: cpu + limit: 10 + account: "{{ cs_resource_prefix }}_user" + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify set cpu limits for account idempotence + assert: + that: + - rl is not changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.account == "{{ cs_resource_prefix }}_user" + - rl.limit == 10 + - rl.resource_type == "cpu" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/tasks/instance.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/tasks/instance.yml new file mode 100644 index 00000000..11a1fe07 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/tasks/instance.yml @@ -0,0 +1,108 @@ +--- +- name: setup instance limits account + cs_resourcelimit: + type: instance + limit: 20 + account: "{{ cs_resource_prefix }}_user" + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify setup instance limits account + assert: + that: + - rl is successful + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.account == "{{ cs_resource_prefix }}_user" + - rl.limit == 20 + - rl.resource_type == "instance" + +- name: set instance limits for domain in check mode + cs_resourcelimit: + type: instance + limit: 12 + domain: "{{ cs_resource_prefix }}-domain" + register: rl + check_mode: true +- name: verify set instance limits for domain in check mode + assert: + that: + - rl is changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 20 + - rl.resource_type == "instance" + +- name: set instance limits for domain + cs_resourcelimit: + type: instance + limit: 12 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify set instance limits for domain + assert: + that: + - rl is changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 12 + - rl.resource_type == "instance" + +- name: set instance limits for domain idempotence + cs_resourcelimit: + type: instance + limit: 12 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify set instance limits for domain + assert: + that: + - rl is not changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 12 + - rl.resource_type == "instance" + +- name: set instance limits for account in check mode + cs_resourcelimit: + type: instance + limit: 10 + account: "{{ cs_resource_prefix }}_user" + domain: "{{ cs_resource_prefix }}-domain" + register: rl + check_mode: true +- name: verify set instance limits for account in check mode + assert: + that: + - rl is changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.account == "{{ cs_resource_prefix }}_user" + - rl.limit != 10 + - rl.resource_type == "instance" + +- name: set instance limits for account + cs_resourcelimit: + type: instance + limit: 10 + account: "{{ cs_resource_prefix }}_user" + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify set instance limits for account + assert: + that: + - rl is changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.account == "{{ cs_resource_prefix }}_user" + - rl.limit == 10 + - rl.resource_type == "instance" + +- name: set instance limits for account idempotence + cs_resourcelimit: + type: instance + limit: 10 + account: "{{ cs_resource_prefix }}_user" + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify set instance limits for account idempotence + assert: + that: + - rl is not changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.account == "{{ cs_resource_prefix }}_user" + - rl.limit == 10 + - rl.resource_type == "instance" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/tasks/main.yml new file mode 100644 index 00000000..fcf9279f --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_resourcelimit/tasks/main.yml @@ -0,0 +1,104 @@ +--- +- name: setup domain + cs_domain: path={{ cs_resource_prefix }}-domain + register: dom +- name: verify setup domain + assert: + that: + - dom is successful + +- name: setup account + cs_account: + name: "{{ cs_resource_prefix }}_user" + username: "{{ cs_resource_prefix }}_username" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + network_domain: "{{ cs_resource_prefix }}-local" + domain: "{{ cs_resource_prefix }}-domain" + register: acc +- name: verify setup account + assert: + that: + - acc is successful + +- name: test failed unkonwn type + cs_resourcelimit: + type: unkonwn + limit: 20 + domain: "{{ cs_resource_prefix }}-domain" + register: rl + ignore_errors: yes +- name: verify test failed unkonwn type + assert: + that: + - rl is failed + +- name: test failed missing type + cs_resourcelimit: + register: rl + ignore_errors: yes +- name: verify test failed missing type + assert: + that: + - rl is failed + +- name: setup resource limits domain + cs_resourcelimit: + type: instance + limit: 10 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify setup resource limits domain + assert: + that: + - rl is successful + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 10 + +- name: set resource limits domain to 20 in check mode + cs_resourcelimit: + type: instance + limit: 20 + domain: "{{ cs_resource_prefix }}-domain" + register: rl + check_mode: true +- name: verify setup resource limits domain to 20 in check mode + assert: + that: + - rl is successful + - rl is changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 10 + +- name: set resource limits domain to 20 + cs_resourcelimit: + type: instance + limit: 20 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify setup resource limits domain to 20 + assert: + that: + - rl is successful + - rl is changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 20 + +- name: set resource limits domain to 20 idempotence + cs_resourcelimit: + type: instance + limit: 20 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify setup resource limits domain to 20 idempotence + assert: + that: + - rl is successful + - rl is not changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 20 + +- include: instance.yml +- include: cpu.yml diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role/tasks/main.yml new file mode 100644 index 00000000..11c1653d --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role/tasks/main.yml @@ -0,0 +1,130 @@ +--- +- name: setup + cs_role: + name: "{{ cs_resource_prefix }}-role" + state: absent + register: role +- name: verify setup + assert: + that: + - role is successful + +- name: test fail if missing params + cs_role: + register: role + ignore_errors: true +- name: verifytest fail if missing params + assert: + that: + - role is failed + - "role.msg.startswith('missing required arguments: ')" + +- name: test create role in check mode + cs_role: + name: "{{ cs_resource_prefix }}-role" + role_type: DomainAdmin + register: role + check_mode: true +- name: verify test create role in check mode + assert: + that: + - role is changed + +- name: test create role + cs_role: + name: "{{ cs_resource_prefix }}-role" + role_type: DomainAdmin + register: role +- name: verify test create role + assert: + that: + - role is changed + - role.name == '{{ cs_resource_prefix }}-role' + - role.role_type == 'DomainAdmin' + +- name: test create role idempotence + cs_role: + name: "{{ cs_resource_prefix }}-role" + role_type: DomainAdmin + register: role +- name: verify test create role idempotence + assert: + that: + - role is not changed + - role.name == '{{ cs_resource_prefix }}-role' + - role.role_type == 'DomainAdmin' + +- name: test update role in check mode + cs_role: + name: "{{ cs_resource_prefix }}-role" + description: "{{ cs_resource_prefix }}-role-description" + role_type: DomainAdmin + register: role + check_mode: true +- name: verify test update role in check mode + assert: + that: + - role is changed + - role.name == '{{ cs_resource_prefix }}-role' + - "role.description is not defined" + - role.role_type == 'DomainAdmin' + +- name: test update role + cs_role: + name: "{{ cs_resource_prefix }}-role" + description: "{{ cs_resource_prefix }}-role-description" + role_type: DomainAdmin + register: role +- name: verify test update role + assert: + that: + - role is changed + - role.name == '{{ cs_resource_prefix }}-role' + - role.description == '{{ cs_resource_prefix }}-role-description' + - role.role_type == 'DomainAdmin' + +- name: test update role idempotence + cs_role: + name: "{{ cs_resource_prefix }}-role" + description: "{{ cs_resource_prefix }}-role-description" + register: role +- name: verify test update role idempotence + assert: + that: + - role is not changed + - role.name == '{{ cs_resource_prefix }}-role' + - role.description == '{{ cs_resource_prefix }}-role-description' + - role.role_type == 'DomainAdmin' + +- name: test remove role in check mdoe + cs_role: + name: "{{ cs_resource_prefix }}-role" + state: absent + register: role + check_mode: true +- name: verify test remove role in check mode + assert: + that: + - role is changed + - role.name == '{{ cs_resource_prefix }}-role' + - role.role_type == 'DomainAdmin' + +- name: test remove role + cs_role: + name: "{{ cs_resource_prefix }}-role" + state: absent + register: role +- name: verify test remove role + assert: + that: + - role is changed + +- name: test remove role idempotence + cs_role: + name: "{{ cs_resource_prefix }}-role" + state: absent + register: role +- name: verify test remove role idempotence + assert: + that: + - role is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role_permission/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role_permission/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role_permission/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role_permission/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role_permission/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role_permission/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role_permission/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role_permission/tasks/main.yml new file mode 100644 index 00000000..95e2df84 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_role_permission/tasks/main.yml @@ -0,0 +1,303 @@ +- name: pre-setup + cs_role: + name: "testRole" + register: testRole +- name: verify pre-setup + assert: + that: + - testRole is successful + +- name: setup + cs_role_permission: + name: "fakeRolePerm" + role: "{{ testRole.id }}" + state: absent + register: roleperm +- name: verify setup + assert: + that: + - roleperm is successful + +- name: setup2 + cs_role_permission: + name: "fakeRolePerm2" + role: "{{ testRole.id }}" + state: absent + register: roleperm2 +- name: verify setup2 + assert: + that: + - roleperm2 is successful + +- name: test fail if missing name + cs_role_permission: + role: "{{ testRole.id }}" + register: roleperm + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - roleperm is failed + - 'roleperm.msg == "missing required arguments: name"' + +- name: test fail if missing role + cs_role_permission: + name: "fakeRolePerm" + register: roleperm + ignore_errors: true +- name: verify results of fail if missing role + assert: + that: + - roleperm is failed + - 'roleperm.msg == "missing required arguments: role"' + +- name: test fail if role does not exist + cs_role_permission: + name: "fakeRolePerm" + role: "testtest" + register: roleperm + ignore_errors: true +- name: verify results of fail if role does not exist + assert: + that: + - roleperm is failed + - roleperm.msg == "Role 'testtest' not found" + +- name: test fail if state is incorrcect + cs_role_permission: + state: badstate + role: "{{ testRole.id }}" + name: "fakeRolePerm" + permission: allow + register: roleperm + ignore_errors: true +- name: verify results of fail if state is incorrcect + assert: + that: + - roleperm is failed + - 'roleperm.msg == "value of state must be one of: present, absent, got: badstate"' + +- name: test create role permission in check mode + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + permission: allow + description: "fakeRolePerm description" + register: roleperm + check_mode: yes +- name: verify results of role permission in check mode + assert: + that: + - roleperm is successful + - roleperm is changed + +- name: test create role permission + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + permission: allow + description: "fakeRolePerm description" + register: roleperm +- name: verify results of role permission + assert: + that: + - roleperm is successful + - roleperm is changed + - roleperm.name == "fakeRolePerm" + - roleperm.permission == "allow" + - roleperm.description == "fakeRolePerm description" + +- name: test create role permission idempotency + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + permission: allow + description: "fakeRolePerm description" + register: roleperm +- name: verify results of role permission idempotency + assert: + that: + - roleperm is successful + - roleperm is not changed + - roleperm.name == "fakeRolePerm" + - roleperm.permission == "allow" + - roleperm.description == "fakeRolePerm description" + +- name: test update role permission in check_mode + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + permission: deny + description: "fakeRolePerm description" + register: roleperm + check_mode: yes +- name: verify results of update role permission in check mode + assert: + that: + - roleperm is successful + - roleperm is changed + - roleperm.name == "fakeRolePerm" + - roleperm.permission == "allow" + - roleperm.description == "fakeRolePerm description" + +- name: test update role permission + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + permission: deny + description: "fakeRolePerm description" + register: roleperm +- name: verify results of update role permission + assert: + that: + - roleperm is successful + - roleperm is changed + - roleperm.name == "fakeRolePerm" + - roleperm.permission == "deny" + - roleperm.description == "fakeRolePerm description" + +- name: test update role permission idempotency + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + permission: deny + description: "fakeRolePerm description" + register: roleperm +- name: verify results of update role permission idempotency + assert: + that: + - roleperm is successful + - roleperm is not changed + - roleperm.name == "fakeRolePerm" + - roleperm.permission == "deny" + - roleperm.description == "fakeRolePerm description" + +- name: test create a second role permission + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm2" + permission: allow + register: roleperm2 +- name: verify results of create a second role permission + assert: + that: + - roleperm2 is successful + - roleperm2 is changed + - roleperm2.name == "fakeRolePerm2" + +- name: test update rules order in check_mode + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + parent: "{{ roleperm2.id }}" + register: roleperm + check_mode: yes +- name: verify results of update rule order check mode + assert: + that: + - roleperm is successful + - roleperm is changed + - roleperm.name == "fakeRolePerm" + +- name: test update rules order + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + parent: "{{ roleperm2.id }}" + register: roleperm +- name: verify results of update rule order + assert: + that: + - roleperm is successful + - roleperm is changed + - roleperm.name == "fakeRolePerm" + +- name: test update rules order to the top of the list + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + parent: 0 + register: roleperm +- name: verify results of update rule order to the top of the list + assert: + that: + - roleperm is successful + - roleperm is changed + - roleperm.name == "fakeRolePerm" + +- name: test update rules order with parent NAME + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + parent: "{{ roleperm2.name }}" + register: roleperm +- name: verify results of update rule order with parent NAME + assert: + that: + - roleperm is successful + - roleperm is changed + - roleperm.name == "fakeRolePerm" + +- name: test fail if permission AND parent args are present + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + permission: allow + parent: 0 + register: roleperm + ignore_errors: true +- name: verify results of fail if permission AND parent args are present + assert: + that: + - roleperm is failed + - 'roleperm.msg == "parameters are mutually exclusive: permission|parent"' + +- name: test fail if parent does not exist + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + parent: "badParent" + register: roleperm + ignore_errors: true +- name: verify results of fail if parent does not exist + assert: + that: + - roleperm is failed + - roleperm.msg == "Parent rule 'badParent' not found" + +- name: test remove role permission in check_mode + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + state: absent + register: roleperm + check_mode: yes +- name: verify results of rename role permission in check_mode + assert: + that: + - roleperm is successful + - roleperm is changed + +- name: test remove role permission + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm" + state: absent + register: roleperm +- name: verify results of remove role permission + assert: + that: + - roleperm is successful + - roleperm is changed + +- name: remove second role permission + cs_role_permission: + role: "{{ testRole.id }}" + name: "fakeRolePerm2" + state: absent + register: roleperm +- name: verify results of remove second role permission + assert: + that: + - roleperm is successful + - roleperm is changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_router/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_router/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_router/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_router/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_router/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_router/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_router/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_router/tasks/main.yml new file mode 100644 index 00000000..9adaa4de --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_router/tasks/main.yml @@ -0,0 +1,183 @@ +--- +- name: setup network + cs_network: + name: "net_router" + zone: "{{ cs_common_zone_adv }}" + network_offering: DefaultSharedNetworkOffering + network_domain: example.com + vlan: 1234 + start_ip: 10.100.12.11 + end_ip: 10.100.12.250 + gateway: 10.100.12.1 + netmask: 255.255.255.0 + register: net +- name: verify setup network + assert: + that: + - net is successful + - net.name == "net_router" + +- name: setup instance + cs_instance: + name: "instance-vm" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + network: "net_router" + state: started + register: instance +- name: verify setup instance + assert: + that: + - instance is successful + - instance.name == "instance-vm" + - instance.state == "Running" + +- name: setup instance starts a router + cs_instance: + name: "instance-vm" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + network: "net_router" + state: started + register: instance +- name: verify setup instance + assert: + that: + - instance is successful + - instance.name == "instance-vm" + - instance.state == "Running" + +- name: setup find the routers name + shell: cs listRouters listall=true networkid="{{ net.id }}" zone="{{ cs_common_zone_adv }}" + args: + chdir: "{{ playbook_dir }}" + register: router + +- debug: + var: router.stdout + +- set_fact: + router_json: "{{ router.stdout | from_json }}" + +- set_fact: + router_name: "{{ router_json.router[0].name }}" + +- name: test router started + cs_router: + name: "{{ router_name }}" + zone: "{{ cs_common_zone_adv }}" + state: started + register: router +- name: verify test router started + assert: + that: + - router is successful + +- name: test stop router in check mode + cs_router: + name: "{{ router_name }}" + zone: "{{ cs_common_zone_adv }}" + state: stopped + check_mode: true + register: router +- name: verify test stop router in check mode + assert: + that: + - router is changed + - router.state == "Running" + - router.service_offering == "System Offering For Software Router" + +- name: test stop router + cs_router: + name: "{{ router_name }}" + zone: "{{ cs_common_zone_adv }}" + state: stopped + register: router +- name: verify test stop router + assert: + that: + - router is changed + - router.state == "Stopped" + - router.service_offering == "System Offering For Software Router" + +- name: test stop router idempotence + cs_router: + name: "{{ router_name }}" + zone: "{{ cs_common_zone_adv }}" + state: stopped + register: router +- name: verify test stop router idempotence + assert: + that: + - router is not changed + - router.state == "Stopped" + - router.service_offering == "System Offering For Software Router" + +- name: test start router in check mode + cs_router: + name: "{{ router_name }}" + zone: "{{ cs_common_zone_adv }}" + state: started + register: router + check_mode: true +- name: verify test start router in check mode + assert: + that: + - router is changed + - router.state == "Stopped" + - router.service_offering == "System Offering For Software Router" + +- name: test start router + cs_router: + name: "{{ router_name }}" + zone: "{{ cs_common_zone_adv }}" + state: started + register: router +- name: verify test start router + assert: + that: + - router is changed + - router.state == "Running" + - router.service_offering == "System Offering For Software Router" + +- name: test start router idempotence + cs_router: + name: "{{ router_name }}" + zone: "{{ cs_common_zone_adv }}" + state: started + register: router +- name: verify test start router idempotence + assert: + that: + - router is not changed + - router.state == "Running" + - router.service_offering == "System Offering For Software Router" + +- name: test restart router in check mode + cs_router: + name: "{{ router_name }}" + zone: "{{ cs_common_zone_adv }}" + state: restarted + register: router + check_mode: true +- name: verify test restart router in check mode + assert: + that: + - router is changed + - router.state == "Running" + - router.service_offering == "System Offering For Software Router" + +- name: test restart router + cs_router: + name: "{{ router_name }}" + zone: "{{ cs_common_zone_adv }}" + state: restarted + register: router +- name: verify test restart router + assert: + that: + - router is changed + - router.state == "Running" + - router.service_offering == "System Offering For Software Router" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup/tasks/main.yml new file mode 100644 index 00000000..1d32d280 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup/tasks/main.yml @@ -0,0 +1,79 @@ +--- +- name: setup + cs_securitygroup: name={{ cs_resource_prefix }}_sg state=absent + register: sg +- name: verify setup + assert: + that: + - sg is successful + +- name: test fail if missing name + action: cs_securitygroup + register: sg + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - sg is failed + - "sg.msg == 'missing required arguments: name'" + +- name: test present security group in check mode + cs_securitygroup: name={{ cs_resource_prefix }}_sg + register: sg + check_mode: true +- name: verify results of create security group in check mode + assert: + that: + - sg is successful + - sg is changed + +- name: test present security group + cs_securitygroup: name={{ cs_resource_prefix }}_sg + register: sg +- name: verify results of create security group + assert: + that: + - sg is successful + - sg is changed + - sg.name == "{{ cs_resource_prefix }}_sg" + +- name: test present security group is idempotence + cs_securitygroup: name={{ cs_resource_prefix }}_sg + register: sg +- name: verify results present security group is idempotence + assert: + that: + - sg is successful + - sg is not changed + - sg.name == "{{ cs_resource_prefix }}_sg" + +- name: test absent security group in check mode + cs_securitygroup: name={{ cs_resource_prefix }}_sg state=absent + register: sg + check_mode: true +- name: verify results of absent security group in check mode + assert: + that: + - sg is successful + - sg is changed + - sg.name == "{{ cs_resource_prefix }}_sg" + +- name: test absent security group + cs_securitygroup: name={{ cs_resource_prefix }}_sg state=absent + register: sg +- name: verify results of absent security group + assert: + that: + - sg is successful + - sg is changed + - sg.name == "{{ cs_resource_prefix }}_sg" + +- name: test absent security group is idempotence + cs_securitygroup: name={{ cs_resource_prefix }}_sg state=absent + register: sg +- name: verify results of absent security group is idempotence + assert: + that: + - sg is successful + - sg is not changed + - sg.name is undefined diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/absent.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/absent.yml new file mode 100644 index 00000000..8f1378e6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/absent.yml @@ -0,0 +1,171 @@ +--- +- name: test remove http range rule in check mode + cs_securitygroup_rule: + security_group: default + start_port: 8000 + end_port: 8888 + cidr: 1.2.3.4/32 + state: absent + register: sg_rule + check_mode: true +- name: verify create http range rule in check mode + assert: + that: + - sg_rule is successful + - sg_rule is changed + - sg_rule.type == 'ingress' + - sg_rule.security_group == 'default' + - sg_rule.protocol == 'tcp' + - sg_rule.start_port == 8000 + - sg_rule.end_port == 8888 + - sg_rule.cidr == '1.2.3.4/32' + +- name: test remove http range rule + cs_securitygroup_rule: + security_group: default + start_port: 8000 + end_port: 8888 + cidr: 1.2.3.4/32 + state: absent + register: sg_rule +- name: verify create http range rule + assert: + that: + - sg_rule is successful + - sg_rule is changed + - sg_rule.type == 'ingress' + - sg_rule.security_group == 'default' + - sg_rule.protocol == 'tcp' + - sg_rule.start_port == 8000 + - sg_rule.end_port == 8888 + - sg_rule.cidr == '1.2.3.4/32' + +- name: test remove http range rule idempotence + cs_securitygroup_rule: + security_group: default + start_port: 8000 + end_port: 8888 + cidr: 1.2.3.4/32 + state: absent + register: sg_rule +- name: verify create http range rule idempotence + assert: + that: + - sg_rule is successful + - sg_rule is not changed + +- name: test remove single port udp rule in check mode + cs_securitygroup_rule: + security_group: default + port: 5353 + protocol: udp + type: egress + user_security_group: '{{ cs_resource_prefix }}_sg' + state: absent + register: sg_rule + check_mode: true +- name: verify remove single port udp rule in check mode + assert: + that: + - sg_rule is successful + - sg_rule is changed + - sg_rule.type == 'egress' + - sg_rule.security_group == 'default' + - sg_rule.protocol == 'udp' + - sg_rule.start_port == 5353 + - sg_rule.end_port == 5353 + - sg_rule.user_security_group == '{{ cs_resource_prefix }}_sg' + +- name: test remove single port udp rule + cs_securitygroup_rule: + security_group: default + port: 5353 + protocol: udp + type: egress + user_security_group: '{{ cs_resource_prefix }}_sg' + state: absent + register: sg_rule +- name: verify remove single port udp rule + assert: + that: + - sg_rule is successful + - sg_rule is changed + - sg_rule.type == 'egress' + - sg_rule.security_group == 'default' + - sg_rule.protocol == 'udp' + - sg_rule.start_port == 5353 + - sg_rule.end_port == 5353 + - sg_rule.user_security_group == '{{ cs_resource_prefix }}_sg' + +- name: test remove single port udp rule idempotence + cs_securitygroup_rule: + security_group: default + port: 5353 + protocol: udp + type: egress + user_security_group: '{{ cs_resource_prefix }}_sg' + state: absent + register: sg_rule +- name: verify remove single port udp rule idempotence + assert: + that: + - sg_rule is successful + - sg_rule is not changed + +- name: test remove icmp rule in check mode + cs_securitygroup_rule: + security_group: default + protocol: icmp + type: ingress + icmp_type: -1 + icmp_code: -1 + state: absent + register: sg_rule + check_mode: true +- name: verify icmp rule in check mode + assert: + that: + - sg_rule is successful + - sg_rule is changed + - sg_rule.type == 'ingress' + - sg_rule.security_group == 'default' + - sg_rule.cidr == '0.0.0.0/0' + - sg_rule.protocol == 'icmp' + - sg_rule.icmp_code == -1 + - sg_rule.icmp_type == -1 + +- name: test remove icmp rule + cs_securitygroup_rule: + security_group: default + protocol: icmp + type: ingress + icmp_type: -1 + icmp_code: -1 + state: absent + register: sg_rule +- name: verify icmp rule + assert: + that: + - sg_rule is successful + - sg_rule is changed + - sg_rule.type == 'ingress' + - sg_rule.security_group == 'default' + - sg_rule.cidr == '0.0.0.0/0' + - sg_rule.protocol == 'icmp' + - sg_rule.icmp_code == -1 + - sg_rule.icmp_type == -1 + +- name: test remove icmp rule idempotence + cs_securitygroup_rule: + security_group: default + protocol: icmp + type: ingress + icmp_type: -1 + icmp_code: -1 + state: absent + register: sg_rule +- name: verify icmp rule idempotence + assert: + that: + - sg_rule is successful + - sg_rule is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/cleanup.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/cleanup.yml new file mode 100644 index 00000000..0fce5328 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/cleanup.yml @@ -0,0 +1,7 @@ +- name: cleanup custom security group + cs_securitygroup: name={{ cs_resource_prefix }}_sg state=absent + register: sg +- name: verify setup + assert: + that: + - sg is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/main.yml new file mode 100644 index 00000000..e76745cb --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/main.yml @@ -0,0 +1,4 @@ +- include: setup.yml +- include: present.yml +- include: absent.yml +- include: cleanup.yml diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/present.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/present.yml new file mode 100644 index 00000000..a2a4e03c --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/present.yml @@ -0,0 +1,163 @@ +--- +- name: test create http range rule in check mode + cs_securitygroup_rule: + security_group: default + start_port: 8000 + end_port: 8888 + cidr: 1.2.3.4/32 + register: sg_rule + check_mode: true +- name: verify create http range rule in check mode + assert: + that: + - sg_rule is successful + - sg_rule is changed + +- name: test create http range rule + cs_securitygroup_rule: + security_group: default + start_port: 8000 + end_port: 8888 + cidr: 1.2.3.4/32 + register: sg_rule +- name: verify create http range rule + assert: + that: + - sg_rule is successful + - sg_rule is changed + - sg_rule.type == 'ingress' + - sg_rule.security_group == 'default' + - sg_rule.protocol == 'tcp' + - sg_rule.start_port == 8000 + - sg_rule.end_port == 8888 + - sg_rule.cidr == '1.2.3.4/32' + +- name: test create http range rule idempotence + cs_securitygroup_rule: + security_group: default + start_port: 8000 + end_port: 8888 + cidr: 1.2.3.4/32 + register: sg_rule +- name: verify create http range rule idempotence + assert: + that: + - sg_rule is successful + - sg_rule is not changed + - sg_rule.type == 'ingress' + - sg_rule.security_group == 'default' + - sg_rule.protocol == 'tcp' + - sg_rule.start_port == 8000 + - sg_rule.end_port == 8888 + - sg_rule.cidr == '1.2.3.4/32' + +- name: test create single port udp rule in check mode + cs_securitygroup_rule: + security_group: default + port: 5353 + protocol: udp + type: egress + user_security_group: '{{ cs_resource_prefix }}_sg' + register: sg_rule + check_mode: true +- name: verify create single port udp rule in check mode + assert: + that: + - sg_rule is successful + - sg_rule is changed + +- name: test create single port udp rule + cs_securitygroup_rule: + security_group: default + port: 5353 + protocol: udp + type: egress + user_security_group: '{{ cs_resource_prefix }}_sg' + register: sg_rule +- name: verify create single port udp rule + assert: + that: + - sg_rule is successful + - sg_rule is changed + - sg_rule.type == 'egress' + - sg_rule.security_group == 'default' + - sg_rule.protocol == 'udp' + - sg_rule.start_port == 5353 + - sg_rule.end_port == 5353 + - sg_rule.user_security_group == '{{ cs_resource_prefix }}_sg' + + +- name: test single port udp rule idempotence + cs_securitygroup_rule: + security_group: default + port: 5353 + protocol: udp + type: egress + user_security_group: '{{ cs_resource_prefix }}_sg' + register: sg_rule +- name: verify single port udp rule idempotence + assert: + that: + - sg_rule is successful + - sg_rule is not changed + - sg_rule.type == 'egress' + - sg_rule.security_group == 'default' + - sg_rule.protocol == 'udp' + - sg_rule.start_port == 5353 + - sg_rule.end_port == 5353 + - sg_rule.user_security_group == '{{ cs_resource_prefix }}_sg' + +- name: test icmp rule in check mode + cs_securitygroup_rule: + security_group: default + protocol: icmp + type: ingress + icmp_type: -1 + icmp_code: -1 + register: sg_rule + check_mode: true +- name: verify icmp rule in check mode + assert: + that: + - sg_rule is successful + - sg_rule is changed + +- name: test icmp rule + cs_securitygroup_rule: + security_group: default + protocol: icmp + type: ingress + icmp_type: -1 + icmp_code: -1 + register: sg_rule +- name: verify icmp rule + assert: + that: + - sg_rule is successful + - sg_rule is changed + - sg_rule.type == 'ingress' + - sg_rule.security_group == 'default' + - sg_rule.cidr == '0.0.0.0/0' + - sg_rule.protocol == 'icmp' + - sg_rule.icmp_code == -1 + - sg_rule.icmp_type == -1 + +- name: test icmp rule idempotence + cs_securitygroup_rule: + security_group: default + protocol: icmp + type: ingress + icmp_type: -1 + icmp_code: -1 + register: sg_rule +- name: verify icmp rule idempotence + assert: + that: + - sg_rule is successful + - sg_rule is not changed + - sg_rule.type == 'ingress' + - sg_rule.security_group == 'default' + - sg_rule.cidr == '0.0.0.0/0' + - sg_rule.protocol == 'icmp' + - sg_rule.icmp_code == -1 + - sg_rule.icmp_type == -1 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/setup.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/setup.yml new file mode 100644 index 00000000..85625205 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_securitygroup_rule/tasks/setup.yml @@ -0,0 +1,56 @@ +- name: setup custom security group + cs_securitygroup: name={{ cs_resource_prefix }}_sg + register: sg +- name: verify setup + assert: + that: + - sg is successful + +- name: setup default security group + cs_securitygroup: name=default + register: sg +- name: verify setup + assert: + that: + - sg is successful + +- name: setup remove icmp rule + cs_securitygroup_rule: + security_group: default + protocol: icmp + type: ingress + icmp_type: -1 + icmp_code: -1 + state: absent + register: sg_rule +- name: verify remove icmp rule + assert: + that: + - sg_rule is successful + +- name: setup remove http range rule + cs_securitygroup_rule: + security_group: default + start_port: 8000 + end_port: 8888 + cidr: 1.2.3.4/32 + state: absent + register: sg_rule +- name: verify remove http range rule + assert: + that: + - sg_rule is successful + +- name: setup remove single port udp rule + cs_securitygroup_rule: + security_group: default + port: 5353 + protocol: udp + type: egress + user_security_group: '{{ cs_resource_prefix }}-user-sg' + state: absent + register: sg_rule +- name: verify remove single port udp rule + assert: + that: + - sg_rule is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/tasks/guest_vm_service_offering.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/tasks/guest_vm_service_offering.yml new file mode 100644 index 00000000..f7aee3c8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/tasks/guest_vm_service_offering.yml @@ -0,0 +1,223 @@ +--- +- name: setup service offering + cs_service_offering: + name: Micro + state: absent + register: so +- name: verify setup service offering + assert: + that: + - so is successful + +- name: create service offering in check mode + cs_service_offering: + name: Micro + display_text: Micro 512mb 1cpu + cpu_number: 1 + cpu_speed: 2198 + memory: 512 + host_tags: eco + storage_tags: + - eco + - backup + storage_type: local + register: so + check_mode: true +- name: verify create service offering in check mode + assert: + that: + - so is changed + +- name: create service offering + cs_service_offering: + name: Micro + display_text: Micro 512mb 1cpu + cpu_number: 1 + cpu_speed: 2198 + memory: 512 + host_tags: eco + storage_tags: + - eco + - backup + storage_type: local + register: so +- name: verify create service offering + assert: + that: + - so is changed + - so.name == "Micro" + - so.display_text == "Micro 512mb 1cpu" + - so.cpu_number == 1 + - so.cpu_speed == 2198 + - so.memory == 512 + - so.host_tags == ['eco'] + - so.storage_tags == ['eco', 'backup'] + - so.storage_type == "local" + +- name: create service offering idempotence + cs_service_offering: + name: Micro + display_text: Micro 512mb 1cpu + cpu_number: 1 + cpu_speed: 2198 + memory: 512 + host_tags: eco + storage_tags: + - eco + - backup + storage_type: local + register: so +- name: verify create service offering idempotence + assert: + that: + - so is not changed + - so.name == "Micro" + - so.display_text == "Micro 512mb 1cpu" + - so.cpu_number == 1 + - so.cpu_speed == 2198 + - so.memory == 512 + - so.host_tags == ['eco'] + - so.storage_tags == ['eco', 'backup'] + - so.storage_type == "local" + +- name: update service offering in check mode + cs_service_offering: + name: Micro + display_text: Micro RAM 512MB 1vCPU + register: so + check_mode: true +- name: verify create update offering in check mode + assert: + that: + - so is changed + - so.name == "Micro" + - so.display_text == "Micro 512mb 1cpu" + - so.cpu_number == 1 + - so.cpu_speed == 2198 + - so.memory == 512 + - so.host_tags == ['eco'] + - so.storage_tags == ['eco', 'backup'] + - so.storage_type == "local" + +- name: update service offering + cs_service_offering: + name: Micro + display_text: Micro RAM 512MB 1vCPU + register: so +- name: verify update service offerin + assert: + that: + - so is changed + - so.name == "Micro" + - so.display_text == "Micro RAM 512MB 1vCPU" + - so.cpu_number == 1 + - so.cpu_speed == 2198 + - so.memory == 512 + - so.host_tags == ['eco'] + - so.storage_tags == ['eco', 'backup'] + - so.storage_type == "local" + +- name: update service offering idempotence + cs_service_offering: + name: Micro + display_text: Micro RAM 512MB 1vCPU + register: so +- name: verify update service offering idempotence + assert: + that: + - so is not changed + - so.name == "Micro" + - so.display_text == "Micro RAM 512MB 1vCPU" + - so.cpu_number == 1 + - so.cpu_speed == 2198 + - so.memory == 512 + - so.host_tags == ['eco'] + - so.storage_tags == ['eco', 'backup'] + - so.storage_type == "local" + +- name: remove service offering in check mode + cs_service_offering: + name: Micro + state: absent + check_mode: true + register: so +- name: verify remove service offering in check mode + assert: + that: + - so is changed + - so.name == "Micro" + - so.display_text == "Micro RAM 512MB 1vCPU" + - so.cpu_number == 1 + - so.cpu_speed == 2198 + - so.memory == 512 + - so.host_tags == ['eco'] + - so.storage_tags == ['eco', 'backup'] + - so.storage_type == "local" + +- name: remove service offering + cs_service_offering: + name: Micro + state: absent + register: so +- name: verify remove service offering + assert: + that: + - so is changed + - so.name == "Micro" + - so.display_text == "Micro RAM 512MB 1vCPU" + - so.cpu_number == 1 + - so.cpu_speed == 2198 + - so.memory == 512 + - so.host_tags == ['eco'] + - so.storage_tags == ['eco', 'backup'] + - so.storage_type == "local" + +- name: remove service offering idempotence + cs_service_offering: + name: Micro + state: absent + register: so +- name: verify remove service offering idempotence + assert: + that: + - so is not changed + +- name: create custom service offering + cs_service_offering: + name: custom + display_text: custom offer + is_customized: yes + host_tags: eco + storage_tags: + - eco + - backup + storage_type: local + register: so +- name: verify create custom service offering + assert: + that: + - so is changed + - so.name == "custom" + - so.display_text == "custom offer" + - so.is_customized == True + - so.cpu_number is not defined + - so.cpu_speed is not defined + - so.memory is not defined + - so.host_tags == ['eco'] + - so.storage_tags == ['eco', 'backup'] + - so.storage_type == "local" + +- name: remove custom service offering + cs_service_offering: + name: custom + state: absent + register: so +- name: verify remove service offering + assert: + that: + - so is changed + - so.name == "custom" + - so.display_text == "custom offer" + - so.host_tags == ['eco'] + - so.storage_tags == ['eco', 'backup'] + - so.storage_type == "local" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/tasks/main.yml new file mode 100644 index 00000000..581f7d74 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- import_tasks: guest_vm_service_offering.yml +- import_tasks: system_vm_service_offering.yml
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/tasks/system_vm_service_offering.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/tasks/system_vm_service_offering.yml new file mode 100644 index 00000000..4c63a4b9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_service_offering/tasks/system_vm_service_offering.yml @@ -0,0 +1,151 @@ +--- +- name: setup system offering + cs_service_offering: + name: System Offering for Ansible + is_system: true + state: absent + register: so +- name: verify setup system offering + assert: + that: + - so is successful + +- name: fail missing storage type and is_system + cs_service_offering: + name: System Offering for Ansible + cpu_number: 1 + cpu_speed: 500 + memory: 512 + host_tag: perf + storage_tag: perf + storage_type: shared + offer_ha: true + limit_cpu_usage: false + is_system: true + register: so + ignore_errors: true +- name: verify create system service offering in check mode + assert: + that: + - so is failed + - so.msg.startswith('missing required arguments:') + +- name: create system service offering in check mode + cs_service_offering: + name: System Offering for Ansible + cpu_number: 1 + cpu_speed: 500 + memory: 512 + host_tag: perf + storage_tag: perf + storage_type: shared + offer_ha: true + limit_cpu_usage: false + system_vm_type: domainrouter + is_system: true + register: so + check_mode: true +- name: verify create system service offering in check mode + assert: + that: + - so is changed + +- name: create system service offering + cs_service_offering: + name: System Offering for Ansible + cpu_number: 1 + cpu_speed: 500 + memory: 512 + host_tag: perf + storage_tag: perf + storage_type: shared + offer_ha: true + limit_cpu_usage: false + system_vm_type: domainrouter + is_system: true + register: so +- name: verify create system service offering + assert: + that: + - so is changed + - so.name == "System Offering for Ansible" + - so.display_text == "System Offering for Ansible" + - so.cpu_number == 1 + - so.cpu_speed == 500 + - so.memory == 512 + - so.host_tags == ['perf'] + - so.storage_tags == ['perf'] + - so.storage_type == "shared" + - so.offer_ha == true + - so.limit_cpu_usage == false + - so.system_vm_type == "domainrouter" + - so.is_system == true + +- name: create system service offering idempotence + cs_service_offering: + name: System Offering for Ansible + cpu_number: 1 + cpu_speed: 500 + memory: 512 + host_tag: perf + storage_tag: perf + storage_type: shared + offer_ha: true + limit_cpu_usage: false + system_vm_type: domainrouter + is_system: true + register: so +- name: verify create system service offering idempotence + assert: + that: + - so is not changed + - so.name == "System Offering for Ansible" + - so.display_text == "System Offering for Ansible" + - so.cpu_number == 1 + - so.cpu_speed == 500 + - so.memory == 512 + - so.host_tags == ['perf'] + - so.storage_tags == ['perf'] + - so.storage_type == "shared" + - so.offer_ha == true + - so.limit_cpu_usage == false + - so.system_vm_type == "domainrouter" + - so.is_system == true + +- name: remove system service offering in check mode + cs_service_offering: + name: System Offering for Ansible + is_system: true + state: absent + check_mode: true + register: so +- name: verify remove system service offering in check mode + assert: + that: + - so is changed + - so.name == "System Offering for Ansible" + - so.is_system == true + +- name: remove system service offering + cs_service_offering: + name: System Offering for Ansible + is_system: true + state: absent + register: so +- name: verify remove system service offering + assert: + that: + - so is changed + - so.name == "System Offering for Ansible" + - so.is_system == true + +- name: remove system service offering idempotence + cs_service_offering: + name: System Offering for Ansible + is_system: true + state: absent + register: so +- name: verify remove system service offering idempotence + assert: + that: + - so is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_snapshot_policy/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_snapshot_policy/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_snapshot_policy/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_snapshot_policy/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_snapshot_policy/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_snapshot_policy/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_snapshot_policy/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_snapshot_policy/tasks/main.yml new file mode 100644 index 00000000..d5ba1bdc --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_snapshot_policy/tasks/main.yml @@ -0,0 +1,176 @@ +--- +- name: setup instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-snapshot-policy" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + register: instance +- name: verify setup instance + assert: + that: + - instance is successful + +- name: setup snapshot policy absent + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + state: absent + register: snapshot +- name: verify setup snapshot policy absent + assert: + that: + - snapshot is successful + +- name: create snapshot policy in check mode + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + schedule: 5 + check_mode: true + register: snapshot +- name: verify create snapshot policy in check mode + assert: + that: + - snapshot is changed + +- name: create snapshot policy + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + schedule: 5 + register: snapshot +- name: verify create snapshot policy + assert: + that: + - snapshot is changed + - snapshot.schedule == "5" + - snapshot.interval_type == "hourly" + - snapshot.volume != "" + +- name: create snapshot policy idempotence + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + schedule: 5 + register: snapshot +- name: verify create snapshot policy idempotence + assert: + that: + - snapshot is not changed + - snapshot.schedule == "5" + - snapshot.interval_type == "hourly" + - snapshot.volume != "" + +- name: update snapshot policy + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + schedule: 6 + check_mode: true + register: snapshot +- name: verify update snapshot policy + assert: + that: + - snapshot is changed + - snapshot.schedule == "5" + - snapshot.interval_type == "hourly" + - snapshot.volume != "" + +- name: update snapshot policy in check mode + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + schedule: 6 + max_snaps: 3 + time_zone: "Europe/Zurich" + check_mode: true + register: snapshot +- name: verify update snapshot policy in check mode + assert: + that: + - snapshot is changed + - snapshot.schedule == "5" + - snapshot.interval_type == "hourly" + - snapshot.volume != "" + - snapshot.max_snaps == 8 + - snapshot.time_zone == "UTC" + +- name: update snapshot policy + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + schedule: 6 + max_snaps: 3 + time_zone: "Europe/Zurich" + register: snapshot +- name: verify update snapshot policy + assert: + that: + - snapshot is changed + - snapshot.schedule == "6" + - snapshot.interval_type == "hourly" + - snapshot.volume != "" + - snapshot.max_snaps == 3 + - snapshot.time_zone == "Europe/Zurich" + +- name: update snapshot policy idempotence + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + schedule: 6 + max_snaps: 3 + time_zone: "Europe/Zurich" + register: snapshot +- name: verify update snapshot policy idempotence + assert: + that: + - snapshot is not changed + - snapshot.schedule == "6" + - snapshot.interval_type == "hourly" + - snapshot.volume != "" + - snapshot.max_snaps == 3 + - snapshot.time_zone == "Europe/Zurich" + +- name: remove snapshot policy in check mode + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + state: absent + check_mode: true + register: snapshot +- name: verify remove snapshot policy in check mode + assert: + that: + - snapshot is changed + - snapshot.schedule == "6" + - snapshot.interval_type == "hourly" + - snapshot.volume != "" + - snapshot.max_snaps == 3 + - snapshot.time_zone == "Europe/Zurich" + +- name: remove snapshot policy + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + state: absent + register: snapshot +- name: verify remove snapshot policy + assert: + that: + - snapshot is changed + - snapshot.schedule == "6" + - snapshot.interval_type == "hourly" + - snapshot.volume != "" + - snapshot.max_snaps == 3 + - snapshot.time_zone == "Europe/Zurich" + +- name: remove snapshot policy idempotence + cs_snapshot_policy: + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" + interval_type: hourly + state: absent + register: snapshot +- name: verify remove snapshot policy idempotence + assert: + that: + - snapshot is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_sshkeypair/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_sshkeypair/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_sshkeypair/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_sshkeypair/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_sshkeypair/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_sshkeypair/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_sshkeypair/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_sshkeypair/tasks/main.yml new file mode 100644 index 00000000..89aa2522 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_sshkeypair/tasks/main.yml @@ -0,0 +1,197 @@ +--- +- name: setup cleanup + cs_sshkeypair: + name: "{{ item }}" + state: absent + register: sshkey + with_items: + - first-sshkey + - first-sshkey-renamed + - second-sshkey +- name: verify setup cleanup + assert: + that: + - sshkey is success + +- name: test fail on missing name + action: cs_sshkeypair + ignore_errors: true + register: sshkey +- name: verify results of fail on missing name + assert: + that: + - sshkey is failed + - "sshkey.msg == 'missing required arguments: name'" + +- name: test ssh key creation in check mode + cs_sshkeypair: + name: first-sshkey + register: sshkey + check_mode: true +- name: verify results of ssh key creation in check mode + assert: + that: + - sshkey is successful + - sshkey is changed + +- name: test ssh key creation + cs_sshkeypair: + name: first-sshkey + register: sshkey +- name: verify results of ssh key creation + assert: + that: + - sshkey is successful + - sshkey is changed + - sshkey.fingerprint is defined and sshkey.fingerprint != "" + - sshkey.private_key is defined and sshkey.private_key != "" + - sshkey.name == "first-sshkey" + +- name: test ssh key creation idempotence + cs_sshkeypair: + name: first-sshkey + register: sshkey2 +- name: verify results of ssh key creation idempotence + assert: + that: + - sshkey2 is successful + - sshkey2 is not changed + - sshkey2.fingerprint is defined and sshkey2.fingerprint == sshkey.fingerprint + - sshkey2.private_key is not defined + - sshkey2.name == "first-sshkey" + +- name: test replace ssh public key in check mode + cs_sshkeypair: + name: first-sshkey + public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch" + register: sshkey2 + check_mode: true +- name: verify results of replace ssh public key in check mode + assert: + that: + - sshkey2 is successful + - sshkey2 is changed + - sshkey2.fingerprint is defined and sshkey2.fingerprint == sshkey.fingerprint + - sshkey2.private_key is not defined + - sshkey2.name == "first-sshkey" + +- name: test replace ssh public key + cs_sshkeypair: + name: first-sshkey + public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch" + register: sshkey3 +- name: verify results of replace ssh public key + assert: + that: + - sshkey3 is changed + - sshkey3.fingerprint is defined and sshkey3.fingerprint != sshkey2.fingerprint + - sshkey3.private_key is not defined + - sshkey3.name == "first-sshkey" + +- name: test replace ssh public key idempotence + cs_sshkeypair: + name: first-sshkey + public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch" + register: sshkey4 +- name: verify results of ssh public key idempotence + assert: + that: + - sshkey4 is not changed + - sshkey4.fingerprint is defined and sshkey4.fingerprint == sshkey3.fingerprint + - sshkey4.private_key is not defined + - sshkey4.name == "first-sshkey" + +- name: test rename ssh key in check mode + cs_sshkeypair: + name: first-sshkey-renamed + public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch" + register: sshkey4 + check_mode: true +- name: verify test rename ssh key in check mode + assert: + that: + - sshkey4 is changed + - sshkey4.fingerprint is defined and sshkey4.fingerprint == sshkey3.fingerprint + - sshkey4.private_key is not defined + - sshkey4.name == "first-sshkey" + +- name: test rename ssh key + cs_sshkeypair: + name: first-sshkey-renamed + public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch" + register: sshkey4 +- name: verify test rename ssh key + assert: + that: + - sshkey4 is changed + - sshkey4.fingerprint is defined and sshkey4.fingerprint == sshkey3.fingerprint + - sshkey4.private_key is not defined + - sshkey4.name == "first-sshkey-renamed" + +- name: test rename ssh key idempotence + cs_sshkeypair: + name: first-sshkey-renamed + public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch" + register: sshkey4 +- name: verify test rename ssh key idempotence + assert: + that: + - sshkey4 is not changed + - sshkey4.fingerprint is defined and sshkey4.fingerprint == sshkey3.fingerprint + - sshkey4.private_key is not defined + - sshkey4.name == "first-sshkey-renamed" + +- name: setup ssh key with name "second-sshkey" + cs_sshkeypair: + name: second-sshkey + +- name: test different but exisitng name but same ssh public key as first-sshkey + cs_sshkeypair: + name: second-sshkey + public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch" + register: sshkey +- name: verify test different but exisitng name but same ssh public key as first-sshkey + assert: + that: + - sshkey is changed + - sshkey.fingerprint is defined and sshkey.fingerprint == sshkey4.fingerprint + - sshkey.private_key is not defined + - sshkey.name == "second-sshkey" + +- name: test ssh key absent in check mode + cs_sshkeypair: name=second-sshkey state=absent + register: sshkey5 + check_mode: true +- name: verify result of key absent in check mode + assert: + that: + - sshkey5 is changed + - sshkey5.fingerprint is defined and sshkey5.fingerprint == sshkey3.fingerprint + - sshkey5.private_key is not defined + - sshkey5.name == "second-sshkey" + +- name: test ssh key absent + cs_sshkeypair: + name: second-sshkey + state: absent + register: sshkey5 +- name: verify result of key absent + assert: + that: + - sshkey5 is changed + - sshkey5.fingerprint is defined and sshkey5.fingerprint == sshkey3.fingerprint + - sshkey5.private_key is not defined + - sshkey5.name == "second-sshkey" + +- name: test ssh key absent idempotence + cs_sshkeypair: + name: second-sshkey + state: absent + register: sshkey6 +- name: verify result of ssh key absent idempotence + assert: + that: + - sshkey6 is not changed + - sshkey6.fingerprint is not defined + - sshkey6.private_key is not defined + - sshkey6.name is not defined diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_storage_pool/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_storage_pool/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_storage_pool/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_storage_pool/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_storage_pool/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_storage_pool/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_storage_pool/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_storage_pool/tasks/main.yml new file mode 100644 index 00000000..a418b984 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_storage_pool/tasks/main.yml @@ -0,0 +1,465 @@ +--- +- name: setup host is present + cs_host: + name: sim + url: "http://sim/c0-basic/h2" + cluster: C0-adv + pod: POD0-adv + username: root + password: password + hypervisor: Simulator + allocation_state: enabled + zone: "{{ cs_common_zone_adv }}" + register: host +- name: verify setup host is present + assert: + that: + - host is successful + +- name: setup storage pool is absent + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: sp +- name: verify setup storage pool is absent + assert: + that: + - sp is successful + +- name: test fail if missing params + cs_storage_pool: + register: sp + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - sp is failed + - "sp.msg == 'missing required arguments: name'" + +- name: test fail if provider unknown + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + provider: DNE + scope: cluster + cluster: C0-adv + pod: POD0-adv + register: sp + ignore_errors: true +- name: verify test fail if provider unknown + assert: + that: + - sp is failed + - "sp.msg == 'Storage provider DNE not found'" + +- name: test fail if cluster unknown + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: DNE + pod: POD0-adv + register: sp + ignore_errors: true +- name: verify test fail if cluster unknown + assert: + that: + - sp is failed + - "sp.msg == 'Cluster DNE not found'" + +- name: test fail if pod unknown + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: DNE + register: sp + ignore_errors: true +- name: verify test fail if pod unknown + assert: + that: + - sp is failed + - "'Pod DNE not found' in sp.msg" + +- name: create storage pool in check mode + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + register: sp + check_mode: true +- name: verify create storage pool in check mode + assert: + that: + - sp is successful + - sp is changed + +- name: create storage pool + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + register: sp +- name: verify create storage pool + assert: + that: + - sp is successful + - sp is changed + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: create storage pool idempotence + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + cluster: C0-adv + pod: POD0-adv + register: sp +- name: verify create storage pool idempotence + assert: + that: + - sp is successful + - sp is not changed + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: disable storage pool in check mode + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + cluster: C0-adv + pod: POD0-adv + allocation_state: disabled + check_mode: true + register: sp +- name: verify disable storage pool in check mode + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'enabled' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: disable storage pool + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + allocation_state: disabled + register: sp +- name: verify disable storage pool + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'disabled' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: disable storage pool idempotence + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + allocation_state: disabled + register: sp +- name: verify disable storage pool idempotence + assert: + that: + - sp is successful + - sp is not changed + - sp.allocation_state == 'disabled' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: update while storage pool disabled in check mode + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + storage_tags: + - eco + - ssd + check_mode: true + register: sp +- name: verify update while storage pool disabled in check mode + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'disabled' + - sp.storage_tags == [] + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: update while storage pool disabled + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + storage_tags: + - eco + - ssd + register: sp +- name: verify update while storage pool disabled + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'disabled' + - sp.storage_tags == ['eco', 'ssd'] + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: update while storage pool disabled idempotence + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + storage_tags: + - eco + - ssd + register: sp +- name: verify update while storage pool disabled idempotence + assert: + that: + - sp is successful + - sp is not changed + - sp.allocation_state == 'disabled' + - sp.storage_tags == ['eco', 'ssd'] + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: put storage in maintenance pool in check mode + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + allocation_state: maintenance + check_mode: true + register: sp +- name: verify put storage in maintenance pool in check mode + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'disabled' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: put storage in maintenance pool + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + allocation_state: maintenance + register: sp +- name: verify put storage in maintenance pool + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'maintenance' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: put storage in maintenance pool idempotence + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + allocation_state: maintenance + register: sp +- name: verify put storage in maintenance pool idempotence + assert: + that: + - sp is successful + - sp is not changed + - sp.allocation_state == 'maintenance' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: update while in maintenance pool + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + storage_tag: perf + register: sp +- name: verify update while in maintenance pool + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'maintenance' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + - sp.storage_tags == ['perf'] + +- name: remove storage pool in check mode + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: sp + check_mode: true +- name: verify remove storage pool in check mode + assert: + that: + - sp is successful + - sp is changed + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: remove storage pool + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: sp +- name: verify remove storage pool + assert: + that: + - sp is successful + - sp is changed + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: remove storage pool idempotence + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: sp +- name: verify remove storage pool idempotence + assert: + that: + - sp is successful + - sp is not changed + +- name: create storage pool in maintenance + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + allocation_state: maintenance + register: sp +- name: verify create storage pool in maintenance + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'maintenance' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: remove storage pool in maintenance + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: sp +- name: verify storage pool in maintenance + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'maintenance' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: create storage pool disabled + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname + scope: cluster + cluster: C0-adv + pod: POD0-adv + allocation_state: disabled + register: sp +- name: verify create storage pool in disabled + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'disabled' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" + +- name: verify remove disabled storag e pool + cs_storage_pool: + name: "storage_pool_adv" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: sp +- name: verify remove disabled storage pool + assert: + that: + - sp is successful + - sp is changed + - sp.allocation_state == 'disabled' + - sp.cluster == "C0-adv" + - sp.pod == "POD0-adv" + - sp.storage_url == "RBD://ceph-mons.domain/poolname" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/defaults/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/defaults/main.yml new file mode 100644 index 00000000..80f67305 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/defaults/main.yml @@ -0,0 +1,5 @@ +--- +cs_template_hypervisor: Simulator +cs_template_os_type: Other Linux (64-bit) +cs_template_url: http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova +cs_template_format: OVA diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/tasks/main.yml new file mode 100644 index 00000000..ffeaa8a0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- import_tasks: test1.yml +- import_tasks: test2.yml diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/tasks/test1.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/tasks/test1.yml new file mode 100644 index 00000000..755394fa --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/tasks/test1.yml @@ -0,0 +1,160 @@ +--- +- name: setup template + cs_template: + name: "ansible-template-test1" + state: absent + register: template +- name: verify setup template + assert: + that: + - template is successful + +- name: test download template in check mode + cs_template: + name: "ansible-template-test1" + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + cross_zones: yes + register: template + check_mode: yes +- name: verify test download template in check mode + assert: + that: + - template is changed + +- name: test download template + cs_template: + name: "ansible-template-test1" + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + cross_zones: yes + register: template +- name: verify test download template + assert: + that: + - template is changed + - template.name == "ansible-template-test1" + - template.display_text == "ansible-template-test1" + - template.cross_zones == true + +- name: test download template idempotence + cs_template: + name: "ansible-template-test1" + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + cross_zones: yes + register: template +- name: verify test download template idempotence + assert: + that: + - template is not changed + - template.name == "ansible-template-test1" + - template.display_text == "ansible-template-test1" + - template.cross_zones == true + +- name: test update template in check mode + cs_template: + name: "ansible-template-test1" + display_text: "{{ cs_resource_prefix }}-template display_text" + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + is_featured: yes + cross_zones: yes + register: template + check_mode: yes +- name: verify test update template in check mode + assert: + that: + - template is changed + - template.name == "ansible-template-test1" + - template.display_text == "ansible-template-test1" + - template.cross_zones == true + - template.is_featured == false + +- name: test update template + cs_template: + name: "ansible-template-test1" + display_text: "{{ cs_resource_prefix }}-template display_text" + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + is_featured: yes + cross_zones: yes + register: template +- name: verify test update template + assert: + that: + - template is changed + - template.name == "ansible-template-test1" + - template.display_text == "{{ cs_resource_prefix }}-template display_text" + - template.cross_zones == true + - template.is_featured == true + +- name: test update template idempotence + cs_template: + name: "ansible-template-test1" + display_text: "{{ cs_resource_prefix }}-template display_text" + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + is_featured: yes + cross_zones: yes + register: template +- name: verify test update template idempotence + assert: + that: + - template is not changed + - template.name == "ansible-template-test1" + - template.display_text == "{{ cs_resource_prefix }}-template display_text" + - template.cross_zones == true + - template.is_featured == true + +- name: test remove template in check mode + cs_template: + name: "ansible-template-test1" + state: absent + cross_zones: yes + register: template + check_mode: yes +- name: verify test remove template in check mode + assert: + that: + - template is changed + - template.name == "ansible-template-test1" + - template.display_text == "{{ cs_resource_prefix }}-template display_text" + - template.cross_zones == true + +- name: test remove template + cs_template: + name: "ansible-template-test1" + state: absent + cross_zones: yes + register: template +- name: verify test remove template + assert: + that: + - template is changed + - template.name == "ansible-template-test1" + - template.display_text == "{{ cs_resource_prefix }}-template display_text" + - template.cross_zones == true + +- name: test remove template idempotence + cs_template: + name: "ansible-template-test1" + state: absent + cross_zones: yes + register: template +- name: verify test remove template idempotence + assert: + that: + - template is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/tasks/test2.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/tasks/test2.yml new file mode 100644 index 00000000..d5d44453 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_template/tasks/test2.yml @@ -0,0 +1,181 @@ +--- +- name: setup template first template + cs_template: + name: ansible-template-test2 + display_text: first template + state: absent + cross_zones: yes + template_find_options: display_text + register: template +- name: verify setup template first template + assert: + that: + - template is successful + +- name: setup template second template + cs_template: + name: ansible-template-test2 + display_text: second template + state: absent + cross_zones: yes + template_find_options: display_text + register: template +- name: verify setup template second template + assert: + that: + - template is successful + +- name: test register first template + cs_template: + name: ansible-template-test2 + display_text: first template + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + cross_zones: yes + template_find_options: display_text + register: template_first +- name: verify test register first template + assert: + that: + - template_first is changed + - template_first.name == "ansible-template-test2" + - template_first.display_text == "first template" + - template_first.cross_zones == true + +- name: test register second template + cs_template: + name: ansible-template-test2 + display_text: second template + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + cross_zones: yes + template_find_options: display_text + register: template_second +- name: verify test register second template + assert: + that: + - template_second is changed + - template_second.name == "ansible-template-test2" + - template_second.display_text == "second template" + - template_second.cross_zones == true + - template_second.id != template_first.id + +- name: test multiple template same name absent without find options + cs_template: + name: ansible-template-test2 + state: absent + cross_zones: yes + register: template + ignore_errors: yes +- name: verify test multiple template same name absent without find options + assert: + that: + - template is failed + - template.msg.startswith('Multiple templates found') + +- name: test update second template + cs_template: + name: ansible-template-test2 + display_text: second template + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + is_featured: yes + is_public: yes + cross_zones: yes + template_find_options: display_text + register: template +- name: verify test update second template + assert: + that: + - template is changed + - template.name == "ansible-template-test2" + - template.display_text == "second template" + - template.cross_zones == true + - template.id == template_second.id + - template.is_featured == true + - template.is_public == true + +- name: test update second template idempotence + cs_template: + name: ansible-template-test2 + display_text: second template + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + is_featured: yes + is_public: yes + cross_zones: yes + template_find_options: display_text + register: template +- name: verify test update second template idempotence + assert: + that: + - template is not changed + - template.name == "ansible-template-test2" + - template.display_text == "second template" + - template.cross_zones == true + - template.id == template_second.id + - template.is_featured == true + +- name: test update second template idempotence 2 + cs_template: + name: ansible-template-test2 + display_text: second template + url: "{{ cs_template_url }}" + format: "{{ cs_template_format }}" + hypervisor: "{{ cs_template_hypervisor }}" + os_type: "{{ cs_template_os_type }}" + cross_zones: yes + template_find_options: display_text + register: template +- name: verify test update second template idempotence + assert: + that: + - template is not changed + - template.name == "ansible-template-test2" + - template.display_text == "second template" + - template.cross_zones == true + - template.id == template_second.id + +- name: test delete first template + cs_template: + name: ansible-template-test2 + display_text: first template + state: absent + cross_zones: yes + template_find_options: display_text + register: template +- name: verify test delete first template + assert: + that: + - template is changed + - template.name == "ansible-template-test2" + - template.display_text == "first template" + - template.cross_zones == true + - template.id == template_first.id + - template.is_featured == false + +- name: test delete second template + cs_template: + name: ansible-template-test2 + display_text: second template + state: absent + cross_zones: yes + template_find_options: display_text + register: template +- name: verify test delete second template + assert: + that: + - template is changed + - template.name == "ansible-template-test2" + - template.display_text == "second template" + - template.cross_zones == true + - template.id == template_second.id + - template.is_featured == true diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_traffic_type/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_traffic_type/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_traffic_type/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_traffic_type/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_traffic_type/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_traffic_type/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_traffic_type/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_traffic_type/tasks/main.yml new file mode 100644 index 00000000..76d42054 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_traffic_type/tasks/main.yml @@ -0,0 +1,174 @@ +--- +# Create a new zone - the default one is enabled +- name: assure zone for tests + cs_zone: + name: cs-test-zone + state: present + dns1: 8.8.8.8 + network_type: Advanced + register: cszone + +- name: ensure the zone is disabled + cs_zone: + name: "{{ cszone.name }}" + state: disabled + register: cszone + +- name: setup a network + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + isolation_method: VLAN + broadcast_domain_range: ZONE + ignore_errors: true + register: pn + + +- name: fail on missing params + cs_traffic_type: + zone: "{{ pn.zone }}" + ignore_errors: true + register: tt +- name: validate fail on missing params + assert: + that: + - tt is failed + - 'tt.msg == "missing required arguments: physical_network, traffic_type"' + +- name: add a traffic type in check mode + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Guest + zone: "{{ pn.zone }}" + register: tt + check_mode: yes +- name: validate add a traffic type in check mode + assert: + that: + - tt is changed + - tt.zone == pn.zone + +- name: add a traffic type + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Guest + zone: "{{ pn.zone }}" + register: tt +- name: validate add a traffic type + assert: + that: + - tt is changed + - tt.physical_network == pn.id + - tt.traffic_type == 'Guest' + - tt.zone == pn.zone + +- name: add a traffic type idempotence + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Guest + zone: "{{ pn.zone }}" + register: tt +- name: validate add a traffic type idempotence + assert: + that: + - tt is not changed + - tt.physical_network == pn.id + - tt.traffic_type == 'Guest' + - tt.zone == pn.zone + +- name: update traffic type + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Guest + kvm_networklabel: cloudbr0 + zone: "{{ pn.zone }}" + register: tt +- name: validate update traffic type + assert: + that: + - tt is changed + - tt.physical_network == pn.id + - tt.traffic_type == 'Guest' + - tt.zone == pn.zone + - tt.kvm_networklabel == 'cloudbr0' + +- name: update traffic type idempotence + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Guest + kvm_networklabel: cloudbr0 + zone: "{{ pn.zone }}" + register: tt +- name: validate update traffic type idempotence + assert: + that: + - tt is not changed + - tt.physical_network == pn.id + - tt.traffic_type == 'Guest' + - tt.zone == pn.zone + - tt.kvm_networklabel == 'cloudbr0' + +- name: add a removable traffic type + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Public + kvm_networklabel: cloudbr1 + zone: "{{ pn.zone }}" + register: tt +- name: validate add a removable traffic type + assert: + that: + - tt is changed + - tt.physical_network == pn.id + - tt.traffic_type == 'Public' + - tt.zone == pn.zone + - tt.kvm_networklabel == 'cloudbr1' + +- name: remove traffic type in check mode + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Public + state: absent + zone: "{{ pn.zone }}" + check_mode: yes + register: tt +- name: validate remove traffic type in check mode + assert: + that: + - tt is changed + +- name: remove traffic type + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Public + state: absent + zone: "{{ pn.zone }}" + register: tt +- name: validate remove traffic type + assert: + that: + - tt is changed + - tt.zone == pn.zone + +- name: remove traffic type idempotence + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Public + state: absent + zone: "{{ pn.zone }}" + register: tt +- name: validate + assert: + that: + - tt is not changed + - tt.zone == pn.zone + +- name: cleanup + block: + - cs_physical_network: + name: "{{ pn.name }}" + zone: "{{ cszone.name }}" + state: absent + - cs_zone: + name: "{{ cszone.name }}" + state: absent diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_user/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_user/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_user/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_user/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_user/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_user/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_user/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_user/tasks/main.yml new file mode 100644 index 00000000..f48588da --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_user/tasks/main.yml @@ -0,0 +1,618 @@ +--- +- name: setup + cs_user: username={{ cs_resource_prefix }}_user state=absent + register: user +- name: verify setup + assert: + that: + - user is successful + +- name: test fail if missing username + action: cs_user + register: user + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - user is failed + - 'user.msg == "missing required arguments: username"' + +- name: test fail if missing params if state=present + cs_user: + username: "{{ cs_resource_prefix }}_user" + register: user + ignore_errors: true +- name: verify results of fail if missing params if state=present + assert: + that: + - user is failed + - 'user.msg == "missing required arguments: account, email, password, first_name, last_name"' + +- name: test create user in check mode + cs_user: + username: "{{ cs_resource_prefix }}_user" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + account: "admin" + register: user + check_mode: true +- name: verify results of create user in check mode + assert: + that: + - user is successful + - user is changed + +- name: test create user + cs_user: + username: "{{ cs_resource_prefix }}_user" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + account: "admin" + register: user +- name: verify results of create user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.first_name == "{{ cs_resource_prefix }}_first_name" + - user.last_name == "{{ cs_resource_prefix }}_last_name" + - user.email == "{{ cs_resource_prefix }}@example.com" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" + - user.user_api_key is not defined + +- name: test create user idempotence + cs_user: + username: "{{ cs_resource_prefix }}_user" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + account: "admin" + register: user +- name: verify results of create user idempotence + assert: + that: + - user is successful + - user is not changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.first_name == "{{ cs_resource_prefix }}_first_name" + - user.last_name == "{{ cs_resource_prefix }}_last_name" + - user.email == "{{ cs_resource_prefix }}@example.com" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" + - user.user_api_key is not defined + +- name: test create account + cs_account: + name: "{{ cs_resource_prefix }}_acc" + username: "{{ cs_resource_prefix }}_acc_username" + password: "{{ cs_resource_prefix }}_acc_password" + last_name: "{{ cs_resource_prefix }}_acc_last_name" + first_name: "{{ cs_resource_prefix }}_acc_first_name" + email: "{{ cs_resource_prefix }}@example.com" + network_domain: "example.com" + register: acc +- name: verify results of create account + assert: + that: + - acc is successful + - acc is changed + - acc.name == "{{ cs_resource_prefix }}_acc" + - acc.network_domain == "example.com" + - acc.account_type == "user" + - acc.state == "enabled" + - acc.domain == "ROOT" + - acc is changed + +- name: test create user2 in check mode + cs_user: + username: "{{ cs_resource_prefix }}_user2" + password: "{{ cs_resource_prefix }}_password2" + last_name: "{{ cs_resource_prefix }}_last_name2" + first_name: "{{ cs_resource_prefix }}_first_name2" + email: "{{ cs_resource_prefix }}@example2.com" + account: "{{ cs_resource_prefix }}_acc" + keys_registered: true + check_mode: true + register: user +- name: verify results of create user idempotence + assert: + that: + - user is successful + - user is changed + +- name: test create user2 + cs_user: + username: "{{ cs_resource_prefix }}_user2" + password: "{{ cs_resource_prefix }}_password2" + last_name: "{{ cs_resource_prefix }}_last_name2" + first_name: "{{ cs_resource_prefix }}_first_name2" + email: "{{ cs_resource_prefix }}@example2.com" + account: "{{ cs_resource_prefix }}_acc" + keys_registered: true + register: user +- name: verify results of create user idempotence + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user2" + - user.first_name == "{{ cs_resource_prefix }}_first_name2" + - user.last_name == "{{ cs_resource_prefix }}_last_name2" + - user.email == "{{ cs_resource_prefix }}@example2.com" + - user.account_type == "user" + - user.account == "{{ cs_resource_prefix }}_acc" + - user.state == "enabled" + - user.domain == "ROOT" + - user.user_api_key is defined + +- name: test create user2 idempotence + cs_user: + username: "{{ cs_resource_prefix }}_user2" + password: "{{ cs_resource_prefix }}_password2" + last_name: "{{ cs_resource_prefix }}_last_name2" + first_name: "{{ cs_resource_prefix }}_first_name2" + email: "{{ cs_resource_prefix }}@example2.com" + account: "{{ cs_resource_prefix }}_acc" + keys_registered: true + register: user +- name: verify results of create user idempotence + assert: + that: + - user is successful + - user is not changed + - user.username == "{{ cs_resource_prefix }}_user2" + - user.first_name == "{{ cs_resource_prefix }}_first_name2" + - user.last_name == "{{ cs_resource_prefix }}_last_name2" + - user.email == "{{ cs_resource_prefix }}@example2.com" + - user.account_type == "user" + - user.account == "{{ cs_resource_prefix }}_acc" + - user.state == "enabled" + - user.domain == "ROOT" + - user.user_api_key is defined + +- name: test update user in check mode + cs_user: + username: "{{ cs_resource_prefix }}_user" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name1" + first_name: "{{ cs_resource_prefix }}_first_name1" + email: "{{ cs_resource_prefix }}@example.com1" + account: "admin" + keys_registered: true + register: user + check_mode: true +- name: verify results of update user in check mode + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.first_name == "{{ cs_resource_prefix }}_first_name" + - user.last_name == "{{ cs_resource_prefix }}_last_name" + - user.email == "{{ cs_resource_prefix }}@example.com" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" + - user.user_api_key is not defined + +- name: test update user + cs_user: + username: "{{ cs_resource_prefix }}_user" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name1" + first_name: "{{ cs_resource_prefix }}_first_name1" + email: "{{ cs_resource_prefix }}@example.com1" + account: "admin" + keys_registered: true + register: user +- name: verify results of update user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.first_name == "{{ cs_resource_prefix }}_first_name1" + - user.last_name == "{{ cs_resource_prefix }}_last_name1" + - user.email == "{{ cs_resource_prefix }}@example.com1" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" + - user.user_api_key is defined + +- name: test update user idempotence + cs_user: + username: "{{ cs_resource_prefix }}_user" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name1" + first_name: "{{ cs_resource_prefix }}_first_name1" + email: "{{ cs_resource_prefix }}@example.com1" + account: "admin" + keys_registered: true + register: user +- name: verify results of update user idempotence + assert: + that: + - user is successful + - user is not changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.first_name == "{{ cs_resource_prefix }}_first_name1" + - user.last_name == "{{ cs_resource_prefix }}_last_name1" + - user.email == "{{ cs_resource_prefix }}@example.com1" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" + - user.user_api_key is defined + +- name: test lock user in check mode + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: locked + register: user + check_mode: true +- name: verify results of lock user in check mode + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state != "locked" + - user.domain == "ROOT" + +- name: test lock user + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: locked + register: user +- name: verify results of lock user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "locked" + - user.domain == "ROOT" + +- name: test lock user idempotence + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: locked + register: user +- name: verify results of lock user idempotence + assert: + that: + - user is successful + - user is not changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "locked" + - user.domain == "ROOT" + +- name: test disable user in check mode + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: disabled + register: user + check_mode: true +- name: verify results of disable user in check mode + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state != "disabled" + - user.domain == "ROOT" + +- name: test disable user + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: disabled + register: user +- name: verify results of disable user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "disabled" + - user.domain == "ROOT" + +- name: test disable user idempotence + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: disabled + register: user +- name: verify results of disable user idempotence + assert: + that: + - user is successful + - user is not changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "disabled" + - user.domain == "ROOT" + +- name: test lock disabled user in check mode + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: locked + register: user + check_mode: true +- name: verify results of lock disabled user in check mode + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "disabled" + - user.domain == "ROOT" + +- name: test lock disabled user + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: locked + register: user +- name: verify results of lock disabled user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "locked" + - user.domain == "ROOT" + +- name: test lock disabled user idempotence + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: locked + register: user +- name: verify results of lock disabled user idempotence + assert: + that: + - user is successful + - user is not changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "locked" + - user.domain == "ROOT" + +- name: test enable user in check mode + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: enabled + register: user + check_mode: true +- name: verify results of enable user in check mode + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state != "enabled" + - user.domain == "ROOT" + +- name: test enable user + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: enabled + register: user +- name: verify results of enable user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" + +- name: test enable user idempotence using unlocked + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: unlocked + register: user +- name: verify results of enable user idempotence + assert: + that: + - user is successful + - user is not changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" + +- name: test remove user in check mode + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: absent + register: user + check_mode: true +- name: verify results of remove user in check mode + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" + +- name: test remove user + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: absent + register: user +- name: verify results of remove user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" + +- name: test remove user idempotence + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: absent + register: user +- name: verify results of remove user idempotence + assert: + that: + - user is successful + - user is not changed + +- name: test create locked user + cs_user: + username: "{{ cs_resource_prefix }}_user" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + account: "admin" + state: locked + register: user +- name: verify results of create locked user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.first_name == "{{ cs_resource_prefix }}_first_name" + - user.last_name == "{{ cs_resource_prefix }}_last_name" + - user.email == "{{ cs_resource_prefix }}@example.com" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "locked" + - user.domain == "ROOT" + +- name: test remove locked user + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: absent + register: user +- name: verify results of remove locked user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "locked" + - user.domain == "ROOT" + +- name: test create disabled user + cs_user: + username: "{{ cs_resource_prefix }}_user" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + account: "admin" + state: disabled + register: user +- name: verify results of create disabled user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.first_name == "{{ cs_resource_prefix }}_first_name" + - user.last_name == "{{ cs_resource_prefix }}_last_name" + - user.email == "{{ cs_resource_prefix }}@example.com" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "disabled" + - user.domain == "ROOT" + +- name: test remove disabled user + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: absent + register: user +- name: verify results of remove disabled user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "disabled" + - user.domain == "ROOT" + +- name: test create enabled user + cs_user: + username: "{{ cs_resource_prefix }}_user" + password: "{{ cs_resource_prefix }}_password" + last_name: "{{ cs_resource_prefix }}_last_name" + first_name: "{{ cs_resource_prefix }}_first_name" + email: "{{ cs_resource_prefix }}@example.com" + account: "admin" + state: enabled + register: user +- name: verify results of create enabled user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.first_name == "{{ cs_resource_prefix }}_first_name" + - user.last_name == "{{ cs_resource_prefix }}_last_name" + - user.email == "{{ cs_resource_prefix }}@example.com" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" + +- name: test remove enabled user + cs_user: + username: "{{ cs_resource_prefix }}_user" + state: absent + register: user +- name: verify results of remove enabled user + assert: + that: + - user is successful + - user is changed + - user.username == "{{ cs_resource_prefix }}_user" + - user.account_type == "root_admin" + - user.account == "admin" + - user.state == "enabled" + - user.domain == "ROOT" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vlan_ip_range/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vlan_ip_range/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vlan_ip_range/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vlan_ip_range/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vlan_ip_range/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vlan_ip_range/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vlan_ip_range/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vlan_ip_range/tasks/main.yml new file mode 100644 index 00000000..fdfc2515 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vlan_ip_range/tasks/main.yml @@ -0,0 +1,461 @@ +--- +- name: setup cleanup test network + cs_network: + name: ipr_test_network + state: absent + zone: "{{ cs_common_zone_adv }}" + +- name: setup create test network + cs_network: + name: ipr_test_network + zone: "{{ cs_common_zone_adv }}" + vlan: 98 + start_ip: 10.2.4.2 + end_ip: 10.2.4.9 + gateway: 10.2.4.1 + netmask: 255.255.255.0 + network_offering: DefaultSharedNetworkOffering + register: ipr_net +- name: verify setup create test network + assert: + that: + - ipr_net is successful + - ipr_net is changed + +- name: test create a VLAN IP RANGE with missing required param + cs_vlan_ip_range: + network: ipr_test_network + vlan: 98 + start_ip: 10.2.4.10 + end_ip: 10.2.4.100 + gateway: 10.2.4.1 + zone: "{{ cs_common_zone_adv }}" + ignore_errors: yes + register: ipr +- name: verify test create VLAN IP RANGE with missing required param + assert: + that: + - ipr is not successful + - ipr is not changed + - 'ipr.msg == "state is present but all of the following are missing: netmask"' + +- name: test create a VLAN IP RANGE with conflicting params + cs_vlan_ip_range: + network: ipr_test_network + vlan: 98 + start_ip: 10.2.4.10 + end_ip: 10.2.4.100 + gateway: 10.2.4.1 + netmask: 255.255.255.0 + project: fakeproject + account: fakeaccount + zone: "{{ cs_common_zone_adv }}" + ignore_errors: yes + register: ipr +- name: verify test create VLAN IP RANGE with missing conflicting params + assert: + that: + - ipr is not successful + - ipr is not changed + - 'ipr.msg == "parameters are mutually exclusive: account|project"' + +- name: test create a VLAN IP RANGE in check mode + cs_vlan_ip_range: + network: ipr_test_network + vlan: 98 + start_ip: 10.2.4.10 + end_ip: 10.2.4.100 + gateway: 10.2.4.1 + netmask: 255.255.255.0 + zone: "{{ cs_common_zone_adv }}" + register: ipr + check_mode: true +- name: verify test create VLAN IP RANGE in check mode + assert: + that: + - ipr is successful + - ipr is changed + +- name: test create a VLAN IP RANGE + cs_vlan_ip_range: + network: ipr_test_network + vlan: 98 + start_ip: 10.2.4.10 + end_ip: 10.2.4.100 + gateway: 10.2.4.1 + netmask: 255.255.255.0 + zone: "{{ cs_common_zone_adv }}" + register: ipr +- name: verify test create VLAN IP RANGE + assert: + that: + - ipr is successful + - ipr is changed + - ipr.vlan == "vlan://98" + - ipr.start_ip == "10.2.4.10" + - ipr.end_ip == "10.2.4.100" + - ipr.gateway == "10.2.4.1" + - ipr.netmask == "255.255.255.0" + - ipr.network == "ipr_test_network" + - ipr.for_virtual_network == false + +- name: test create a VLAN IP RANGE idempotence + cs_vlan_ip_range: + network: ipr_test_network + vlan: 98 + start_ip: 10.2.4.10 + end_ip: 10.2.4.100 + gateway: 10.2.4.1 + netmask: 255.255.255.0 + zone: "{{ cs_common_zone_adv }}" + register: ipr +- name: verify test create VLAN IP RANGE idempotence + assert: + that: + - ipr is successful + - ipr is not changed + - ipr.vlan == "vlan://98" + - ipr.start_ip == "10.2.4.10" + - ipr.end_ip == "10.2.4.100" + - ipr.gateway == "10.2.4.1" + - ipr.netmask == "255.255.255.0" + - ipr.network == "ipr_test_network" + - ipr.for_virtual_network == false + +- name: test create a second VLAN IP RANGE in check mode + cs_vlan_ip_range: + network: ipr_test_network + start_ip: 10.2.4.101 + end_ip: 10.2.4.150 + gateway: 10.2.4.1 + netmask: 255.255.255.0 + zone: "{{ cs_common_zone_adv }}" + register: ipr2 + check_mode: true +- name: verify test create a second VLAN IP RANGE in check mode + assert: + that: + - ipr2 is successful + - ipr2 is changed + +- name: test create a second VLAN IP RANGE + cs_vlan_ip_range: + network: ipr_test_network + start_ip: 10.2.4.101 + end_ip: 10.2.4.150 + gateway: 10.2.4.1 + netmask: 255.255.255.0 + zone: "{{ cs_common_zone_adv }}" + register: ipr2 +- name: verify test create a second VLAN IP RANGE + assert: + that: + - ipr2 is successful + - ipr2 is changed + - ipr2.vlan == "vlan://98" + - ipr2.start_ip == "10.2.4.101" + - ipr2.end_ip == "10.2.4.150" + - ipr2.gateway == "10.2.4.1" + - ipr2.netmask == "255.255.255.0" + - ipr2.network == "ipr_test_network" + - ipr2.for_virtual_network == false + - ipr2.id != ipr.id + +- name: test create a second VLAN IP RANGE idempotence + cs_vlan_ip_range: + network: ipr_test_network + start_ip: 10.2.4.101 + end_ip: 10.2.4.150 + gateway: 10.2.4.1 + netmask: 255.255.255.0 + zone: "{{ cs_common_zone_adv }}" + register: ipr2 +- name: verify test create a second VLAN IP RANGE idempotence + assert: + that: + - ipr2 is successful + - ipr2 is not changed + - ipr2.vlan == "vlan://98" + - ipr2.start_ip == "10.2.4.101" + - ipr2.end_ip == "10.2.4.150" + - ipr2.gateway == "10.2.4.1" + - ipr2.netmask == "255.255.255.0" + - ipr2.network == "ipr_test_network" + - ipr2.for_virtual_network == false + +- name: test create a single IP VLAN IP RANGE + cs_vlan_ip_range: + network: ipr_test_network + start_ip: 10.2.4.200 + gateway: 10.2.4.1 + netmask: 255.255.255.0 + zone: "{{ cs_common_zone_adv }}" + register: ipr3 +- name: verify test create single IP VLAN IP RANGE + assert: + that: + - ipr3 is successful + - ipr3 is changed + - ipr3.vlan == "vlan://98" + - ipr3.start_ip == "10.2.4.200" + - ipr3.end_ip == "10.2.4.200" + - ipr3.gateway == "10.2.4.1" + - ipr3.netmask == "255.255.255.0" + - ipr3.network == "ipr_test_network" + - ipr3.for_virtual_network == false + +- name: test create an IPv4 + IPv6 VLAN IP RANGE + cs_vlan_ip_range: + network: ipr_test_network + vlan: 98 + start_ip: 10.2.4.151 + end_ip: 10.2.4.199 + gateway: 10.2.4.1 + netmask: 255.255.255.0 + start_ipv6: 2001:db8::10 + end_ipv6: 2001:db8::50 + gateway_ipv6: 2001:db8::1 + cidr_ipv6: 2001:db8::/64 + zone: "{{ cs_common_zone_adv }}" + register: iprv6 +- name: verify test create an IPv4 + IPv6 VLAN IP RANGE + assert: + that: + - iprv6 is successful + - iprv6 is changed + - iprv6.vlan == "vlan://98" + - iprv6.start_ip == "10.2.4.151" + - iprv6.end_ip == "10.2.4.199" + - iprv6.gateway == "10.2.4.1" + - iprv6.netmask == "255.255.255.0" + - iprv6.start_ipv6 == "2001:db8::10" + - iprv6.end_ipv6 == "2001:db8::50" + - iprv6.gateway_ipv6 == "2001:db8::1" + - iprv6.cidr_ipv6 == "2001:db8::/64" + - iprv6.network == "ipr_test_network" + - iprv6.for_virtual_network == false + +- name: test cleanup VLAN IP RANGE in check mode + cs_vlan_ip_range: + network: ipr_test_network + start_ip: 10.2.4.10 + end_ip: 10.2.4.100 + zone: "{{ cs_common_zone_adv }}" + state: absent + check_mode: true + register: ipr +- name: verify test cleanup VLAN IP RANGE in check mode + assert: + that: + - ipr is successful + - ipr is changed + - ipr.vlan == "vlan://98" + - ipr.start_ip == "10.2.4.10" + - ipr.end_ip == "10.2.4.100" + - ipr.gateway == "10.2.4.1" + - ipr.netmask == "255.255.255.0" + - ipr.network == "ipr_test_network" + - ipr.for_virtual_network == false + +- name: test cleanup VLAN IP RANGE + cs_vlan_ip_range: + network: ipr_test_network + start_ip: 10.2.4.10 + end_ip: 10.2.4.100 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: ipr +- name: verify test cleanup VLAN IP RANGE + assert: + that: + - ipr is successful + - ipr is changed + - ipr.vlan == "vlan://98" + - ipr.start_ip == "10.2.4.10" + - ipr.end_ip == "10.2.4.100" + - ipr.gateway == "10.2.4.1" + - ipr.netmask == "255.255.255.0" + - ipr.network == "ipr_test_network" + - ipr.for_virtual_network == false + +- name: test cleanup VLAN IP RANGE idempotence + cs_vlan_ip_range: + network: ipr_test_network + start_ip: 10.2.4.10 + end_ip: 10.2.4.100 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: ipr +- name: verify test cleanup VLAN IP RANGE idempotence + assert: + that: + - ipr is successful + - ipr is not changed + +- name: test cleanup single IP VLAN IP RANGE + cs_vlan_ip_range: + network: ipr_test_network + start_ip: 10.2.4.200 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: ipr +- name: verify test cleanup single IP VLAN IP RANGE + assert: + that: + - ipr is successful + - ipr is changed + - ipr.vlan == "vlan://98" + - ipr.start_ip == "10.2.4.200" + - ipr.end_ip == "10.2.4.200" + - ipr.gateway == "10.2.4.1" + - ipr.netmask == "255.255.255.0" + - ipr.network == "ipr_test_network" + - ipr.for_virtual_network == false + +- name: cleanup second VLAN IP RANGE + cs_vlan_ip_range: + network: ipr_test_network + start_ip: 10.2.4.101 + end_ip: 10.2.4.150 + zone: "{{ cs_common_zone_adv }}" + state: absent + register: ipr2 +- name: verify cleanup second VLAN IP RANGE + assert: + that: + - ipr2 is successful + - ipr2 is changed + - ipr2.vlan == "vlan://98" + - ipr2.start_ip == "10.2.4.101" + - ipr2.end_ip == "10.2.4.150" + - ipr2.gateway == "10.2.4.1" + - ipr2.netmask == "255.255.255.0" + - ipr2.network == "ipr_test_network" + - ipr2.for_virtual_network == false + +- name: test cleanup IPv4 + IPv6 VLAN IP RANGE + cs_vlan_ip_range: + network: ipr_test_network + start_ip: 10.2.4.151 + end_ip: 10.2.4.199 + state: absent + zone: "{{ cs_common_zone_adv }}" + register: iprv6 +- name: verify test cleanup IPv4 + IPv6 VLAN IP RANGE + assert: + that: + - iprv6 is successful + - iprv6 is changed + - iprv6.vlan == "vlan://98" + - iprv6.start_ip == "10.2.4.151" + - iprv6.end_ip == "10.2.4.199" + - iprv6.gateway == "10.2.4.1" + - iprv6.netmask == "255.255.255.0" + - iprv6.start_ipv6 == "2001:db8::10" + - iprv6.end_ipv6 == "2001:db8::50" + - iprv6.gateway_ipv6 == "2001:db8::1" + - iprv6.cidr_ipv6 == "2001:db8::/64" + - iprv6.network == "ipr_test_network" + - iprv6.for_virtual_network == false + +- name: cleanup test network + cs_network: + name: ipr_test_network + zone: "{{ cs_common_zone_adv }}" + state: absent + register: ipr_net +- name: verify cleanup test network + assert: + that: + - ipr_net is successful + - ipr_net is changed + +# Create a new zone - the default one is enabled +- name: assure zone for tests + cs_zone: + name: cs-test-zone + state: present + dns1: 8.8.8.8 + network_type: Advanced + register: cszone + +- name: ensure the zone is disabled + cs_zone: + name: "{{ cszone.name }}" + state: disabled + +- name: setup a network for tests + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + isolation_method: VLAN + broadcast_domain_range: ZONE + state: present + register: public_network + +- name: setup public network traffic + cs_traffic_type: + physical_network: "{{ public_network.name }}" + traffic_type: Public + kvm_networklabel: cloudbr1 + zone: "{{ public_network.zone }}" + +- name: test adding a public IP range + cs_vlan_ip_range: + end_ip: 10.0.3.250 + start_ip: 10.0.3.10 + zone: "{{ cszone.name }}" + netmask: 255.255.255.0 + for_virtual_network: 'yes' + gateway: 10.0.3.2 + vlan: untagged + register: public_range +- name: verify test adding a public IP range + assert: + that: + - public_range is successful + - public_range is changed + - public_range.physical_network == public_network.id + - public_range.vlan == 'vlan://untagged' + - public_range.gateway == '10.0.3.2' + - public_range.netmask == '255.255.255.0' + - public_range.zone == cszone.name + - public_range.start_ip == '10.0.3.10' + - public_range.end_ip == '10.0.3.250' + - public_range.for_systemvms == false + +- name: test adding a public IP range for System VMs + cs_vlan_ip_range: + end_ip: 10.0.4.250 + start_ip: 10.0.4.10 + zone: "{{ cszone.name }}" + netmask: 255.255.255.0 + for_virtual_network: 'yes' + for_system_vms: 'yes' + gateway: 10.0.4.2 + vlan: untagged + register: public_range +- name: verify test adding a public IP range for System VMs + assert: + that: + - public_range is successful + - public_range is changed + - public_range.physical_network == public_network.id + - public_range.vlan == 'vlan://untagged' + - public_range.gateway == '10.0.4.2' + - public_range.netmask == '255.255.255.0' + - public_range.zone == cszone.name + - public_range.start_ip == '10.0.4.10' + - public_range.end_ip == '10.0.4.250' + - public_range.for_systemvms == true + +- name: cleanup the network + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + state: absent + +- name: cleanup the zone + cs_zone: + name: "{{ cszone.name }}" + state: absent
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/defaults/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/defaults/main.yml new file mode 100644 index 00000000..490c6c14 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/defaults/main.yml @@ -0,0 +1,3 @@ +--- +test_cs_instance_template: "{{ cs_common_template }}" +test_cs_instance_offering_1: Small Instance diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/tasks/main.yml new file mode 100644 index 00000000..51ce5767 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vmsnapshot/tasks/main.yml @@ -0,0 +1,165 @@ +--- +- name: setup instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-snapshot" + template: "{{ test_cs_instance_template }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + zone: "{{ cs_common_zone_basic }}" + register: instance +- name: verify create instance + assert: + that: + - instance is successful + +- name: ensure no snapshot exists + cs_vmsnapshot: + name: "{{ cs_resource_prefix }}_snapshot" + vm: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: snap +- name: verify setup + assert: + that: + - snap is successful + +- name: test fail if missing name + cs_vmsnapshot: + zone: "{{ cs_common_zone_basic }}" + register: snap + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - snap is failed + - 'snap.msg.startswith("missing required arguments: ")' + +- name: test create snapshot in check mode + cs_vmsnapshot: + name: "{{ cs_resource_prefix }}_snapshot" + vm: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + snapshot_memory: yes + register: snap + check_mode: true +- name: verify test create snapshot in check mode + assert: + that: + - snap is changed + +- name: test create snapshot + cs_vmsnapshot: + name: "{{ cs_resource_prefix }}_snapshot" + vm: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + snapshot_memory: yes + register: snap +- name: verify test create snapshot + assert: + that: + - snap is changed + - snap.display_name == "{{ cs_resource_prefix }}_snapshot" + +- name: test create snapshot idempotence + cs_vmsnapshot: + name: "{{ cs_resource_prefix }}_snapshot" + vm: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + snapshot_memory: yes + register: snap +- name: verify test create snapshot idempotence + assert: + that: + - snap is not changed + - snap.display_name == "{{ cs_resource_prefix }}_snapshot" + +- name: test revert snapshot in check mode + cs_vmsnapshot: + name: "{{ cs_resource_prefix }}_snapshot" + vm: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + state: revert + register: snap + check_mode: true +- name: verify test revert snapshot in check mode + assert: + that: + - snap is changed + - snap.display_name == "{{ cs_resource_prefix }}_snapshot" + +- name: test fail revert unknown snapshot + cs_vmsnapshot: + name: "{{ cs_resource_prefix }}_snapshot_unknown" + vm: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + state: revert + register: snap + ignore_errors: true +- name: verify test fail revert unknown snapshot + assert: + that: + - snap is failed + - snap.msg == "snapshot not found, could not revert VM" + +- name: test revert snapshot + cs_vmsnapshot: + name: "{{ cs_resource_prefix }}_snapshot" + vm: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + state: revert + register: snap +- name: verify test revert snapshot + assert: + that: + - snap is changed + - snap.display_name == "{{ cs_resource_prefix }}_snapshot" + +- name: test remove snapshot in check mode + cs_vmsnapshot: + name: "{{ cs_resource_prefix }}_snapshot" + vm: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: snap + check_mode: true +- name: verify test remove snapshot in check mode + assert: + that: + - snap is changed + - snap.display_name == "{{ cs_resource_prefix }}_snapshot" + +- name: test remove snapshot + cs_vmsnapshot: + name: "{{ cs_resource_prefix }}_snapshot" + vm: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: snap +- name: verify test remove snapshot + assert: + that: + - snap is changed + - snap.display_name == "{{ cs_resource_prefix }}_snapshot" + +- name: test remove snapshot idempotence + cs_vmsnapshot: + name: "{{ cs_resource_prefix }}_snapshot" + vm: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: snap +- name: verify test remove snapshot idempotence + assert: + that: + - snap is not changed + +- name: cleanup instance + cs_instance: + name: "{{ cs_resource_prefix }}-vm-snapshot" + zone: "{{ cs_common_zone_basic }}" + state: expunged + register: instance +- name: verify destroy instance + assert: + that: + - instance is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/defaults/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/defaults/main.yml new file mode 100644 index 00000000..f1074cf1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/defaults/main.yml @@ -0,0 +1,8 @@ +--- +test_cs_instance_1: "{{ cs_resource_prefix }}-vm1" +test_cs_instance_2: "{{ cs_resource_prefix }}-vm2" +test_cs_instance_3: "{{ cs_resource_prefix }}-vm3" +test_cs_instance_template: "{{ cs_common_template }}" +test_cs_instance_offering_1: Small Instance +test_cs_disk_offering_1: Custom +test_cs_volume_to_upload: http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/tasks/common.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/tasks/common.yml new file mode 100644 index 00000000..f011f858 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/tasks/common.yml @@ -0,0 +1,322 @@ +--- +- name: setup + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: vol +- name: verify setup + assert: + that: + - vol is successful + +- name: setup instance 1 + cs_instance: + name: "{{ test_cs_instance_1 }}" + template: "{{ test_cs_instance_template }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + zone: "{{ cs_common_zone_basic }}" + register: instance +- name: verify create instance + assert: + that: + - instance is successful + +- name: setup instance 2 + cs_instance: + name: "{{ test_cs_instance_2 }}" + template: "{{ test_cs_instance_template }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + zone: "{{ cs_common_zone_basic }}" + register: instance +- name: verify create instance + assert: + that: + - instance is successful + +- name: test fail if missing name + cs_volume: + zone: "{{ cs_common_zone_basic }}" + register: vol + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - vol is failed + - "vol.msg == 'missing required arguments: name'" + +- name: test create volume in check mode + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + disk_offering: "{{ test_cs_disk_offering_1 }}" + size: 20 + register: vol + check_mode: true +- name: verify results test create volume in check mode + assert: + that: + - vol is changed + +- name: test create volume + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + disk_offering: "{{ test_cs_disk_offering_1 }}" + size: 20 + register: vol +- name: verify results test create volume + assert: + that: + - vol is changed + - vol.size == 20 * 1024 ** 3 + - vol.name == "{{ cs_resource_prefix }}_vol" + +- name: test create volume idempotence + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + disk_offering: "{{ test_cs_disk_offering_1 }}" + size: 20 + register: vol +- name: verify results test create volume idempotence + assert: + that: + - vol is not changed + - vol.size == 20 * 1024 ** 3 + - vol.name == "{{ cs_resource_prefix }}_vol" + +- name: test shrink volume in check mode + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + disk_offering: "{{ test_cs_disk_offering_1 }}" + size: 10 + shrink_ok: yes + register: vol + check_mode: true +- name: verify results test create volume in check mode + assert: + that: + - vol is changed + - vol.size == 20 * 1024 ** 3 + - vol.name == "{{ cs_resource_prefix }}_vol" + +- name: test shrink volume + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + disk_offering: "{{ test_cs_disk_offering_1 }}" + size: 10 + shrink_ok: yes + register: vol +- name: verify results test create volume + assert: + that: + - vol is changed + - vol.size == 10 * 1024 ** 3 + - vol.name == "{{ cs_resource_prefix }}_vol" + +- name: test shrink volume idempotence + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + disk_offering: "{{ test_cs_disk_offering_1 }}" + size: 10 + shrink_ok: yes + register: vol +- name: verify results test create volume + assert: + that: + - vol is not changed + - vol.size == 10 * 1024 ** 3 + - vol.name == "{{ cs_resource_prefix }}_vol" + +- name: test attach volume in check mode + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + vm: "{{ test_cs_instance_1 }}" + state: attached + register: vol + check_mode: true +- name: verify results test attach volume in check mode + assert: + that: + - vol is changed + - vol.name == "{{ cs_resource_prefix }}_vol" + - vol.attached is not defined + +- name: test attach volume + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + vm: "{{ test_cs_instance_1 }}" + state: attached + register: vol +- name: verify results test attach volume + assert: + that: + - vol is changed + - vol.name == "{{ cs_resource_prefix }}_vol" + - vol.vm == "{{ test_cs_instance_1 }}" + - vol.attached is defined + +- name: test attach volume idempotence + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + vm: "{{ test_cs_instance_1 }}" + state: attached + register: vol +- name: verify results test attach volume idempotence + assert: + that: + - vol is not changed + - vol.name == "{{ cs_resource_prefix }}_vol" + - vol.vm == "{{ test_cs_instance_1 }}" + - vol.attached is defined + +- name: test attach attached volume to another vm in check mdoe + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + vm: "{{ test_cs_instance_2 }}" + state: attached + register: vol + check_mode: true +- name: verify results test attach attached volume to another vm in check mode + assert: + that: + - vol is changed + - vol.name == "{{ cs_resource_prefix }}_vol" + - vol.vm == "{{ test_cs_instance_1 }}" + - vol.attached is defined + +- name: test attach attached volume to another vm + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + vm: "{{ test_cs_instance_2 }}" + state: attached + register: vol +- name: verify results test attach attached volume to another vm + assert: + that: + - vol is changed + - vol.name == "{{ cs_resource_prefix }}_vol" + - vol.vm == "{{ test_cs_instance_2 }}" + - vol.attached is defined + +- name: test attach attached volume to another vm idempotence + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + vm: "{{ test_cs_instance_2 }}" + state: attached + register: vol +- name: verify results test attach attached volume to another vm idempotence + assert: + that: + - vol is not changed + - vol.name == "{{ cs_resource_prefix }}_vol" + - vol.vm == "{{ test_cs_instance_2 }}" + - vol.attached is defined + +- name: test detach volume in check mode + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + state: detached + register: vol + check_mode: true +- name: verify results test detach volume in check mdoe + assert: + that: + - vol is changed + - vol.name == "{{ cs_resource_prefix }}_vol" + - vol.attached is defined + +- name: test detach volume + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + state: detached + register: vol +- name: verify results test detach volume + assert: + that: + - vol is changed + - vol.name == "{{ cs_resource_prefix }}_vol" + - vol.attached is undefined + +- name: test detach volume idempotence + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + state: detached + register: vol +- name: verify results test detach volume idempotence + assert: + that: + - vol is not changed + - vol.name == "{{ cs_resource_prefix }}_vol" + - vol.attached is undefined + +- name: test delete volume in check mode + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: vol + check_mode: true +- name: verify results test create volume in check mode + assert: + that: + - vol is changed + - vol.name == "{{ cs_resource_prefix }}_vol" + +- name: test delete volume + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: vol +- name: verify results test create volume + assert: + that: + - vol is changed + - vol.name == "{{ cs_resource_prefix }}_vol" + +- name: test delete volume idempotence + cs_volume: + name: "{{ cs_resource_prefix }}_vol" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: vol +- name: verify results test delete volume idempotence + assert: + that: + - vol is not changed + +- name: cleanup instance 1 + cs_instance: + name: "{{ test_cs_instance_1 }}" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: instance +- name: verify create instance + assert: + that: + - instance is successful + +- name: cleanup instance 2 + cs_instance: + name: "{{ test_cs_instance_2 }}" + zone: "{{ cs_common_zone_basic }}" + state: absent + register: instance +- name: verify create instance + assert: + that: + - instance is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/tasks/extract_upload.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/tasks/extract_upload.yml new file mode 100644 index 00000000..5dc70187 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/tasks/extract_upload.yml @@ -0,0 +1,190 @@ +--- +- name: setup + cs_volume: + zone: "{{ cs_common_zone_adv }}" + name: "{{ cs_resource_prefix }}_upload" + state: absent + register: uploaded_vol +- name: verify setup + assert: + that: + - uploaded_vol is successful + +- name: setup network + cs_network: + name: "cs_volume_network" + zone: "{{ cs_common_zone_adv }}" + network_offering: DefaultSharedNetworkOffering + vlan: 2435 + start_ip: 10.100.129.11 + end_ip: 10.100.129.250 + gateway: 10.100.129.1 + netmask: 255.255.255.0 + register: net +- name: verify setup network + assert: + that: + - net is successful + - net.name == "cs_volume_network" + +- name: setup instance + cs_instance: + zone: "{{ cs_common_zone_adv }}" + name: "{{ test_cs_instance_3 }}" + template: "{{ test_cs_instance_template }}" + service_offering: "{{ test_cs_instance_offering_1 }}" + network: cs_volume_network + register: instance +- name: verify setup instance + assert: + that: + - instance is successful + +- name: setup stop instance + cs_instance: + zone: "{{ cs_common_zone_adv }}" + name: "{{ test_cs_instance_3 }}" + state: stopped + register: instance +- name: verify stop instance + assert: + that: + - instance is successful + - instance.state == 'Stopped' + +- name: setup get instance info + cs_instance_info: + name: "{{ test_cs_instance_3 }}" + register: instance +- name: verify setup get instance info + assert: + that: + - instance is successful + +- name: test extract volume in check mode + cs_volume: + zone: "{{ cs_common_zone_adv }}" + state: extracted + name: "{{ instance.instances[0].volumes[0].name }}" + check_mode: yes + register: extracted_vol +- name: verify test extract volume in check mode + assert: + that: + - extracted_vol is successful + - extracted_vol is changed + - extracted_vol.state == "Ready" + - extracted_vol.name == "{{ instance.instances[0].volumes[0].name }}" + - extracted_vol.url is not defined + +- name: test extract volume + cs_volume: + zone: "{{ cs_common_zone_adv }}" + state: extracted + name: "{{ instance.instances[0].volumes[0].name }}" + register: extracted_vol +- name: verify test extract volume + assert: + that: + - extracted_vol is successful + - extracted_vol is changed + - extracted_vol.state == "DOWNLOAD_URL_CREATED" + - extracted_vol.name == "{{ instance.instances[0].volumes[0].name }}" + - extracted_vol.url is defined + +- name: test upload volume with missing param + cs_volume: + zone: "{{ cs_common_zone_adv }}" + state: uploaded + name: "{{ cs_resource_prefix }}_upload" + url: "{{ test_cs_volume_to_upload }}" + ignore_errors: yes + register: uploaded_vol +- name: verify upload volume with missing param + assert: + that: + - uploaded_vol is failed + - uploaded_vol is not changed + - 'uploaded_vol.msg == "state is uploaded but all of the following are missing: format"' + +- name: test upload volume in check mode + cs_volume: + zone: "{{ cs_common_zone_adv }}" + state: uploaded + name: "{{ cs_resource_prefix }}_upload" + format: VHD + url: "{{ test_cs_volume_to_upload }}" + check_mode: yes + register: uploaded_vol +- name: verify upload volume in check mode + assert: + that: + - uploaded_vol is successful + - uploaded_vol is changed + - uploaded_vol.name is not defined + +- name: test upload volume + cs_volume: + zone: "{{ cs_common_zone_adv }}" + state: uploaded + name: "{{ cs_resource_prefix }}_upload" + format: VHD + url: "{{ test_cs_volume_to_upload }}" + register: uploaded_vol +- name: verify upload volume + assert: + that: + - uploaded_vol is successful + - uploaded_vol is changed + - uploaded_vol.name == "{{ cs_resource_prefix }}_upload" + - uploaded_vol.state == "Uploaded" + +- name: test upload volume idempotence + cs_volume: + zone: "{{ cs_common_zone_adv }}" + state: uploaded + name: "{{ cs_resource_prefix }}_upload" + format: VHD + url: "{{ test_cs_volume_to_upload }}" + register: uploaded_vol +- name: verify upload volume idempotence + assert: + that: + - uploaded_vol is successful + - uploaded_vol is not changed + - uploaded_vol.name == "{{ cs_resource_prefix }}_upload" + - uploaded_vol.state == "Uploaded" + +- name: delete volume + cs_volume: + zone: "{{ cs_common_zone_adv }}" + state: absent + name: "{{ cs_resource_prefix }}_upload" + register: uploaded_vol +- name: verify delete volume + assert: + that: + - uploaded_vol is successful + - uploaded_vol is changed + +- name: destroy instance + cs_instance: + zone: "{{ cs_common_zone_adv }}" + name: "{{ test_cs_instance_3 }}" + state: expunged + register: instance +- name: verify destroy instance + assert: + that: + - instance is successful + +- name: delete network + cs_network: + name: "cs_volume_network" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: net +- name: verify delete network + assert: + that: + - net is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/tasks/main.yml new file mode 100644 index 00000000..3b863beb --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_volume/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include_tasks: common.yml +- include_tasks: extract_upload.yml diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc/tasks/main.yml new file mode 100644 index 00000000..11e310a5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc/tasks/main.yml @@ -0,0 +1,728 @@ +--- +- name: setup + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpc +- name: verify setup + assert: + that: + - vpc is successful + +- name: test fail missing name of vpc + cs_vpc: + zone: "{{ cs_common_zone_adv }}" + ignore_errors: true + register: vpc +- name: verify test fail missing name of vpc + assert: + that: + - vpc is failed + - "vpc.msg.startswith('missing required arguments: ')" + +- name: test fail missing cidr for vpc + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + ignore_errors: true + register: vpc +- name: verify test fail missing cidr for vpc + assert: + that: + - vpc is failed + - 'vpc.msg == "state is present but all of the following are missing: cidr"' + +- name: test fail missing vpc offering not found + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + vpc_offering: does_not_exist + zone: "{{ cs_common_zone_adv }}" + cidr: 10.10.1.0/16 + ignore_errors: true + register: vpc +- name: verify test fail missing cidr for vpc + assert: + that: + - vpc is failed + - 'vpc.msg == "VPC offering not found or not enabled: does_not_exist"' + +- name: test fail name substring match + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + # Full name is "Redundant VPC offering" + vpc_offering: "Redundant" + zone: "{{ cs_common_zone_adv }}" + cidr: 10.10.1.0/16 + ignore_errors: true + register: vpc +- name: verify test fail name substring match + assert: + that: + - vpc is failed + - 'vpc.msg == "VPC offering not found or not enabled: Redundant"' + +- name: test create vpc with custom offering in check mode + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc_custom" + display_text: "{{ cs_resource_prefix }}_display_text_custom" + cidr: 10.10.1.0/16 + vpc_offering: Redundant VPC offering + network_domain: test.example.com + zone: "{{ cs_common_zone_adv }}" + state: stopped + register: vpc + check_mode: true +- name: verify test create vpc with custom offering in check mode + assert: + that: + - vpc is successful + - vpc is changed + +- name: test create vpc with custom offering + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc_custom" + display_text: "{{ cs_resource_prefix }}_display_text_custom" + cidr: 10.10.1.0/16 + vpc_offering: Redundant VPC offering + network_domain: test.example.com + zone: "{{ cs_common_zone_adv }}" + state: stopped + register: vpc +- name: verify test create vpc with custom offering + assert: + that: + - vpc is successful + - vpc is changed + - vpc.name == "{{ cs_resource_prefix }}_vpc_custom" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text_custom" + - vpc.cidr == "10.10.1.0/16" + - vpc.network_domain == "test.example.com" + +- name: test create vpc with custom offering idempotence + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc_custom" + display_text: "{{ cs_resource_prefix }}_display_text_custom" + cidr: 10.10.1.0/16 + vpc_offering: Redundant VPC offering + network_domain: test.example.com + zone: "{{ cs_common_zone_adv }}" + state: stopped + register: vpc +- name: verify test create vpc with custom offering idempotence + assert: + that: + - vpc is successful + - vpc is not changed + - vpc.name == "{{ cs_resource_prefix }}_vpc_custom" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text_custom" + - vpc.cidr == "10.10.1.0/16" + - vpc.network_domain == "test.example.com" + +- name: test create vpc with default offering in check mode + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc + check_mode: true +- name: verify test create vpc with default offering in check mode + assert: + that: + - vpc is successful + - vpc is changed + +- name: test create vpc with default offering + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify test create vpc with default offering + assert: + that: + - vpc is successful + - vpc is changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text" + - vpc.cidr == "10.10.0.0/16" + +- name: test create vpc with default offering idempotence + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify test create vpc with default offering idempotence + assert: + that: + - vpc is successful + - vpc is not changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text" + - vpc.cidr == "10.10.0.0/16" + +- name: test create vpc with default offering idempotence2 + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify test create vpc idempotence2 + assert: + that: + - vpc is successful + - vpc is not changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text" + - vpc.cidr == "10.10.0.0/16" + +- name: test update vpc with default offering in check mode + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text2" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc + check_mode: true +- name: verify test update vpc with default offering in check mode + assert: + that: + - vpc is successful + - vpc is changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text" + - vpc.cidr == "10.10.0.0/16" + +- name: test update vpc with default offering + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text2" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify test update vpc with default offering + assert: + that: + - vpc is successful + - vpc is changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text2" + - vpc.cidr == "10.10.0.0/16" + +- name: test update vpc with default offering idempotence + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text2" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify test update vpc idempotence + assert: + that: + - vpc is successful + - vpc is not changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text2" + - vpc.cidr == "10.10.0.0/16" + +- name: test restart vpc with default offering with clean up in check mode + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text2" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + clean_up: true + state: restarted + register: vpc + check_mode: true +- name: verify test restart vpc with default offering with clean up in check mode + assert: + that: + - vpc is successful + - vpc is changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text2" + - vpc.cidr == "10.10.0.0/16" + +- name: test restart vpc with default offering with clean up + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text2" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + clean_up: true + state: restarted + register: vpc +- name: verify test restart vpc with default offering with clean up + assert: + that: + - vpc is successful + - vpc is changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text2" + - vpc.cidr == "10.10.0.0/16" + +- name: test restart vpc with default offering without clean up + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text2" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + state: restarted + register: vpc +- name: verify test restart vpc with default offering without clean up + assert: + that: + - vpc is successful + - vpc is changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text2" + - vpc.cidr == "10.10.0.0/16" + +- name: test create network in vpc in check mode + cs_network: + name: "{{ cs_resource_prefix }}_net_vpc" + zone: "{{ cs_common_zone_adv }}" + network_offering: Offering for Isolated Vpc networks with Source Nat service enabled + vpc: "{{ cs_resource_prefix }}_vpc" + gateway: 10.10.0.1 + netmask: 255.255.255.0 + register: vpc_net + check_mode: true +- name: verify test create network in vpc in check mode + assert: + that: + - vpc_net is successful + - vpc_net is changed + +- name: test create network in vpc + cs_network: + name: "{{ cs_resource_prefix }}_net_vpc" + zone: "{{ cs_common_zone_adv }}" + network_offering: Offering for Isolated Vpc networks with Source Nat service enabled + vpc: "{{ cs_resource_prefix }}_vpc" + gateway: 10.10.0.1 + netmask: 255.255.255.0 + register: vpc_net +- name: verify test create network in vpc + assert: + that: + - vpc_net is successful + - vpc_net is changed + - vpc_net.name == "{{ cs_resource_prefix }}_net_vpc" + +- name: test create network in vpc idempotence + cs_network: + name: "{{ cs_resource_prefix }}_net_vpc" + zone: "{{ cs_common_zone_adv }}" + network_offering: Offering for Isolated Vpc networks with Source Nat service enabled + vpc: "{{ cs_resource_prefix }}_vpc" + gateway: 10.10.0.1 + netmask: 255.255.255.0 + register: vpc_net +- name: verify test create network in vpc idempotence + assert: + that: + - vpc_net is successful + - vpc_net is not changed + - vpc_net.name == "{{ cs_resource_prefix }}_net_vpc" + +- name: test create instance in vpc in check mode + cs_instance: + name: "{{ cs_resource_prefix }}-vm-vpc" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + network: "{{ cs_resource_prefix }}_net_vpc" + register: instance + check_mode: true +- name: verify test create instance in vpc in check mode + assert: + that: + - instance is successful + - instance is changed + +- name: test create instance in vpc + cs_instance: + name: "{{ cs_resource_prefix }}-vm-vpc" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + network: "{{ cs_resource_prefix }}_net_vpc" + register: instance +- name: verify test create instance in vpc + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-vpc" + - instance.state == "Running" + +- name: test create instance in vpc idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-vpc" + template: "{{ cs_common_template }}" + service_offering: "{{ cs_common_service_offering }}" + zone: "{{ cs_common_zone_adv }}" + network: "{{ cs_resource_prefix }}_net_vpc" + register: instance +- name: verify test create instance in vpc idempotence + assert: + that: + - instance is successful + - instance is not changed + - instance.name == "{{ cs_resource_prefix }}-vm-vpc" + - instance.state == "Running" + +- name: test get ip address in vpc + cs_ip_address: + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: ip_address + when: instance.public_ip is undefined + +- name: test static nat in vpc in check mode + cs_staticnat: + vm: "{{ cs_resource_prefix }}-vm-vpc" + ip_address: "{{ ip_address.ip_address }}" + zone: "{{ cs_common_zone_adv }}" + vpc: "{{ cs_resource_prefix }}_vpc" + network: "{{ cs_resource_prefix }}_net_vpc" + register: static_nat + check_mode: true +- name: verify test static nat in vpc in check mode + assert: + that: + - static_nat is successful + - static_nat is changed + +- name: test static nat in vpc + cs_staticnat: + vm: "{{ cs_resource_prefix }}-vm-vpc" + ip_address: "{{ ip_address.ip_address }}" + zone: "{{ cs_common_zone_adv }}" + vpc: "{{ cs_resource_prefix }}_vpc" + network: "{{ cs_resource_prefix }}_net_vpc" + register: static_nat +- name: verify test static nat in vpc + assert: + that: + - static_nat is successful + - static_nat is changed + +- name: test static nat in vpc idempotence + cs_staticnat: + vm: "{{ cs_resource_prefix }}-vm-vpc" + ip_address: "{{ ip_address.ip_address }}" + zone: "{{ cs_common_zone_adv }}" + vpc: "{{ cs_resource_prefix }}_vpc" + network: "{{ cs_resource_prefix }}_net_vpc" + register: static_nat +- name: verify test static nat in vpc idempotence + assert: + that: + - static_nat is successful + - static_nat is not changed + +- name: test remove static nat in vpc in check mode + cs_staticnat: + vm: "{{ cs_resource_prefix }}-vm-vpc" + ip_address: "{{ ip_address.ip_address }}" + zone: "{{ cs_common_zone_adv }}" + vpc: "{{ cs_resource_prefix }}_vpc" + network: "{{ cs_resource_prefix }}_net_vpc" + state: absent + register: static_nat + check_mode: true +- name: verify test remove static nat in vpc in check mode + assert: + that: + - static_nat is successful + - static_nat is changed + +- name: test remove static nat in vpc + cs_staticnat: + vm: "{{ cs_resource_prefix }}-vm-vpc" + ip_address: "{{ ip_address.ip_address }}" + zone: "{{ cs_common_zone_adv }}" + vpc: "{{ cs_resource_prefix }}_vpc" + network: "{{ cs_resource_prefix }}_net_vpc" + state: absent + register: static_nat +- name: verify test remove static nat in vpc + assert: + that: + - static_nat is successful + - static_nat is changed + +- name: test remove static nat in vpc idempotence + cs_staticnat: + vm: "{{ cs_resource_prefix }}-vm-vpc" + ip_address: "{{ ip_address.ip_address }}" + zone: "{{ cs_common_zone_adv }}" + vpc: "{{ cs_resource_prefix }}_vpc" + network: "{{ cs_resource_prefix }}_net_vpc" + state: absent + register: static_nat +- name: verify test remove static nat in vpc idempotence + assert: + that: + - static_nat is successful + - static_nat is not changed + +- name: test create port forwarding in vpc in check mode + cs_portforward: + ip_address: "{{ ip_address.ip_address }}" + vm: "{{ cs_resource_prefix }}-vm-vpc" + public_port: 80 + private_port: 8080 + network: "{{ cs_resource_prefix }}_net_vpc" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: port_forward + check_mode: true +- name: verify test create port forwarding in vpc in check mode + assert: + that: + - port_forward is successful + - port_forward is changed + +- name: test create port forwarding in vpc + cs_portforward: + ip_address: "{{ ip_address.ip_address }}" + vm: "{{ cs_resource_prefix }}-vm-vpc" + public_port: 80 + private_port: 8080 + network: "{{ cs_resource_prefix }}_net_vpc" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: port_forward +- name: verify test create port forwarding in vpc + assert: + that: + - port_forward is successful + - port_forward is changed + +- name: test create port forwarding in vpc idempotence + cs_portforward: + ip_address: "{{ ip_address.ip_address }}" + vm: "{{ cs_resource_prefix }}-vm-vpc" + public_port: 80 + private_port: 8080 + network: "{{ cs_resource_prefix }}_net_vpc" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: port_forward +- name: verify test create port forwarding in vpc idempotence + assert: + that: + - port_forward is successful + - port_forward is not changed + +- name: test remove port forwarding in vpc in check mode + cs_portforward: + ip_address: "{{ ip_address.ip_address }}" + vm: "{{ cs_resource_prefix }}-vm-vpc" + public_port: 80 + private_port: 8080 + network: "{{ cs_resource_prefix }}_net_vpc" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: port_forward + check_mode: true +- name: verify test remove port forwarding in vpc in check mode + assert: + that: + - port_forward is successful + - port_forward is changed + +- name: test remove port forwarding in vpc + cs_portforward: + ip_address: "{{ ip_address.ip_address }}" + vm: "{{ cs_resource_prefix }}-vm-vpc" + public_port: 80 + private_port: 8080 + network: "{{ cs_resource_prefix }}_net_vpc" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: port_forward +- name: verify test remove port forwarding in vpc + assert: + that: + - port_forward is successful + - port_forward is changed + +- name: test remove port forwarding in vpc idempotence + cs_portforward: + ip_address: "{{ ip_address.ip_address }}" + vm: "{{ cs_resource_prefix }}-vm-vpc" + public_port: 80 + private_port: 8080 + network: "{{ cs_resource_prefix }}_net_vpc" + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: port_forward +- name: verify test remove port forwarding in vpc idempotence + assert: + that: + - port_forward is successful + - port_forward is not changed + +- name: test remove ip address from vpc + cs_ip_address: + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + ip_address: "{{ ip_address.ip_address }}" + state: absent + register: ip_address_removed +- name: verify test remove ip address from vpc + assert: + that: + - ip_address_removed is successful + - ip_address_removed is changed + +- name: test remove instance in vpc in check mdoe + cs_instance: + name: "{{ cs_resource_prefix }}-vm-vpc" + zone: "{{ cs_common_zone_adv }}" + state: expunged + register: instance + check_mode: true +- name: verify test remove instance in vpc in check mode + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-vpc" + - instance.state == "Running" + +- name: test remove instance in vpc + cs_instance: + name: "{{ cs_resource_prefix }}-vm-vpc" + zone: "{{ cs_common_zone_adv }}" + state: expunged + register: instance +- name: verify test remove instance in vpc + assert: + that: + - instance is successful + - instance is changed + - instance.name == "{{ cs_resource_prefix }}-vm-vpc" + - instance.state == "Running" + +- name: test remove instance in vpc idempotence + cs_instance: + name: "{{ cs_resource_prefix }}-vm-vpc" + zone: "{{ cs_common_zone_adv }}" + state: expunged + register: instance +- name: verify test remove instance in vpc idempotence + assert: + that: + - instance is successful + - instance is not changed + +- name: test remove network in vpc in check mode + cs_network: + name: "{{ cs_resource_prefix }}_net_vpc" + zone: "{{ cs_common_zone_adv }}" + vpc: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpc_net + check_mode: true +- name: verify test remove network in vpc in check mode + assert: + that: + - vpc_net is successful + - vpc_net is changed + - vpc_net.name == "{{ cs_resource_prefix }}_net_vpc" + +- name: test remove network in vpc + cs_network: + name: "{{ cs_resource_prefix }}_net_vpc" + zone: "{{ cs_common_zone_adv }}" + vpc: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpc_net +- name: verify test remove network in vpc + assert: + that: + - vpc_net is successful + - vpc_net is changed + - vpc_net.name == "{{ cs_resource_prefix }}_net_vpc" + +- name: test remove network in vpc idempotence + cs_network: + name: "{{ cs_resource_prefix }}_net_vpc" + zone: "{{ cs_common_zone_adv }}" + vpc: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpc_net +- name: verify test remove network in vpc idempotence + assert: + that: + - vpc_net is successful + - vpc_net is not changed + +- name: test remove vpc with default offering in check mode + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + zone: "{{ cs_common_zone_adv }}" + register: vpc + check_mode: true +- name: verify test remove vpc with default offering in check mode + assert: + that: + - vpc is successful + - vpc is changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text2" + - vpc.cidr == "10.10.0.0/16" + +- name: test remove vpc with default offering + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify test remove vpc with default offering + assert: + that: + - vpc is successful + - vpc is changed + - vpc.name == "{{ cs_resource_prefix }}_vpc" + - vpc.display_text == "{{ cs_resource_prefix }}_display_text2" + - vpc.cidr == "10.10.0.0/16" + +- name: test remove vpc with default offering idempotence + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpc +- name: verify test remove vpc idempotence + assert: + that: + - vpc is successful + - vpc is not changed + +- name: test remove vpc with custom offering + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc_custom" + state: absent + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify test remove vpc with custom offering + assert: + that: + - vpc is successful + - vpc is changed + - vpc.name == "{{ cs_resource_prefix }}_vpc_custom" + - vpc.cidr == "10.10.1.0/16" diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc_offering/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc_offering/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc_offering/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc_offering/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc_offering/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc_offering/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc_offering/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc_offering/tasks/main.yml new file mode 100644 index 00000000..ebbeaf91 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpc_offering/tasks/main.yml @@ -0,0 +1,427 @@ +--- +- name: setup + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpcoffer +- name: verify setup + assert: + that: + - vpcoffer is successful + +- name: test fail if missing name + cs_vpc_offering: + register: vpcoffer + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - vpcoffer is failed + - 'vpcoffer.msg == "missing required arguments: name"' + +- name: test fail if missing params + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + register: vpcoffer + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - vpcoffer is failed + - 'vpcoffer.msg == "missing required arguments: display_text, supported_services"' + +- name: test create vpc offer in check mode + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + register: vpcoffer + check_mode: yes +- name: verify results of vpc offer in check mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + +- name: test create vpc offer + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + register: vpcoffer +- name: verify results of vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + - vpcoffer.distributed == false + - vpcoffer.region_level == false + +- name: test create vpc offer idempotence + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + register: vpcoffer +- name: verify results of create vpc offer idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + - vpcoffer.distributed == false + - vpcoffer.region_level == false + +- name: test enabling existing vpc offer in check_mode + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: enabled + register: vpcoffer + check_mode: yes +- name: verify results of enabling existing vpc offer in check_mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test enabling existing vpc offer + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: enabled + register: vpcoffer +- name: verify results of enabling existing vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test enabling existing vpc offer idempotence + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: enabled + register: vpcoffer +- name: verify results of enabling existing vpc idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test disabling vpc offer in check_mode + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: vpcoffer + check_mode: yes +- name: verify results of disabling vpc offer in check_mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test disabling vpc offer + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: vpcoffer +- name: verify results of disabling vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test disabling vpc offer idempotence + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: vpcoffer +- name: verify results of disabling vpc idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test rename vpc offer in check_mode + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description renamed" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: vpcoffer + check_mode: yes +- name: verify results of rename vpc offer in check_mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test rename vpc offer + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description renamed" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: vpcoffer +- name: verify results of rename vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description renamed" + +- name: test rename vpc offer idempotence + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description renamed" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: disabled + register: vpcoffer +- name: verify results of rename vpc offer idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description renamed" + +- name: test update offer with minimal params in check_mode + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description update" + register: vpcoffer + check_mode: yes +- name: verify results of update offer with minimal params in check_mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description renamed" + +- name: test update offer with minimal params + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description update" + register: vpcoffer +- name: verify results of update offer with minimal params + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description update" + +- name: test update offer with minimal params idempotency + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description update" + register: vpcoffer +- name: verify results of update offer with minimal params idempotency + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description update" + +- name: test remove vpc offer in check_mode + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpcoffer + check_mode: yes +- name: verify results of rename vpc offer in check_mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description update" + +- name: test remove vpc offer + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpcoffer +- name: verify results of rename vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + +- name: test remove vpc offer idempotence + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpcoffer +- name: verify results of rename vpc offer idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + +- name: test create enabled vpc offer in check mode + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: enabled + register: vpcoffer + check_mode: yes +- name: verify results of create enabled vpc offer in check mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + +- name: test create enabled vpc offer + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: enabled + register: vpcoffer +- name: verify results of create enabled vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test create enabled vpc offer idempotence + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: enabled + register: vpcoffer +- name: verify results of create enabled vpc offer idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test create enabled region level vpc offer with distrubuted router + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc_drl" + display_text: "vpc offering description" + supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb ] + service_providers: + - { service: 'dns', provider: 'virtualrouter' } + - { service: 'dhcp', provider: 'virtualrouter' } + state: enabled + service_capabilities: + - {service: 'Connectivity', capabilitytype: 'DistributedRouter', capabilityvalue: true} + - {service: 'Connectivity', capabilitytype: 'RegionLevelVPC', capabilityvalue: true} + register: vpcoffer +- name: verify results of create enabled region level vpc offer with distrubuted router + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == "{{ cs_resource_prefix }}_vpc_drl" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + - vpcoffer.distributed == true + - vpcoffer.region_level == true + +- name: remove vpc offer + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpcoffer +- name: verify results of remove vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + +- name: remove region level vpc offer with distrubuted router + cs_vpc_offering: + name: "{{ cs_resource_prefix }}_vpc_drl" + state: absent + register: vpcoffer +- name: verify results of remove region level vpc offer with distrubuted router + assert: + that: + - vpcoffer is successful + - vpcoffer is changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_connection/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_connection/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_connection/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_connection/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_connection/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_connection/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_connection/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_connection/tasks/main.yml new file mode 100644 index 00000000..97e1d941 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_connection/tasks/main.yml @@ -0,0 +1,205 @@ +--- +- name: setup vpc + cs_vpc: + name: my_vpc + display_text: my_vpc + cidr: 10.10.1.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify setup vpc + assert: + that: + - vpc is successful + +- name: setup customer gateway + cs_vpn_customer_gateway: + name: my_vpn_customer_gateway + cidr: 192.168.123.0/24 + esp_policy: aes256-sha1;modp1536 + gateway: 10.11.1.1 + ike_policy: aes256-sha1;modp1536 + ipsec_psk: ~S3¢r3Tk3Y¼ + esp_lifetime: 3600 + register: vcg +- name: setup customer gateway + assert: + that: + - vcg is successful + +- name: setup remove vpn connection + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpn_conn +- name: verify setup remove vpn connection + assert: + that: + - vpn_conn is successful + +- name: setup vpn gateway absent + cs_vpn_gateway: + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpn_gateway +- name: verify setup vpn gateway absent + assert: + that: + - vpn_gateway is successful + +- name: test fail create vpn connection without gateway and force + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + ignore_errors: yes + register: vpn_conn +- name: verify test fail create vpn connection without gateway and force + assert: + that: + - vpn_conn is failed + - vpn_conn.msg == "VPN gateway not found and not forced to create one" + +- name: test create vpn connection with force in check mode + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + force: yes + zone: "{{ cs_common_zone_adv }}" + check_mode: yes + register: vpn_conn +- name: verify test create vpn connection with force in check mode + assert: + that: + - vpn_conn is changed + +- name: test create vpn connection with force + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + force: yes + zone: "{{ cs_common_zone_adv }}" + register: vpn_conn +- name: verify test create vpn connection with force + assert: + that: + - vpn_conn is changed + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" + - vpn_conn.vpc == "my_vpc" + +- name: test create vpn connection with force idempotence + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + force: yes + zone: "{{ cs_common_zone_adv }}" + register: vpn_conn +- name: verify test create vpn connection with force idempotence + assert: + that: + - vpn_conn is not changed + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" + - vpn_conn.vpc == "my_vpc" + +- name: test remove vpn connection in check mode + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + state: absent + check_mode: yes + register: vpn_conn +- name: verify test remove vpn connection in check mode + assert: + that: + - vpn_conn is changed + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" + - vpn_conn.vpc == "my_vpc" + +- name: test remove vpn connection + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpn_conn +- name: verify test remove vpn connection + assert: + that: + - vpn_conn is changed + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" + - vpn_conn.vpc == "my_vpc" + +- name: test remove vpn connection idempotence + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpn_conn +- name: verify test remove vpn connection idempotence + assert: + that: + - vpn_conn is not changed + +- name: setup create vpn gateway + cs_vpn_gateway: + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + register: vpn_gateway +- name: verify setup create vpn gateway + assert: + that: + - vpn_gateway is success + +- name: test create vpn connection without force in check mode + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + check_mode: yes + register: vpn_conn +- name: verify test create vpn connection without force in check mode + assert: + that: + - vpn_conn is changed + +- name: test create vpn connection without force + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + register: vpn_conn +- name: verify test create vpn connection without force + assert: + that: + - vpn_conn is changed + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" + - vpn_conn.vpc == "my_vpc" + +- name: test create vpn connection without force + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + register: vpn_conn +- name: verify test create vpn connection without force + assert: + that: + - vpn_conn is not changed + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" + - vpn_conn.vpc == "my_vpc" + +- name: cleanup remove vpn connection + cs_vpn_connection: + vpn_customer_gateway: my_vpn_customer_gateway + vpc: my_vpc + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpn_conn +- name: verify cleanup remove vpn connection idempotence + assert: + that: + - vpn_conn is successful diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_customer_gateway/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_customer_gateway/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_customer_gateway/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_customer_gateway/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_customer_gateway/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_customer_gateway/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_customer_gateway/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_customer_gateway/tasks/main.yml new file mode 100644 index 00000000..d18d4b6f --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_customer_gateway/tasks/main.yml @@ -0,0 +1,208 @@ +--- +- name: setup vpn customer gateway absent + cs_vpn_customer_gateway: + name: ansible_vpn_customer_gw + state: absent + register: vcg +- name: verify setup vpn customer gateway absent + assert: + that: + - vcg is successful + +- name: test create vpn customer gateway in check mode + cs_vpn_customer_gateway: + name: ansible_vpn_customer_gw + cidr: 192.168.123.0/24 + esp_policy: aes256-sha1;modp1536 + gateway: 10.10.0.1 + ike_policy: aes256-sha1;modp1536 + ipsec_psk: ~S3¢r3Tk3Y¼ + esp_lifetime: 3600 + check_mode: true + register: vcg +- name: verify test create vpn customer gateway in check mode + assert: + that: + - vcg is changed + +- name: test create vpn customer gateway + cs_vpn_customer_gateway: + name: ansible_vpn_customer_gw + cidr: 192.168.123.0/24 + esp_policy: aes256-sha1;modp1536 + gateway: 10.10.0.1 + ike_policy: aes256-sha1;modp1536 + ipsec_psk: ~S3¢r3Tk3Y¼ + esp_lifetime: 3600 + register: vcg +- name: verify test create vpn customer gateway + assert: + that: + - vcg is changed + - "vcg.cidrs == ['192.168.123.0/24']" + - vcg.dpd == false + - vcg.esp_lifetime == 3600 + - vcg.esp_policy == 'aes256-sha1;modp1536' + - vcg.force_encap == false + - vcg.ike_policy == 'aes256-sha1;modp1536' + - vcg.gateway == '10.10.0.1' + - vcg.name == 'ansible_vpn_customer_gw' + - vcg.ike_lifetime == 86400 + +- name: test create vpn customer gateway idempotency + cs_vpn_customer_gateway: + name: ansible_vpn_customer_gw + cidr: 192.168.123.0/24 + esp_policy: aes256-sha1;modp1536 + gateway: 10.10.0.1 + ike_policy: aes256-sha1;modp1536 + ipsec_psk: ~S3¢r3Tk3Y¼ + esp_lifetime: 3600 + register: vcg +- name: verify test create vpn customer gateway idempotency + assert: + that: + - vcg is not changed + - "vcg.cidrs == ['192.168.123.0/24']" + - vcg.dpd == false + - vcg.esp_lifetime == 3600 + - vcg.esp_policy == 'aes256-sha1;modp1536' + - vcg.force_encap == false + - vcg.ike_policy == 'aes256-sha1;modp1536' + - vcg.gateway == '10.10.0.1' + - vcg.name == 'ansible_vpn_customer_gw' + - vcg.ike_lifetime == 86400 + +- name: test update vpn customer gateway in check mode + cs_vpn_customer_gateway: + name: ansible_vpn_customer_gw + cidrs: + - 192.168.123.0/24 + - 192.168.124.0/24 + esp_policy: aes256-sha1;modp1536 + gateway: 10.10.1.1 + ike_policy: aes256-sha1;modp1536 + ipsec_psk: ~S3¢r3Tk3Y@ + esp_lifetime: 1800 + ike_lifetime: 23200 + force_encap: true + check_mode: true + register: vcg +- name: verify test update vpn customer gateway in check mode + assert: + that: + - vcg is changed + - "vcg.cidrs == ['192.168.123.0/24']" + - vcg.dpd == false + - vcg.esp_lifetime == 3600 + - vcg.esp_policy == 'aes256-sha1;modp1536' + - vcg.force_encap == false + - vcg.ike_policy == 'aes256-sha1;modp1536' + - vcg.gateway == '10.10.0.1' + - vcg.name == 'ansible_vpn_customer_gw' + - vcg.ike_lifetime == 86400 + +- name: test update vpn customer gateway + cs_vpn_customer_gateway: + name: ansible_vpn_customer_gw + cidrs: + - 192.168.123.0/24 + - 192.168.124.0/24 + esp_policy: aes256-sha1;modp1536 + gateway: 10.10.1.1 + ike_policy: aes256-sha1;modp1536 + ipsec_psk: ~S3¢r3Tk3Y@ + esp_lifetime: 1800 + ike_lifetime: 23200 + force_encap: true + register: vcg +- name: verify test update vpn customer gateway + assert: + that: + - vcg is changed + - "vcg.cidrs == ['192.168.123.0/24', '192.168.124.0/24']" + - vcg.dpd == false + - vcg.esp_lifetime == 1800 + - vcg.esp_policy == 'aes256-sha1;modp1536' + - vcg.force_encap == true + - vcg.ike_policy == 'aes256-sha1;modp1536' + - vcg.gateway == '10.10.1.1' + - vcg.name == 'ansible_vpn_customer_gw' + - vcg.ike_lifetime == 23200 + +- name: test update vpn customer gateway idempotence + cs_vpn_customer_gateway: + name: ansible_vpn_customer_gw + cidrs: + - 192.168.123.0/24 + - 192.168.124.0/24 + esp_policy: aes256-sha1;modp1536 + gateway: 10.10.1.1 + ike_policy: aes256-sha1;modp1536 + ipsec_psk: ~S3¢r3Tk3Y@ + esp_lifetime: 1800 + ike_lifetime: 23200 + force_encap: true + register: vcg +- name: verify test update vpn customer gateway idempotence + assert: + that: + - vcg is not changed + - "vcg.cidrs == ['192.168.123.0/24', '192.168.124.0/24']" + - vcg.dpd == false + - vcg.esp_lifetime == 1800 + - vcg.esp_policy == 'aes256-sha1;modp1536' + - vcg.force_encap == true + - vcg.ike_policy == 'aes256-sha1;modp1536' + - vcg.gateway == '10.10.1.1' + - vcg.name == 'ansible_vpn_customer_gw' + - vcg.ike_lifetime == 23200 + +- name: test remove vpn customer gateway in check mode + cs_vpn_customer_gateway: + name: ansible_vpn_customer_gw + state: absent + check_mode: true + register: vcg +- name: verify test remove vpn customer gateway in check mode + assert: + that: + - vcg is changed + - "vcg.cidrs == ['192.168.123.0/24', '192.168.124.0/24']" + - vcg.dpd == false + - vcg.esp_lifetime == 1800 + - vcg.esp_policy == 'aes256-sha1;modp1536' + - vcg.force_encap == true + - vcg.ike_policy == 'aes256-sha1;modp1536' + - vcg.gateway == '10.10.1.1' + - vcg.name == 'ansible_vpn_customer_gw' + - vcg.ike_lifetime == 23200 + +- name: test remove vpn customer gateway + cs_vpn_customer_gateway: + name: ansible_vpn_customer_gw + state: absent + register: vcg +- name: verify test remove vpn customer gateway + assert: + that: + - vcg is changed + - "vcg.cidrs == ['192.168.123.0/24', '192.168.124.0/24']" + - vcg.dpd == false + - vcg.esp_lifetime == 1800 + - vcg.esp_policy == 'aes256-sha1;modp1536' + - vcg.force_encap == true + - vcg.ike_policy == 'aes256-sha1;modp1536' + - vcg.gateway == '10.10.1.1' + - vcg.name == 'ansible_vpn_customer_gw' + - vcg.ike_lifetime == 23200 + +- name: test remove vpn customer gateway idempotence + cs_vpn_customer_gateway: + name: ansible_vpn_customer_gw + state: absent + register: vcg +- name: verify test remove vpn customer gateway idempotence + assert: + that: + - vcg is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_gateway/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_gateway/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_gateway/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_gateway/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_gateway/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_gateway/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_gateway/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_gateway/tasks/main.yml new file mode 100644 index 00000000..2dd7a445 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_vpn_gateway/tasks/main.yml @@ -0,0 +1,108 @@ +--- +- name: setup vpc + cs_vpc: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "{{ cs_resource_prefix }}_display_text" + cidr: 10.10.0.0/16 + zone: "{{ cs_common_zone_adv }}" + register: vpc +- name: verify setup vpc + assert: + that: + - vpc is successful + +- name: setup vpn gateway absent + cs_vpn_gateway: + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpn_gateway +- name: verify setup vpn gateway absent + assert: + that: + - vpn_gateway is successful + +- name: test fail missing param vpc for vpn gateway + cs_vpn_gateway: + ignore_errors: true + register: vpn_gateway +- name: verify test fail missing param vpc for vpn gateway + assert: + that: + - vpn_gateway is failed + - "vpn_gateway.msg.startswith('missing required arguments: ')" + +- name: test create vpn gateway in check mode + cs_vpn_gateway: + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: vpn_gateway + check_mode: true +- name: verify test create vpn gateway in check mode + assert: + that: + - vpn_gateway is successful + - vpn_gateway is changed + +- name: test create vpn gateway + cs_vpn_gateway: + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: vpn_gateway +- name: verify test create vpn gateway + assert: + that: + - vpn_gateway is successful + - vpn_gateway is changed + - vpn_gateway.vpc == "{{ cs_resource_prefix }}_vpc" + +- name: test create vpn gateway idempotence + cs_vpn_gateway: + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + register: vpn_gateway +- name: verify test create vpn gateway idempotence + assert: + that: + - vpn_gateway is successful + - vpn_gateway is not changed + - vpn_gateway.vpc == "{{ cs_resource_prefix }}_vpc" + +- name: test remove vpn gateway in check mode + cs_vpn_gateway: + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpn_gateway + check_mode: true +- name: verify test remove vpn gateway in check mode + assert: + that: + - vpn_gateway is successful + - vpn_gateway is changed + - vpn_gateway.vpc == "{{ cs_resource_prefix }}_vpc" + +- name: test remove vpn gateway + cs_vpn_gateway: + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpn_gateway +- name: verify test remove vpn gateway + assert: + that: + - vpn_gateway is successful + - vpn_gateway is changed + - vpn_gateway.vpc == "{{ cs_resource_prefix }}_vpc" + +- name: test remove vpn gateway idempotence + cs_vpn_gateway: + vpc: "{{ cs_resource_prefix }}_vpc" + zone: "{{ cs_common_zone_adv }}" + state: absent + register: vpn_gateway +- name: verify test remove vpn gateway idempotence + assert: + that: + - vpn_gateway is successful + - vpn_gateway is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone/aliases new file mode 100644 index 00000000..a315c1b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group2 diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone/tasks/main.yml new file mode 100644 index 00000000..9137db44 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone/tasks/main.yml @@ -0,0 +1,205 @@ +--- +- name: setup zone is absent + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + state: absent + register: zone +- name: verify setup zone absent + assert: + that: + - zone is successful + +- name: test fail missing param + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + register: zone + ignore_errors: true +- name: verify test fail missing param + assert: + that: + - zone is failed + - "zone.msg == 'missing required arguments: dns1'" + +- name: test create zone in check mode + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + dns1: 8.8.8.8 + dns2: 8.8.4.4 + network_type: Basic + register: zone + check_mode: true +- name: verify test create zone in check mode + assert: + that: + - zone is successful + - zone is changed + +- name: test create zone + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + dns1: 8.8.8.8 + dns2: 8.8.4.4 + network_type: Basic + register: zone +- name: verify test create zone + assert: + that: + - zone is successful + - zone is changed + - zone.dns1 == "8.8.8.8" + - zone.dns2 == "8.8.4.4" + - zone.internal_dns1 == "8.8.8.8" + - zone.internal_dns2 == "8.8.4.4" + - zone.local_storage_enabled == false + - zone.network_type == "Basic" + - zone.zone_token != "" + - zone.securitygroups_enabled == true + - zone.dhcp_provider == "VirtualRouter" + +- name: test create zone idempotency + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + dns1: 8.8.8.8 + dns2: 8.8.4.4 + network_type: Basic + register: zone +- name: verify test create zone idempotency + assert: + that: + - zone is successful + - zone is not changed + - zone.dns1 == "8.8.8.8" + - zone.dns2 == "8.8.4.4" + - zone.internal_dns1 == "8.8.8.8" + - zone.internal_dns2 == "8.8.4.4" + - zone.local_storage_enabled == false + - zone.network_type == "Basic" + - zone.zone_token != "" + - zone.securitygroups_enabled == true + - zone.dhcp_provider == "VirtualRouter" + +- name: test update zone in check mode + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + dns1: 8.8.8.8 + dns2: 8.8.4.4 + internal_dns1: 10.10.1.100 + internal_dns2: 10.10.1.101 + local_storage_enabled: true + network_type: Basic + register: zone + check_mode: true +- name: verify test update zone in check mode + assert: + that: + - zone is successful + - zone is changed + - zone.dns1 == "8.8.8.8" + - zone.dns2 == "8.8.4.4" + - zone.internal_dns1 == "8.8.8.8" + - zone.internal_dns2 == "8.8.4.4" + - zone.local_storage_enabled == false + - zone.network_type == "Basic" + - zone.zone_token != "" + - zone.securitygroups_enabled == true + - zone.dhcp_provider == "VirtualRouter" + +- name: test update zone + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + dns1: 8.8.8.8 + dns2: 8.8.4.4 + internal_dns1: 10.10.1.100 + internal_dns2: 10.10.1.101 + local_storage_enabled: true + network_type: Basic + register: zone +- name: verify test update zone + assert: + that: + - zone is successful + - zone is changed + - zone.dns1 == "8.8.8.8" + - zone.dns2 == "8.8.4.4" + - zone.internal_dns1 == "10.10.1.100" + - zone.internal_dns2 == "10.10.1.101" + - zone.local_storage_enabled == true + - zone.network_type == "Basic" + - zone.zone_token != "" + - zone.securitygroups_enabled == true + - zone.dhcp_provider == "VirtualRouter" + +- name: test update zone idempotency + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + dns1: 8.8.8.8 + dns2: 8.8.4.4 + internal_dns1: 10.10.1.100 + internal_dns2: 10.10.1.101 + local_storage_enabled: true + network_type: Basic + register: zone +- name: verify test update zone idempotency + assert: + that: + - zone is successful + - zone is not changed + - zone.dns1 == "8.8.8.8" + - zone.dns2 == "8.8.4.4" + - zone.internal_dns1 == "10.10.1.100" + - zone.internal_dns2 == "10.10.1.101" + - zone.local_storage_enabled == true + - zone.network_type == "Basic" + - zone.zone_token != "" + - zone.securitygroups_enabled == true + - zone.dhcp_provider == "VirtualRouter" + +- name: test absent zone in check mode + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + state: absent + register: zone + check_mode: true +- name: verify test absent zone in check mode + assert: + that: + - zone is successful + - zone is changed + - zone.dns1 == "8.8.8.8" + - zone.dns2 == "8.8.4.4" + - zone.internal_dns1 == "10.10.1.100" + - zone.internal_dns2 == "10.10.1.101" + - zone.local_storage_enabled == true + - zone.network_type == "Basic" + - zone.zone_token != "" + - zone.securitygroups_enabled == true + +- name: test absent zone + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + state: absent + register: zone +- name: verify test absent zone + assert: + that: + - zone is successful + - zone is changed + - zone.dns1 == "8.8.8.8" + - zone.dns2 == "8.8.4.4" + - zone.internal_dns1 == "10.10.1.100" + - zone.internal_dns2 == "10.10.1.101" + - zone.local_storage_enabled == true + - zone.network_type == "Basic" + - zone.zone_token != "" + - zone.securitygroups_enabled == true + +- name: test absent zone idempotency + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + state: absent + register: zone +- name: verify test absent zone idempotency + assert: + that: + - zone is successful + - zone is not changed diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone_info/aliases b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone_info/aliases new file mode 100644 index 00000000..3b5a38e7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone_info/aliases @@ -0,0 +1,3 @@ +cloud/cs +shippable/cs/group2 +shippable/cs/smoketest diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone_info/meta/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone_info/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone_info/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone_info/tasks/main.yml b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone_info/tasks/main.yml new file mode 100644 index 00000000..74dccf80 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/integration/targets/cs_zone_info/tasks/main.yml @@ -0,0 +1,73 @@ +--- +- name: setup zone is present + cs_zone: + name: "{{ cs_resource_prefix }}-zone" + dns1: 8.8.8.8 + dns2: 8.8.4.4 + network_type: Basic + register: zone +- name: verify setup zone is present + assert: + that: + - zone is successful + +- name: get info from zone in check mode + cs_zone_info: + name: "{{ cs_resource_prefix }}-zone" + register: zone + check_mode: yes +- name: verify get info from zone in check mode + assert: + that: + - zone is successful + - zone is not changed + - zone.zones[0].dns1 == "8.8.8.8" + - zone.zones[0].dns2 == "8.8.4.4" + - zone.zones[0].internal_dns1 == "8.8.8.8" + - zone.zones[0].internal_dns2 == "8.8.4.4" + - zone.zones[0].local_storage_enabled == false + - zone.zones[0].network_type == "Basic" + - zone.zones[0].zone_token != "" + - zone.zones[0].securitygroups_enabled == true + - zone.zones[0].dhcp_provider == "VirtualRouter" + - zone.zones[0].local_storage_enabled == false + +- name: get info from zone + cs_zone_info: + name: "{{ cs_resource_prefix }}-zone" + register: zone +- name: verify get info from zone + assert: + that: + - zone is successful + - zone is not changed + - zone.zones[0].dns1 == "8.8.8.8" + - zone.zones[0].dns2 == "8.8.4.4" + - zone.zones[0].internal_dns1 == "8.8.8.8" + - zone.zones[0].internal_dns2 == "8.8.4.4" + - zone.zones[0].local_storage_enabled == false + - zone.zones[0].network_type == "Basic" + - zone.zones[0].zone_token != "" + - zone.zones[0].securitygroups_enabled == true + - zone.zones[0].dhcp_provider == "VirtualRouter" + - zone.zones[0].local_storage_enabled == false + +- name: get info from all zones + cs_zone_info: + register: zones +- name: verify get info from all zones + assert: + that: + - zones is successful + - zones is not changed + - zones.zones | length > 0 + - '"dns1" in zone.zones[0]' + - '"dns2" in zone.zones[0]' + - '"internal_dns1" in zone.zones[0]' + - '"internal_dns2" in zone.zones[0]' + - '"local_storage_enabled" in zone.zones[0]' + - '"network_type" in zone.zones[0]' + - '"zone_token" in zone.zones[0]' + - '"securitygroups_enabled" in zone.zones[0]' + - '"dhcp_provider" in zone.zones[0]' + - '"local_storage_enabled" in zone.zones[0]' diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/sanity/ignore-2.10.txt b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/sanity/ignore-2.10.txt new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/sanity/ignore-2.10.txt diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/sanity/ignore-2.9.txt b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/sanity/ignore-2.9.txt new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/sanity/ignore-2.9.txt diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/sanity/requirements.txt b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/sanity/requirements.txt new file mode 100644 index 00000000..3e3a9669 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/sanity/requirements.txt @@ -0,0 +1,4 @@ +packaging # needed for update-bundled and changelog +sphinx ; python_version >= '3.5' # docs build requires python 3+ +sphinx-notfound-page ; python_version >= '3.5' # docs build requires python 3+ +straight.plugin ; python_version >= '3.5' # needed for hacking/build-ansible.py which will host changelog generation and requires python 3+ diff --git a/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/unit/modules/test_cs_traffic_type.py b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/unit/modules/test_cs_traffic_type.py new file mode 100644 index 00000000..0747b7ad --- /dev/null +++ b/collections-debian-merged/ansible_collections/ngine_io/cloudstack/tests/unit/modules/test_cs_traffic_type.py @@ -0,0 +1,135 @@ +from __future__ import (absolute_import, division, print_function) +import sys +import pytest +import units.compat.unittest as unittest +from units.compat.mock import MagicMock +from units.compat.unittest import TestCase +from units.modules.utils import set_module_args + +__metaclass__ = type + + +# Exoscale's cs doesn't support Python 2.6 +pytestmark = [] +if sys.version_info[:2] != (2, 6): + from ansible.modules.cloud.cloudstack.cs_traffic_type import AnsibleCloudStackTrafficType, setup_module_object + from ansible.module_utils.cloudstack import HAS_LIB_CS + if not HAS_LIB_CS: + pytestmark.append(pytest.mark.skip('The cloudstack library, "cs", is needed to test cs_traffic_type')) +else: + pytestmark.append(pytest.mark.skip('Exoscale\'s cs doesn\'t support Python 2.6')) + + +EXISTING_TRAFFIC_TYPES_RESPONSE = { + "count": 3, + "traffictype": [ + { + "id": "9801cf73-5a73-4883-97e4-fa20c129226f", + "kvmnetworklabel": "cloudbr0", + "physicalnetworkid": "659c1840-9374-440d-a412-55ca360c9d3c", + "traffictype": "Management" + }, + { + "id": "28ed70b7-9a1f-41bf-94c3-53a9f22da8b6", + "kvmnetworklabel": "cloudbr0", + "physicalnetworkid": "659c1840-9374-440d-a412-55ca360c9d3c", + "traffictype": "Guest" + }, + { + "id": "9c05c802-84c0-4eda-8f0a-f681364ffb46", + "kvmnetworklabel": "cloudbr0", + "physicalnetworkid": "659c1840-9374-440d-a412-55ca360c9d3c", + "traffictype": "Storage" + } + ] +} + +VALID_LIST_NETWORKS_RESPONSE = { + "count": 1, + "physicalnetwork": [ + { + "broadcastdomainrange": "ZONE", + "id": "659c1840-9374-440d-a412-55ca360c9d3c", + "name": "eth1", + "state": "Enabled", + "vlan": "3900-4000", + "zoneid": "49acf813-a8dd-4da0-aa53-1d826d6003e7" + } + ] +} + +VALID_LIST_ZONES_RESPONSE = { + "count": 1, + "zone": [ + { + "allocationstate": "Enabled", + "dhcpprovider": "VirtualRouter", + "dns1": "8.8.8.8", + "dns2": "8.8.4.4", + "guestcidraddress": "10.10.0.0/16", + "id": "49acf813-a8dd-4da0-aa53-1d826d6003e7", + "internaldns1": "192.168.56.1", + "localstorageenabled": True, + "name": "DevCloud-01", + "networktype": "Advanced", + "securitygroupsenabled": False, + "tags": [], + "zonetoken": "df20d65a-c6c8-3880-9064-4f77de2291ef" + } + ] +} + + +base_module_args = { + "api_key": "api_key", + "api_secret": "very_secret_content", + "api_url": "http://localhost:8888/api/client", + "kvm_networklabel": "cloudbr0", + "physical_network": "eth1", + "poll_async": True, + "state": "present", + "traffic_type": "Guest", + "zone": "DevCloud-01" +} + + +class TestAnsibleCloudstackTraffiType(TestCase): + + def test_module_is_created_sensibly(self): + set_module_args(base_module_args) + module = setup_module_object() + assert module.params['traffic_type'] == 'Guest' + + def test_update_called_when_traffic_type_exists(self): + set_module_args(base_module_args) + module = setup_module_object() + actt = AnsibleCloudStackTrafficType(module) + actt.get_traffic_type = MagicMock(return_value=EXISTING_TRAFFIC_TYPES_RESPONSE['traffictype'][0]) + actt.update_traffic_type = MagicMock() + actt.present_traffic_type() + self.assertTrue(actt.update_traffic_type.called) + + def test_update_not_called_when_traffic_type_doesnt_exist(self): + set_module_args(base_module_args) + module = setup_module_object() + actt = AnsibleCloudStackTrafficType(module) + actt.get_traffic_type = MagicMock(return_value=None) + actt.update_traffic_type = MagicMock() + actt.add_traffic_type = MagicMock() + actt.present_traffic_type() + self.assertFalse(actt.update_traffic_type.called) + self.assertTrue(actt.add_traffic_type.called) + + def test_traffic_type_returned_if_exists(self): + set_module_args(base_module_args) + module = setup_module_object() + actt = AnsibleCloudStackTrafficType(module) + actt.get_physical_network = MagicMock(return_value=VALID_LIST_NETWORKS_RESPONSE['physicalnetwork'][0]) + actt.get_traffic_types = MagicMock(return_value=EXISTING_TRAFFIC_TYPES_RESPONSE) + tt = actt.present_traffic_type() + self.assertTrue(tt.get('kvmnetworklabel') == base_module_args['kvm_networklabel']) + self.assertTrue(tt.get('traffictype') == base_module_args['traffic_type']) + + +if __name__ == '__main__': + unittest.main() |