mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 05:40:23 -07:00
automated integration tests for cloudstack (#20552)
This commit is contained in:
parent
b58cf0d23a
commit
aaf4f04574
92 changed files with 1248 additions and 193 deletions
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "{{ cs_resource_prefix }}.local"
|
||||
network_domain: "example.com"
|
||||
register: acc
|
||||
- name: verify results of create account
|
||||
assert:
|
||||
|
@ -44,7 +44,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -57,7 +57,7 @@
|
|||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "{{ cs_resource_prefix }}.local"
|
||||
network_domain: "example.com"
|
||||
register: acc
|
||||
- name: verify results of create account idempotence
|
||||
assert:
|
||||
|
@ -65,7 +65,7 @@
|
|||
- acc|success
|
||||
- not acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -81,7 +81,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -97,7 +97,7 @@
|
|||
- acc|success
|
||||
- not acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -113,7 +113,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "disabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -129,7 +129,7 @@
|
|||
- acc|success
|
||||
- not acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "disabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -145,7 +145,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -161,7 +161,7 @@
|
|||
- acc|success
|
||||
- not acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -177,7 +177,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -193,7 +193,7 @@
|
|||
- acc|success
|
||||
- not acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -209,7 +209,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -233,7 +233,7 @@
|
|||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "{{ cs_resource_prefix }}.local"
|
||||
network_domain: "example.com"
|
||||
state: disabled
|
||||
register: acc
|
||||
- name: verify results of create disabled account
|
||||
|
@ -242,7 +242,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "disabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -258,7 +258,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "disabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -271,7 +271,7 @@
|
|||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "{{ cs_resource_prefix }}.local"
|
||||
network_domain: "example.com"
|
||||
state: locked
|
||||
register: acc
|
||||
- name: verify results of create locked account
|
||||
|
@ -280,7 +280,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -296,7 +296,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -309,7 +309,7 @@
|
|||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "{{ cs_resource_prefix }}.local"
|
||||
network_domain: "example.com"
|
||||
state: unlocked
|
||||
register: acc
|
||||
- name: verify results of create unlocked/enabled account
|
||||
|
@ -318,7 +318,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -334,7 +334,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
5
test/integration/targets/cs_common/defaults/main.yml
Normal file
5
test/integration/targets/cs_common/defaults/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
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
|
3
test/integration/targets/cs_configuration/aliases
Normal file
3
test/integration/targets/cs_configuration/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
test_cs_configuration_storage: PS0-adv
|
||||
test_cs_configuration_cluster: C0-basic
|
||||
test_cs_configuration_account: admin
|
||||
test_cs_configuration_zone: Sandbox-simulator-basic
|
3
test/integration/targets/cs_configuration/meta/main.yml
Normal file
3
test/integration/targets/cs_configuration/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
59
test/integration/targets/cs_configuration/tasks/account.yml
Normal file
59
test/integration/targets/cs_configuration/tasks/account.yml
Normal file
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
- 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|success
|
||||
|
||||
- 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|success
|
||||
- config|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|success
|
||||
- not config|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|success
|
||||
- config|changed
|
||||
- config.value == "true"
|
||||
- config.name == "allow.public.user.templates"
|
||||
- config.scope == "account"
|
||||
- config.account == "{{ test_cs_configuration_account }}"
|
59
test/integration/targets/cs_configuration/tasks/cluster.yml
Normal file
59
test/integration/targets/cs_configuration/tasks/cluster.yml
Normal file
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
- 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|success
|
||||
|
||||
- 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|success
|
||||
- config|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|success
|
||||
- not config|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|success
|
||||
- config|changed
|
||||
- config.value == "1.0"
|
||||
- config.name == "cpu.overprovisioning.factor"
|
||||
- config.scope == "cluster"
|
||||
- config.cluster == "{{ test_cs_configuration_cluster }}"
|
162
test/integration/targets/cs_configuration/tasks/main.yml
Normal file
162
test/integration/targets/cs_configuration/tasks/main.yml
Normal file
|
@ -0,0 +1,162 @@
|
|||
---
|
||||
- name: test fail if missing name
|
||||
cs_configuration:
|
||||
register: config
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing arguments
|
||||
assert:
|
||||
that:
|
||||
- config|failed
|
||||
- "config.msg == 'missing required arguments: value,name'"
|
||||
|
||||
- name: test configuration
|
||||
cs_configuration:
|
||||
name: network.loadbalancer.haproxy.stats.visibility
|
||||
value: global
|
||||
register: config
|
||||
- name: verify test configuration
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
|
||||
- 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|success
|
||||
- config|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|success
|
||||
- not config|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|success
|
||||
- config|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|success
|
||||
|
||||
- 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|success
|
||||
- config|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|success
|
||||
- not config|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|success
|
||||
- config|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|success
|
||||
|
||||
- name: test update configuration float
|
||||
cs_configuration:
|
||||
name: agent.load.threshold
|
||||
value: 0.81
|
||||
register: config
|
||||
- name: verify update configuration float
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|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|success
|
||||
- not config|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|success
|
||||
- config|changed
|
||||
- config.value == "0.7"
|
||||
- config.name == "agent.load.threshold"
|
||||
|
||||
- include: storage.yml
|
||||
- include: account.yml
|
||||
- include: zone.yml
|
||||
- include: cluster.yml
|
59
test/integration/targets/cs_configuration/tasks/storage.yml
Normal file
59
test/integration/targets/cs_configuration/tasks/storage.yml
Normal file
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
- 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|success
|
||||
|
||||
- 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|success
|
||||
- config|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|success
|
||||
- not config|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|success
|
||||
- config|changed
|
||||
- config.value == "2.0"
|
||||
- config.name == "storage.overprovisioning.factor"
|
||||
- config.scope == "storagepool"
|
||||
- config.storage == "{{ test_cs_configuration_storage }}"
|
59
test/integration/targets/cs_configuration/tasks/zone.yml
Normal file
59
test/integration/targets/cs_configuration/tasks/zone.yml
Normal file
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
- name: test configuration zone
|
||||
cs_configuration:
|
||||
name: use.external.dns
|
||||
zone: "{{ test_cs_configuration_zone }}"
|
||||
value: false
|
||||
register: config
|
||||
- name: verify test configuration zone
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
|
||||
- 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|success
|
||||
- config|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|success
|
||||
- not config|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|success
|
||||
- config|changed
|
||||
- config.value == "false"
|
||||
- config.name == "use.external.dns"
|
||||
- config.scope == "zone"
|
||||
- config.zone == "{{ test_cs_configuration_zone }}"
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
3
test/integration/targets/cs_firewall/aliases
Normal file
3
test/integration/targets/cs_firewall/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
3
test/integration/targets/cs_firewall/defaults/main.yml
Normal file
3
test/integration/targets/cs_firewall/defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
cs_firewall_ip_address: 10.100.212.5
|
||||
cs_firewall_network: ansible test
|
3
test/integration/targets/cs_firewall/meta/main.yml
Normal file
3
test/integration/targets/cs_firewall/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
325
test/integration/targets/cs_firewall/tasks/main.yml
Normal file
325
test/integration/targets/cs_firewall/tasks/main.yml
Normal file
|
@ -0,0 +1,325 @@
|
|||
---
|
||||
- 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|success
|
||||
|
||||
- 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|success
|
||||
|
||||
- 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|success
|
||||
|
||||
- name: setup 5300
|
||||
cs_firewall:
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
protocol: udp
|
||||
start_port: 5300
|
||||
end_port: 5333
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify setup
|
||||
assert:
|
||||
that:
|
||||
- fw|success
|
||||
|
||||
- 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|success
|
||||
|
||||
- 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|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|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|failed
|
||||
- "fw.msg == 'one of the following is required: ip_address,network'"
|
||||
|
||||
- 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|success
|
||||
- fw|changed
|
||||
- fw.cidr == "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|success
|
||||
- not fw|changed
|
||||
- fw.cidr == "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
|
||||
cs_firewall:
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
protocol: udp
|
||||
start_port: 5300
|
||||
end_port: 5333
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
- name: verify results of present firewall rule ingress 5300
|
||||
assert:
|
||||
that:
|
||||
- fw|success
|
||||
- fw|changed
|
||||
- fw.cidr == "1.2.3.4/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
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
- name: verify results of present firewall rule ingress 5300 idempotence
|
||||
assert:
|
||||
that:
|
||||
- fw|success
|
||||
- not fw|changed
|
||||
- fw.cidr == "1.2.3.4/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
|
||||
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|success
|
||||
- fw|changed
|
||||
- fw.cidr == "0.0.0.0/0"
|
||||
- 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|success
|
||||
- not fw|changed
|
||||
- fw.cidr == "0.0.0.0/0"
|
||||
- fw.network == "{{ cs_firewall_network }}"
|
||||
- fw.protocol == "all"
|
||||
- fw.type == "egress"
|
||||
|
||||
- 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|success
|
||||
- fw|changed
|
||||
- fw.cidr == "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|success
|
||||
- not fw|changed
|
||||
|
||||
- name: test absent firewall rule ingress 5300
|
||||
cs_firewall:
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
protocol: udp
|
||||
start_port: 5300
|
||||
end_port: 5333
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify results of absent firewall rule ingress 5300
|
||||
assert:
|
||||
that:
|
||||
- fw|success
|
||||
- fw|changed
|
||||
- fw.cidr == "1.2.3.4/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
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify results of absent firewall rule ingress 5300 idempotence
|
||||
assert:
|
||||
that:
|
||||
- fw|success
|
||||
- not fw|changed
|
||||
|
||||
- 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|success
|
||||
- fw|changed
|
||||
- fw.cidr == "0.0.0.0/0"
|
||||
- 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|success
|
||||
- not fw|changed
|
||||
|
||||
- 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|success
|
3
test/integration/targets/cs_instance/aliases
Normal file
3
test/integration/targets/cs_instance/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
5
test/integration/targets/cs_instance/defaults/main.yml
Normal file
5
test/integration/targets/cs_instance/defaults/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
instance_number: 1
|
||||
test_cs_instance_template: "{{ cs_common_template }}"
|
||||
test_cs_instance_offering_1: Small Instance
|
||||
test_cs_instance_offering_2: Medium Instance
|
3
test/integration/targets/cs_instance/meta/main.yml
Normal file
3
test/integration/targets/cs_instance/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
43
test/integration/targets/cs_instance/tasks/absent.yml
Normal file
43
test/integration/targets/cs_instance/tasks/absent.yml
Normal file
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
- name: test destroy instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: absent
|
||||
register: instance
|
||||
- name: verify destroy instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|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|success
|
||||
- not instance|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|success
|
||||
- instance|changed
|
||||
- instance.state == "Stopped"
|
||||
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||
|
||||
# force expunge, only works with admin permissions
|
||||
- cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: expunged
|
||||
failed_when: false
|
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
- 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|success
|
||||
- instance|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|success
|
||||
- not instance|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|success
|
||||
- instance|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
|
30
test/integration/targets/cs_instance/tasks/cleanup.yml
Normal file
30
test/integration/targets/cs_instance/tasks/cleanup.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
- name: cleanup ssh key
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
|
||||
register: sshkey
|
||||
- name: verify cleanup ssh key
|
||||
assert:
|
||||
that:
|
||||
- sshkey|success
|
||||
|
||||
- name: cleanup affinity group
|
||||
cs_affinitygroup: name={{ cs_resource_prefix }}-ag state=absent
|
||||
register: ag
|
||||
until: ag|success
|
||||
retries: 20
|
||||
delay: 5
|
||||
- name: verify cleanup affinity group
|
||||
assert:
|
||||
that:
|
||||
- ag|success
|
||||
|
||||
- name: cleanup security group ...take a while unless instance is expunged
|
||||
cs_securitygroup: name={{ cs_resource_prefix }}-sg state=absent
|
||||
register: sg
|
||||
until: sg|success
|
||||
retries: 100
|
||||
delay: 10
|
||||
- name: verify cleanup security group
|
||||
assert:
|
||||
that:
|
||||
- sg|success
|
11
test/integration/targets/cs_instance/tasks/main.yml
Normal file
11
test/integration/targets/cs_instance/tasks/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
- include: setup.yml
|
||||
- include: present.yml
|
||||
- include: tags.yml
|
||||
- include: absent.yml
|
||||
- include: cleanup.yml
|
||||
|
||||
- include: setup.yml
|
||||
- include: present_display_name.yml
|
||||
- include: absent_display_name.yml
|
||||
- include: cleanup.yml
|
187
test/integration/targets/cs_instance/tasks/present.yml
Normal file
187
test/integration/targets/cs_instance/tasks/present.yml
Normal file
|
@ -0,0 +1,187 @@
|
|||
---
|
||||
- name: setup instance to be absent
|
||||
cs_instance: name={{ cs_resource_prefix }}-vm-{{ instance_number }} state=absent
|
||||
register: instance
|
||||
- name: verify instance to be absent
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
|
||||
- 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"
|
||||
tags: []
|
||||
register: instance
|
||||
- name: verify create instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|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"
|
||||
tags: []
|
||||
register: instance
|
||||
- name: verify create instance idempotence
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- not instance|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 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|success
|
||||
- not instance|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|success
|
||||
- instance|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|success
|
||||
- not instance|changed
|
||||
- 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|success
|
||||
- instance|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|success
|
||||
- instance|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|success
|
||||
- not instance|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|success
|
||||
- instance|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|success
|
||||
- not instance|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
|
||||
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|success
|
||||
- instance|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 }}"
|
|
@ -0,0 +1,176 @@
|
|||
---
|
||||
- name: setup instance with display_name to be absent
|
||||
cs_instance: display_name={{ cs_resource_prefix }}-vm-{{ instance_number }} state=absent
|
||||
register: instance
|
||||
- name: verify instance with display_name to be absent
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
|
||||
- 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|success
|
||||
- instance|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|success
|
||||
- not instance|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|success
|
||||
- not instance|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|success
|
||||
- instance|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|success
|
||||
- not instance|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|success
|
||||
- instance|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|success
|
||||
- instance|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|success
|
||||
- not instance|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|success
|
||||
- instance|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|success
|
||||
- not instance|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|success
|
||||
- instance|changed
|
||||
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
24
test/integration/targets/cs_instance/tasks/setup.yml
Normal file
24
test/integration/targets/cs_instance/tasks/setup.yml
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
- name: setup ssh key
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
|
||||
register: sshkey
|
||||
- name: verify setup ssh key
|
||||
assert:
|
||||
that:
|
||||
- sshkey|success
|
||||
|
||||
- name: setup affinity group
|
||||
cs_affinitygroup: name={{ cs_resource_prefix }}-ag
|
||||
register: ag
|
||||
- name: verify setup affinity group
|
||||
assert:
|
||||
that:
|
||||
- ag|success
|
||||
|
||||
- name: setup security group
|
||||
cs_securitygroup: name={{ cs_resource_prefix }}-sg
|
||||
register: sg
|
||||
- name: verify setup security group
|
||||
assert:
|
||||
that:
|
||||
- sg|success
|
83
test/integration/targets/cs_instance/tasks/tags.yml
Normal file
83
test/integration/targets/cs_instance/tasks/tags.yml
Normal file
|
@ -0,0 +1,83 @@
|
|||
---
|
||||
- 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|success
|
||||
- instance|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|success
|
||||
- not instance|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|success
|
||||
- instance|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|success
|
||||
- not instance|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
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
tags: []
|
||||
register: instance
|
||||
- name: verify remove tags
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.tags|length == 0
|
3
test/integration/targets/cs_instance_facts/aliases
Normal file
3
test/integration/targets/cs_instance_facts/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
test_cs_instance_template: "{{ cs_common_template }}"
|
||||
test_cs_instance_offering_1: Small Instance
|
3
test/integration/targets/cs_instance_facts/meta/main.yml
Normal file
3
test/integration/targets/cs_instance_facts/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
55
test/integration/targets/cs_instance_facts/tasks/main.yml
Normal file
55
test/integration/targets/cs_instance_facts/tasks/main.yml
Normal file
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
- name: setup ssh key
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
|
||||
register: sshkey
|
||||
- name: verify setup ssh key
|
||||
assert:
|
||||
that:
|
||||
- sshkey|success
|
||||
|
||||
- name: setup affinity group
|
||||
cs_affinitygroup: name={{ cs_resource_prefix }}-ag
|
||||
register: ag
|
||||
- name: verify setup affinity group
|
||||
assert:
|
||||
that:
|
||||
- ag|success
|
||||
|
||||
- name: setup security group
|
||||
cs_securitygroup: name={{ cs_resource_prefix }}-sg
|
||||
register: sg
|
||||
- name: verify setup security group
|
||||
assert:
|
||||
that:
|
||||
- sg|success
|
||||
|
||||
- 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|success
|
||||
|
||||
- name: test instance facts
|
||||
cs_instance_facts:
|
||||
name: "{{ cs_resource_prefix }}-vm"
|
||||
register: instance_facts
|
||||
- name: verify test instance facts
|
||||
assert:
|
||||
that:
|
||||
- instance_facts|success
|
||||
- not instance_facts|changed
|
||||
- cloudstack_instance.id == instance.id
|
||||
- cloudstack_instance.domain == instance.domain
|
||||
- cloudstack_instance.account == instance.account
|
||||
- cloudstack_instance.zone == instance.zone
|
||||
- cloudstack_instance.name == instance.name
|
||||
- cloudstack_instance.service_offering == instance.service_offering
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
3
test/integration/targets/cs_iso/aliases
Normal file
3
test/integration/targets/cs_iso/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
3
test/integration/targets/cs_iso/meta/main.yml
Normal file
3
test/integration/targets/cs_iso/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
71
test/integration/targets/cs_iso/tasks/main.yml
Normal file
71
test/integration/targets/cs_iso/tasks/main.yml
Normal file
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
- name: ensure iso is deleted
|
||||
cs_iso:
|
||||
name: "{{ cs_resource_prefix }}-iso"
|
||||
state: absent
|
||||
register: iso
|
||||
- name: verify ensure iso is deleted
|
||||
assert:
|
||||
that:
|
||||
- iso|success
|
||||
|
||||
- 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)
|
||||
register: iso
|
||||
- name: verify test download iso
|
||||
assert:
|
||||
that:
|
||||
- iso|changed
|
||||
- iso.name == "{{ cs_resource_prefix }}-iso"
|
||||
|
||||
- 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)
|
||||
register: iso
|
||||
- name: verify test download iso idempotence
|
||||
assert:
|
||||
that:
|
||||
- not iso|changed
|
||||
- iso.name == "{{ cs_resource_prefix }}-iso"
|
||||
|
||||
# TODO: on 4.6 simulator no checksum was returned
|
||||
# TODO: check if this is a bug in 4.6
|
||||
#- name: test download iso idempotence by checksum
|
||||
# cs_iso:
|
||||
# name: "{{ cs_resource_prefix }}-iso2"
|
||||
# checksum: "{{ iso.checksum }}"
|
||||
# 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)
|
||||
# register: iso2
|
||||
#- name: verify test download iso idempotence by checksum
|
||||
# assert:
|
||||
# that:
|
||||
# - not iso2|changed
|
||||
# - iso2.name == "{{ cs_resource_prefix }}-iso"
|
||||
# - iso2.checksum == iso.checksum
|
||||
|
||||
- name: test remove iso
|
||||
cs_iso:
|
||||
name: "{{ cs_resource_prefix }}-iso"
|
||||
state: absent
|
||||
register: iso
|
||||
- name: verify test remove iso
|
||||
assert:
|
||||
that:
|
||||
- iso|changed
|
||||
- iso.name == "{{ cs_resource_prefix }}-iso"
|
||||
|
||||
- name: test remove iso idempotence
|
||||
cs_iso:
|
||||
name: "{{ cs_resource_prefix }}-iso"
|
||||
state: absent
|
||||
register: iso
|
||||
- name: verify test remove iso idempotence
|
||||
assert:
|
||||
that:
|
||||
- not iso|changed
|
3
test/integration/targets/cs_loadbalancer_rule/aliases
Normal file
3
test/integration/targets/cs_loadbalancer_rule/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
239
test/integration/targets/cs_loadbalancer_rule/tasks/main.yml
Normal file
239
test/integration/targets/cs_loadbalancer_rule/tasks/main.yml
Normal file
|
@ -0,0 +1,239 @@
|
|||
---
|
||||
- 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|success
|
||||
- lb_net|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
|
||||
- name: verify setup instance in lb
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|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 instance in lb
|
||||
assert:
|
||||
that:
|
||||
- ip_address|success
|
||||
|
||||
- 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|success
|
||||
|
||||
- name: test rule requires params
|
||||
cs_loadbalancer_rule:
|
||||
ignore_errors: true
|
||||
register: lb
|
||||
- name: verify test rule requires params
|
||||
assert:
|
||||
that:
|
||||
- lb|failed
|
||||
- "'ip_address,name' in lb.msg"
|
||||
|
||||
- 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|success
|
||||
- lb|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|success
|
||||
- not lb|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|success
|
||||
- lb|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|success
|
||||
- not lb|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|failed
|
||||
- "'vms,name' in lb.msg"
|
||||
|
||||
- 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|success
|
||||
- lb|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|success
|
||||
- not lb|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|success
|
||||
- lb|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|success
|
||||
- not lb|changed
|
||||
|
||||
- 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|success
|
||||
- lb|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|success
|
||||
- not lb|changed
|
3
test/integration/targets/cs_pod/aliases
Normal file
3
test/integration/targets/cs_pod/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
3
test/integration/targets/cs_pod/meta/main.yml
Normal file
3
test/integration/targets/cs_pod/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
211
test/integration/targets/cs_pod/tasks/main.yml
Normal file
211
test/integration/targets/cs_pod/tasks/main.yml
Normal file
|
@ -0,0 +1,211 @@
|
|||
---
|
||||
- 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|success
|
||||
|
||||
- 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|success
|
||||
|
||||
- name: test fail if missing name
|
||||
cs_pod:
|
||||
register: pod
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing name
|
||||
assert:
|
||||
that:
|
||||
- pod|failed
|
||||
- "pod.msg == 'missing required arguments: name'"
|
||||
|
||||
- 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|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:
|
||||
- not pod|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"
|
||||
start_ip: 10.100.10.102
|
||||
gateway: 10.100.10.1
|
||||
netmask: 255.255.255.0
|
||||
register: pod
|
||||
- name: verify test update pod
|
||||
assert:
|
||||
that:
|
||||
- pod|changed
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- 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 idempotence
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
start_ip: 10.100.10.102
|
||||
gateway: 10.100.10.1
|
||||
netmask: 255.255.255.0
|
||||
register: pod
|
||||
- name: verify test update pod idempotence
|
||||
assert:
|
||||
that:
|
||||
- not pod|changed
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- 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 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|changed
|
||||
- pod.allocation_state == "Disabled"
|
||||
- pod.id == pod_origin.id
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- 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 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:
|
||||
- not pod|changed
|
||||
- pod.allocation_state == "Disabled"
|
||||
- pod.id == pod_origin.id
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- 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 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|changed
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.id == pod_origin.id
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- 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 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:
|
||||
- not pod|changed
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.id == pod_origin.id
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- 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 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|changed
|
||||
- pod.id == pod_origin.id
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- 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 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:
|
||||
- not pod|changed
|
3
test/integration/targets/cs_portforward/aliases
Normal file
3
test/integration/targets/cs_portforward/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
cs_portforward_public_ip: "10.100.212.5"
|
||||
cs_portforward_vm: "cs-{{ cs_resource_prefix }}-pf-vm"
|
3
test/integration/targets/cs_portforward/meta/main.yml
Normal file
3
test/integration/targets/cs_portforward/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
178
test/integration/targets/cs_portforward/tasks/main.yml
Normal file
178
test/integration/targets/cs_portforward/tasks/main.yml
Normal file
|
@ -0,0 +1,178 @@
|
|||
---
|
||||
- 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|success
|
||||
|
||||
- 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|success
|
||||
|
||||
- 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|success
|
||||
|
||||
- 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|success
|
||||
|
||||
- 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|failed
|
||||
- 'pf.msg == "missing required arguments: private_port,ip_address,public_port"'
|
||||
|
||||
- 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|success
|
||||
- pf|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|success
|
||||
- not pf|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|success
|
||||
- pf|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|success
|
||||
- pf|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|success
|
||||
- not pf|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|success
|
||||
|
||||
- name: network cleanup
|
||||
cs_network:
|
||||
name: ansible test
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: net
|
||||
- name: verify network cleanup
|
||||
assert:
|
||||
that:
|
||||
- net|success
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
---
|
||||
- name: setup cleanup
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
|
||||
cs_sshkeypair: name=first-sshkey state=absent
|
||||
|
||||
- name: setup cleanup
|
||||
cs_sshkeypair: name=second-sshkey state=absent
|
||||
|
||||
|
||||
- name: test fail on missing name
|
||||
action: cs_sshkeypair
|
||||
|
@ -13,7 +17,8 @@
|
|||
- "sshkey.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test ssh key creation
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
register: sshkey
|
||||
- name: verify results of ssh key creation
|
||||
assert:
|
||||
|
@ -22,10 +27,11 @@
|
|||
- sshkey|changed
|
||||
- sshkey.fingerprint is defined and sshkey.fingerprint != ""
|
||||
- sshkey.private_key is defined and sshkey.private_key != ""
|
||||
- sshkey.name == "{{ cs_resource_prefix }}-sshkey"
|
||||
- sshkey.name == "first-sshkey"
|
||||
|
||||
- name: test ssh key creation idempotence
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
register: sshkey2
|
||||
- name: verify results of ssh key creation idempotence
|
||||
assert:
|
||||
|
@ -34,12 +40,12 @@
|
|||
- not sshkey2|changed
|
||||
- sshkey2.fingerprint is defined and sshkey2.fingerprint == sshkey.fingerprint
|
||||
- sshkey2.private_key is not defined
|
||||
- sshkey2.name == "{{ cs_resource_prefix }}-sshkey"
|
||||
- sshkey2.name == "first-sshkey"
|
||||
|
||||
- name: test replace ssh public key
|
||||
cs_sshkeypair: |
|
||||
name={{ cs_resource_prefix }}-sshkey
|
||||
public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
register: sshkey3
|
||||
- name: verify results of replace ssh public key
|
||||
assert:
|
||||
|
@ -48,12 +54,12 @@
|
|||
- sshkey3|changed
|
||||
- sshkey3.fingerprint is defined and sshkey3.fingerprint != sshkey2.fingerprint
|
||||
- sshkey3.private_key is not defined
|
||||
- sshkey3.name == "{{ cs_resource_prefix }}-sshkey"
|
||||
- sshkey3.name == "first-sshkey"
|
||||
|
||||
- name: test replace ssh public key idempotence
|
||||
cs_sshkeypair: |
|
||||
name={{ cs_resource_prefix }}-sshkey
|
||||
public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
register: sshkey4
|
||||
- name: verify results of ssh public key idempotence
|
||||
assert:
|
||||
|
@ -62,10 +68,28 @@
|
|||
- not sshkey4|changed
|
||||
- sshkey4.fingerprint is defined and sshkey4.fingerprint == sshkey3.fingerprint
|
||||
- sshkey4.private_key is not defined
|
||||
- sshkey4.name == "{{ cs_resource_prefix }}-sshkey"
|
||||
- sshkey4.name == "first-sshkey"
|
||||
|
||||
- name: setup ssh key with name "second-sshke"
|
||||
cs_sshkeypair:
|
||||
name: "second-sshkey"
|
||||
|
||||
- name: test different but exisitng name but same ssh public key as first-sshkey
|
||||
cs_sshkeypair:
|
||||
name: "second-sshkey"
|
||||
public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
register: sshkey
|
||||
- name: verify test different but exisitng name but same ssh public key as first-sshkey
|
||||
assert:
|
||||
that:
|
||||
- sshkey|success
|
||||
- sshkey|changed
|
||||
- sshkey.fingerprint is defined and sshkey.fingerprint == sshkey4.fingerprint
|
||||
- sshkey.private_key is not defined
|
||||
- sshkey.name == "second-sshkey"
|
||||
|
||||
- name: test ssh key absent
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
|
||||
cs_sshkeypair: name=second-sshkey state=absent
|
||||
register: sshkey5
|
||||
- name: verify result of key absent
|
||||
assert:
|
||||
|
@ -74,10 +98,10 @@
|
|||
- sshkey5|changed
|
||||
- sshkey5.fingerprint is defined and sshkey5.fingerprint == sshkey3.fingerprint
|
||||
- sshkey5.private_key is not defined
|
||||
- sshkey5.name == "{{ cs_resource_prefix }}-sshkey"
|
||||
- sshkey5.name == "second-sshkey"
|
||||
|
||||
- name: test ssh key absent idempotence
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
|
||||
cs_sshkeypair: name=second-sshkey state=absent
|
||||
register: sshkey6
|
||||
- name: verify result of ssh key absent idempotence
|
||||
assert:
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
3
test/integration/targets/cs_vmsnapshot/aliases
Normal file
3
test/integration/targets/cs_vmsnapshot/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
3
test/integration/targets/cs_vmsnapshot/defaults/main.yml
Normal file
3
test/integration/targets/cs_vmsnapshot/defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
test_cs_instance_template: "{{ cs_common_template }}"
|
||||
test_cs_instance_offering_1: Small Instance
|
3
test/integration/targets/cs_vmsnapshot/meta/main.yml
Normal file
3
test/integration/targets/cs_vmsnapshot/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
101
test/integration/targets/cs_vmsnapshot/tasks/main.yml
Normal file
101
test/integration/targets/cs_vmsnapshot/tasks/main.yml
Normal file
|
@ -0,0 +1,101 @@
|
|||
---
|
||||
- name: setup instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
register: instance
|
||||
- name: verify create instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
|
||||
- name: ensure no snapshot exists
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
state: absent
|
||||
register: snap
|
||||
- name: verify setup
|
||||
assert:
|
||||
that:
|
||||
- snap|success
|
||||
|
||||
- name: test fail if missing name
|
||||
action: cs_vmsnapshot
|
||||
register: snap
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing params
|
||||
assert:
|
||||
that:
|
||||
- snap|failed
|
||||
- 'snap.msg == "missing required arguments: vm,name"'
|
||||
|
||||
- name: test create snapshot
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
snapshot_memory: yes
|
||||
register: snap
|
||||
- name: verify test create snapshot
|
||||
assert:
|
||||
that:
|
||||
- snap|changed
|
||||
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
||||
|
||||
- name: test create snapshot idempotence
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
snapshot_memory: yes
|
||||
register: snap
|
||||
- name: verify test create snapshot idempotence
|
||||
assert:
|
||||
that:
|
||||
- not snap|changed
|
||||
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
||||
|
||||
- name: test revert snapshot
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
state: revert
|
||||
register: snap
|
||||
- name: verify test revert snapshot
|
||||
assert:
|
||||
that:
|
||||
- snap|changed
|
||||
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
||||
|
||||
- name: test remove snapshot
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
state: absent
|
||||
register: snap
|
||||
- name: verify test remove snapshot
|
||||
assert:
|
||||
that:
|
||||
- snap|changed
|
||||
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
||||
|
||||
- name: test remove snapshot idempotence
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
state: absent
|
||||
register: snap
|
||||
- name: verify test remove snapshot idempotence
|
||||
assert:
|
||||
that:
|
||||
- not snap|changed
|
||||
|
||||
- name: cleanup instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
state: expunged
|
||||
register: instance
|
||||
- name: verify destroy instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
3
test/integration/targets/cs_volume/aliases
Normal file
3
test/integration/targets/cs_volume/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
6
test/integration/targets/cs_volume/defaults/main.yml
Normal file
6
test/integration/targets/cs_volume/defaults/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
test_cs_instance_1: "{{ cs_resource_prefix }}-vm1"
|
||||
test_cs_instance_2: "{{ cs_resource_prefix }}-vm2"
|
||||
test_cs_instance_template: "{{ cs_common_template }}"
|
||||
test_cs_instance_offering_1: Small Instance
|
||||
test_cs_disk_offering_1: Custom
|
3
test/integration/targets/cs_volume/meta/main.yml
Normal file
3
test/integration/targets/cs_volume/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
215
test/integration/targets/cs_volume/tasks/main.yml
Normal file
215
test/integration/targets/cs_volume/tasks/main.yml
Normal file
|
@ -0,0 +1,215 @@
|
|||
---
|
||||
- name: setup
|
||||
cs_volume: name={{ cs_resource_prefix }}_vol state=absent
|
||||
register: vol
|
||||
- name: verify setup
|
||||
assert:
|
||||
that:
|
||||
- vol|success
|
||||
|
||||
- name: setup instance 1
|
||||
cs_instance:
|
||||
name: "{{ test_cs_instance_1 }}"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
register: instance
|
||||
- name: verify create instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
|
||||
- name: setup instance 2
|
||||
cs_instance:
|
||||
name: "{{ test_cs_instance_2 }}"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
register: instance
|
||||
- name: verify create instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
|
||||
- name: test fail if missing name
|
||||
action: cs_volume
|
||||
register: vol
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing name
|
||||
assert:
|
||||
that:
|
||||
- vol|failed
|
||||
- "vol.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test create volume
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
disk_offering: "{{ test_cs_disk_offering_1 }}"
|
||||
size: 20
|
||||
register: vol
|
||||
- name: verify results test create volume
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
- vol.size == 20 * 1024 ** 3
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
|
||||
- name: test create volume idempotence
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
disk_offering: "{{ test_cs_disk_offering_1 }}"
|
||||
size: 20
|
||||
register: vol
|
||||
- name: verify results test create volume idempotence
|
||||
assert:
|
||||
that:
|
||||
- not vol|changed
|
||||
- vol.size == 20 * 1024 ** 3
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
|
||||
- name: test shrink volume
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
disk_offering: "{{ test_cs_disk_offering_1 }}"
|
||||
size: 10
|
||||
shrink_ok: yes
|
||||
register: vol
|
||||
- name: verify results test create volume
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
- vol.size == 10 * 1024 ** 3
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
|
||||
- name: test shrink volume idempotence
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
disk_offering: "{{ test_cs_disk_offering_1 }}"
|
||||
size: 10
|
||||
shrink_ok: yes
|
||||
register: vol
|
||||
- name: verify results test create volume
|
||||
assert:
|
||||
that:
|
||||
- not vol|changed
|
||||
- vol.size == 10 * 1024 ** 3
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
|
||||
- name: test attach volume
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
vm: "{{ test_cs_instance_1 }}"
|
||||
state: attached
|
||||
register: vol
|
||||
- name: verify results test attach volume
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
- vol.vm == "{{ test_cs_instance_1 }}"
|
||||
- vol.attached is defined
|
||||
|
||||
- name: test attach volume idempotence
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
vm: "{{ test_cs_instance_1 }}"
|
||||
state: attached
|
||||
register: vol
|
||||
- name: verify results test attach volume idempotence
|
||||
assert:
|
||||
that:
|
||||
- not vol|changed
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
- vol.vm == "{{ test_cs_instance_1 }}"
|
||||
- vol.attached is defined
|
||||
|
||||
- name: test attach attached volume to another vm
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
vm: "{{ test_cs_instance_2 }}"
|
||||
state: attached
|
||||
register: vol
|
||||
- name: verify results test attach attached volume to another vm
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
- vol.vm == "{{ test_cs_instance_2 }}"
|
||||
- vol.attached is defined
|
||||
|
||||
- name: test attach attached volume to another vm idempotence
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
vm: "{{ test_cs_instance_2 }}"
|
||||
state: attached
|
||||
register: vol
|
||||
- name: verify results test attach attached volume to another vm idempotence
|
||||
assert:
|
||||
that:
|
||||
- not vol|changed
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
- vol.vm == "{{ test_cs_instance_2 }}"
|
||||
- vol.attached is defined
|
||||
|
||||
- name: test detach volume
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
state: detached
|
||||
register: vol
|
||||
- name: verify results test detach volume
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
- vol.attached is undefined
|
||||
|
||||
- name: test detach volume idempotence
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
state: detached
|
||||
register: vol
|
||||
- name: verify results test detach volume idempotence
|
||||
assert:
|
||||
that:
|
||||
- not vol|changed
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
- vol.attached is undefined
|
||||
|
||||
- name: test delete volume
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
state: absent
|
||||
register: vol
|
||||
- name: verify results test create volume
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
|
||||
- name: test delete volume idempotence
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
state: absent
|
||||
register: vol
|
||||
- name: verify results test delete volume idempotence
|
||||
assert:
|
||||
that:
|
||||
- not vol|changed
|
||||
|
||||
- name: cleanup instance 1
|
||||
cs_instance:
|
||||
name: "{{ test_cs_instance_1 }}"
|
||||
state: absent
|
||||
register: instance
|
||||
- name: verify create instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
|
||||
- name: cleanup instance 2
|
||||
cs_instance:
|
||||
name: "{{ test_cs_instance_2 }}"
|
||||
state: absent
|
||||
register: instance
|
||||
- name: verify create instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
3
test/integration/targets/cs_vpc/aliases
Normal file
3
test/integration/targets/cs_vpc/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
3
test/integration/targets/cs_vpc/meta/main.yml
Normal file
3
test/integration/targets/cs_vpc/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
399
test/integration/targets/cs_vpc/tasks/main.yml
Normal file
399
test/integration/targets/cs_vpc/tasks/main.yml
Normal file
|
@ -0,0 +1,399 @@
|
|||
---
|
||||
- name: setup
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
register: vpc
|
||||
- name: verify setup
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
|
||||
- name: test fail missing name
|
||||
cs_vpc:
|
||||
ignore_errors: true
|
||||
register: vpc
|
||||
- name: verify test fail missing name
|
||||
assert:
|
||||
that:
|
||||
- vpc|failed
|
||||
- 'vpc.msg == "missing required arguments: name"'
|
||||
|
||||
- name: test fail missing cidr
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
ignore_errors: true
|
||||
register: vpc
|
||||
- name: verify test fail missing name
|
||||
assert:
|
||||
that:
|
||||
- vpc|failed
|
||||
- 'vpc.msg == "state is present but the following are missing: cidr"'
|
||||
|
||||
- name: test create 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 test create vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test create vpc idempotence
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
display_text: "{{ cs_resource_prefix }}_display_text"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test create vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- not vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test create vpc idempotence2
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test create vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- not vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test update vpc
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
display_text: "{{ cs_resource_prefix }}_display_text2"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test create vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text2"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test update vpc idempotence
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
display_text: "{{ cs_resource_prefix }}_display_text2"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test create vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- not vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text2"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test create network in vpc
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network_offering: Offering for Isolated Vpc networks with Source Nat service enabled
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
gateway: 10.10.0.1
|
||||
netmask: 255.255.255.0
|
||||
register: vpc_net
|
||||
- name: verify test create network in vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc_net|success
|
||||
- vpc_net|changed
|
||||
- vpc_net.name == "{{ cs_resource_prefix }}_net_vpc"
|
||||
|
||||
- name: test create network in vpc idempotence
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network_offering: Offering for Isolated Vpc networks with Source Nat service enabled
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
gateway: 10.10.0.1
|
||||
netmask: 255.255.255.0
|
||||
register: vpc_net
|
||||
- name: verify test create network in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- vpc_net|success
|
||||
- not vpc_net|changed
|
||||
- vpc_net.name == "{{ cs_resource_prefix }}_net_vpc"
|
||||
|
||||
- name: test create instance in vpc
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
template: "{{ cs_common_template }}"
|
||||
service_offering: "{{ cs_common_service_offering }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
register: instance
|
||||
- name: verify test create instance in vpc
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.name == "{{ cs_resource_prefix }}-vm-vpc"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: test create instance in vpc idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
template: "{{ cs_common_template }}"
|
||||
service_offering: "{{ cs_common_service_offering }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
register: instance
|
||||
- name: verify test create instance in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- not instance|changed
|
||||
- instance.name == "{{ cs_resource_prefix }}-vm-vpc"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: test get ip address in vpc
|
||||
cs_ip_address:
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: ip_address
|
||||
when: instance.public_ip is undefined
|
||||
|
||||
- name: test static nat in vpc
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
register: static_nat
|
||||
- name: verify test static nat in vpc
|
||||
assert:
|
||||
that:
|
||||
- static_nat|success
|
||||
- static_nat|changed
|
||||
|
||||
- name: test static nat in vpc idempotence
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
register: static_nat
|
||||
- name: verify test static nat in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- static_nat|success
|
||||
- not static_nat|changed
|
||||
|
||||
- name: test remove static nat in vpc
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
state: absent
|
||||
register: static_nat
|
||||
- name: verify test remove static nat in vpc
|
||||
assert:
|
||||
that:
|
||||
- static_nat|success
|
||||
- static_nat|changed
|
||||
|
||||
- name: test remove static nat in vpc idempotence
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
state: absent
|
||||
register: static_nat
|
||||
- name: verify test remove static nat in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- static_nat|success
|
||||
- not static_nat|changed
|
||||
|
||||
- name: test create port forwarding in vpc
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: port_forward
|
||||
- name: verify test create port forwarding in vpc
|
||||
assert:
|
||||
that:
|
||||
- port_forward|success
|
||||
- port_forward|changed
|
||||
|
||||
- name: test create port forwarding in vpc idempotence
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: port_forward
|
||||
- name: verify test create port forwarding in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- port_forward|success
|
||||
- not port_forward|changed
|
||||
|
||||
- name: test remove port forwarding in vpc
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: port_forward
|
||||
- name: verify test remove port forwarding in vpc
|
||||
assert:
|
||||
that:
|
||||
- port_forward|success
|
||||
- port_forward|changed
|
||||
|
||||
- name: test remove port forwarding in vpc idempotence
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: port_forward
|
||||
- name: verify test remove port forwarding in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- port_forward|success
|
||||
- not port_forward|changed
|
||||
|
||||
- name: test remove ip address from vpc
|
||||
cs_ip_address:
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
state: absent
|
||||
register: ip_address_removed
|
||||
- name: verify test remove static nat in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- ip_address_removed|success
|
||||
- ip_address_removed|changed
|
||||
|
||||
- name: test remove instance in vpc
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: expunged
|
||||
register: instance
|
||||
- name: verify test remove instance in vpc
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.name == "{{ cs_resource_prefix }}-vm-vpc"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: test remove instance in vpc idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: expunged
|
||||
register: instance
|
||||
- name: verify test remove instance in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- not instance|changed
|
||||
|
||||
- name: test remove network in vpc
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
register: vpc_net
|
||||
- name: verify test remove network in vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc_net|success
|
||||
- vpc_net|changed
|
||||
- vpc_net.name == "{{ cs_resource_prefix }}_net_vpc"
|
||||
|
||||
- name: test remove network in vpc idempotence
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
register: vpc_net
|
||||
- name: verify test remove network in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- vpc_net|success
|
||||
- not vpc_net|changed
|
||||
|
||||
- name: test remove vpc
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test remove vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text2"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test remove vpc idempotence
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
register: vpc
|
||||
- name: verify test remove vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- not vpc|changed
|
|
@ -1,2 +0,0 @@
|
|||
---
|
||||
cs_resource_prefix: cloudstack
|
Loading…
Add table
Add a link
Reference in a new issue