cloudstack migrated to dedicated collection ngine_io.cloudstack (#173)

* cloudstack migrated to dedicated collection ngine_io.cloudstack

* remove leftovers

* remove more leftovers
This commit is contained in:
René Moser 2020-04-14 07:33:10 +02:00 committed by GitHub
parent 6ccf3682ac
commit ec52007c8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
312 changed files with 0 additions and 37203 deletions

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,442 +0,0 @@
---
- name: setup
cs_account: name={{ cs_resource_prefix }}_user state=absent
register: acc
- name: verify setup
assert:
that:
- acc is successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- acc is changed
- acc.name == "{{ cs_resource_prefix }}_user"
- acc.network_domain == "example.com"
- acc.account_type == "user"
- acc.state == "enabled"
- acc.domain == "ROOT"

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,93 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,306 +0,0 @@
---
- name: setup cluster is absent
cs_cluster:
name: "{{ cs_resource_prefix }}-cluster"
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:
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"
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"
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"
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"
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"
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"
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"
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"
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"
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

View file

@ -1 +0,0 @@
hidden

View file

@ -1,6 +0,0 @@
---
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

View file

@ -1,23 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,5 +0,0 @@
---
test_cs_configuration_storage: PS0-adv
test_cs_configuration_cluster: C0-basic
test_cs_configuration_account: admin
test_cs_configuration_zone: Sandbox-simulator-basic

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,76 +0,0 @@
---
- 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 }}"

View file

@ -1,76 +0,0 @@
---
- 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 }}"

View file

@ -1,204 +0,0 @@
---
- 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

View file

@ -1,76 +0,0 @@
---
- 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 }}"

View file

@ -1,59 +0,0 @@
---
- 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 }}"

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,143 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,241 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
cs_firewall_ip_address: 10.100.212.5
cs_firewall_network: ansible test

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,484 +0,0 @@
---
- name: network setup
cs_network:
name: "{{ cs_firewall_network }}"
network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService
network_domain: example.com
zone: "{{ cs_common_zone_adv }}"
register: net
- name: verify network setup
assert:
that:
- net is successful
- 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
register: fw
- name: verify setup
assert:
that:
- fw is successful
- 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
register: fw
- name: verify setup
assert:
that:
- fw is successful
- name: setup all
cs_firewall:
network: "{{ cs_firewall_network }}"
protocol: all
type: egress
zone: "{{ cs_common_zone_adv }}"
state: absent
register: fw
- name: verify setup
assert:
that:
- fw is successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,419 +0,0 @@
---
- name: test fail missing params
cs_host:
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
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
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
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
cluster: C0-basic
pod: POD0-basic
state: absent
register: host
- name: verify test remove a host idempotenc
assert:
that:
- host is not changed

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,166 +0,0 @@
---
- 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"

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,5 +0,0 @@
---
instance_number: 1
test_cs_instance_template: "{{ cs_common_template }}"
test_cs_instance_offering_1: Small Instance
test_cs_instance_offering_2: Medium Instance

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,115 +0,0 @@
---
- name: test destroy instance in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
state: expunged
register: instance
- name: verify test expunge instance idempotence
assert:
that:
- instance is successful
- instance is not changed

View file

@ -1,43 +0,0 @@
---
- name: test destroy instance with display_name
cs_instance:
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
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 }}"
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 }}"
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 }}"
state: expunged
failed_when: false

View file

@ -1,30 +0,0 @@
---
- 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

View file

@ -1,135 +0,0 @@
---
- name: setup ensure running instance to get host infos
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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"

View file

@ -1,19 +0,0 @@
---
- include_tasks: setup.yml
- include_tasks: present.yml
- include_tasks: tags.yml
- include_tasks: absent.yml
- include_tasks: present_display_name.yml
- include_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.
# - include_tasks: host.yml
- include_tasks: sshkeys.yml
- include_tasks: project.yml
- include_tasks: cleanup.yml

View file

@ -1,323 +0,0 @@
---
- name: setup instance to be absent
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"

View file

@ -1,178 +0,0 @@
---
- name: setup instance with display_name to be absent
cs_instance:
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"

View file

@ -1,560 +0,0 @@
---
- 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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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

View file

@ -1,24 +0,0 @@
---
- 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

View file

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

View file

@ -1,132 +0,0 @@
---
- name: test add tags to instance in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
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 }}"
tags: []
register: instance
- name: verify remove tags
assert:
that:
- instance is successful
- instance is changed
- instance.tags|length == 0

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
test_cs_instance_template: "{{ cs_common_template }}"
test_cs_instance_offering_1: Small Instance

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,306 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,220 +0,0 @@
---
- 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"
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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,85 +0,0 @@
---
- 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
- 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
- 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
- debug:
var: reset3.password
- name: verify that a password was set
assert:
that:
- reset3 is success
- reset3.password != ''

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,79 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,19 +0,0 @@
---
- 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

View file

@ -1,240 +0,0 @@
---
- 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 }}"

View file

@ -1,121 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,142 +0,0 @@
---
- name: setup iso
cs_iso:
name: "{{ cs_resource_prefix }}-iso"
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: http://mirror.switch.ch/ftp/mirror/debian-cd/current/amd64/iso-cd/debian-7.7.0-amd64-netinst.iso
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: http://mirror.switch.ch/ftp/mirror/debian-cd/current/amd64/iso-cd/debian-7.7.0-amd64-netinst.iso
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: http://mirror.switch.ch/ftp/mirror/debian-cd/current/amd64/iso-cd/debian-7.7.0-amd64-netinst.iso
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: http://mirror.switch.ch/ftp/mirror/debian-cd/current/amd64/iso-cd/debian-7.7.0-amd64-netinst.iso
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: http://mirror.switch.ch/ftp/mirror/debian-cd/current/amd64/iso-cd/debian-7.7.0-amd64-netinst.iso
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: http://mirror.switch.ch/ftp/mirror/debian-cd/current/amd64/iso-cd/debian-7.7.0-amd64-netinst.iso
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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,392 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,3 +0,0 @@
---
- include_tasks: vpc_network_tier.yml

View file

@ -1,299 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,120 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,548 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,434 +0,0 @@
---
- 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"

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,238 +0,0 @@
---
# 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 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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
assert:
that:
- pn is successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- 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 successful
- pn is not changed
- pn.zone == cszone.name
- name: cleanup zone
cs_zone:
name: "{{ cszone.name }}"
state: absent

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group1

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,301 +0,0 @@
---
- 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

View file

@ -1,2 +0,0 @@
cloud/cs
shippable/cs/group2

View file

@ -1,3 +0,0 @@
---
cs_portforward_public_ip: "10.100.212.5"
cs_portforward_vm: "cs-{{ cs_resource_prefix }}-pf-vm"

View file

@ -1,3 +0,0 @@
---
dependencies:
- cs_common

View file

@ -1,255 +0,0 @@
---
- 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

Some files were not shown because too many files have changed in this diff Show more