mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 20:13:59 -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,2 +0,0 @@
|
|||
---
|
||||
cs_resource_prefix: cloudstack
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
test_cs_configuration_storage: PS0
|
||||
test_cs_configuration_cluster: C0
|
||||
test_cs_configuration_account: admin
|
||||
test_cs_configuration_zone: Sandbox-simulator
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,59 +0,0 @@
|
|||
---
|
||||
- name: test configuration account
|
||||
cs_configuration:
|
||||
name: allow.public.user.templates
|
||||
account: "{{ test_cs_configuration_account }}"
|
||||
value: true
|
||||
register: config
|
||||
- name: verify test configuration storage
|
||||
assert:
|
||||
that:
|
||||
- config|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 }}"
|
|
@ -1,59 +0,0 @@
|
|||
---
|
||||
- name: test configuration cluster
|
||||
cs_configuration:
|
||||
name: cpu.overprovisioning.factor
|
||||
cluster: "{{ test_cs_configuration_cluster }}"
|
||||
value: 1.0
|
||||
register: config
|
||||
- name: verify test configuration cluster
|
||||
assert:
|
||||
that:
|
||||
- config|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 }}"
|
|
@ -1,162 +0,0 @@
|
|||
---
|
||||
- name: test fail if missing name
|
||||
cs_configuration:
|
||||
register: config
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing arguments
|
||||
assert:
|
||||
that:
|
||||
- config|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
|
|
@ -1,59 +0,0 @@
|
|||
---
|
||||
- name: test configuration storage
|
||||
cs_configuration:
|
||||
name: storage.overprovisioning.factor
|
||||
storage: "{{ test_cs_configuration_storage }}"
|
||||
value: 2.0
|
||||
register: config
|
||||
- name: verify test configuration storage
|
||||
assert:
|
||||
that:
|
||||
- config|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 }}"
|
|
@ -1,59 +0,0 @@
|
|||
---
|
||||
- name: test configuration zone
|
||||
cs_configuration:
|
||||
name: use.external.dns
|
||||
zone: "{{ test_cs_configuration_zone }}"
|
||||
value: false
|
||||
register: config
|
||||
- name: verify test configuration zone
|
||||
assert:
|
||||
that:
|
||||
- config|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 +0,0 @@
|
|||
---
|
||||
cs_firewall_ip_address: 10.100.212.5
|
||||
cs_firewall_network: test
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,271 +0,0 @@
|
|||
---
|
||||
- name: setup 80
|
||||
cs_firewall:
|
||||
port: 80
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
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
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify setup
|
||||
assert:
|
||||
that:
|
||||
- fw|success
|
||||
|
||||
- name: setup all
|
||||
cs_firewall:
|
||||
network: "{{ cs_firewall_network }}"
|
||||
protocol: all
|
||||
type: egress
|
||||
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 == "missing required argument for protocol 'tcp': start_port or end_port"
|
||||
|
||||
- name: test fail if missing params ip_address ingress
|
||||
cs_firewall:
|
||||
port: 80
|
||||
register: fw
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing params ip_address
|
||||
assert:
|
||||
that:
|
||||
- fw|failed
|
||||
- fw.msg == "missing required argument for type ingress: ip_address"
|
||||
|
||||
- name: test fail if missing params network egress
|
||||
cs_firewall:
|
||||
type: egress
|
||||
register: fw
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing params ip_address
|
||||
assert:
|
||||
that:
|
||||
- fw|failed
|
||||
- fw.msg == "missing required argument for type egress: network"
|
||||
|
||||
- name: test present firewall rule ingress 80
|
||||
cs_firewall:
|
||||
port: 80
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
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 }}"
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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 }}"
|
||||
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 }}"
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify results of absent firewall rule egress all idempotence
|
||||
assert:
|
||||
that:
|
||||
- fw|success
|
||||
- not fw|changed
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
instance_number: 1
|
||||
test_cs_instance_template: CentOS 5.3(64-bit) no GUI (Simulator)
|
||||
test_cs_instance_offering_1: Small Instance
|
||||
test_cs_instance_offering_2: Medium Instance
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,43 +0,0 @@
|
|||
---
|
||||
- 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
|
|
@ -1,43 +0,0 @@
|
|||
---
|
||||
- name: test destroy instance with display_name
|
||||
cs_instance:
|
||||
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: absent
|
||||
register: instance
|
||||
- name: verify destroy instance with display_name
|
||||
assert:
|
||||
that:
|
||||
- instance|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
|
|
@ -1,30 +0,0 @@
|
|||
---
|
||||
- name: cleanup ssh key
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
|
||||
register: sshkey
|
||||
- name: verify cleanup ssh key
|
||||
assert:
|
||||
that:
|
||||
- sshkey|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
|
|
@ -1,11 +0,0 @@
|
|||
---
|
||||
- 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
|
|
@ -1,187 +0,0 @@
|
|||
---
|
||||
- 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 }}"
|
|
@ -1,176 +0,0 @@
|
|||
---
|
||||
- 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 }}"
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
- name: setup ssh key
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
|
||||
register: sshkey
|
||||
- name: verify setup ssh key
|
||||
assert:
|
||||
that:
|
||||
- sshkey|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
|
|
@ -1,83 +0,0 @@
|
|||
---
|
||||
- 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
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
test_cs_instance_template: CentOS 5.3(64-bit) no GUI (Simulator)
|
||||
test_cs_instance_offering_1: Small Instance
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,55 +0,0 @@
|
|||
---
|
||||
- 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 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,71 +0,0 @@
|
|||
---
|
||||
- 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
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
test_cs_lb_public_ip: "1.2.3.4"
|
||||
test_cs_instance_template: CentOS 5.3(64-bit) no GUI (Simulator)
|
||||
test_cs_instance_offering_1: Small Instance
|
||||
test_cs_lb_member: "{{ cs_resource_prefix }}_member1"
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,211 +0,0 @@
|
|||
---
|
||||
- name: setup
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify setup
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
|
||||
- name: setup instance
|
||||
cs_instance:
|
||||
name: "{{ test_cs_lb_member }}"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
register: instance
|
||||
- name: verify create instance
|
||||
assert:
|
||||
that:
|
||||
- instance|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: "{{ test_cs_lb_public_ip }}"
|
||||
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 == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test create rule idempotence
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
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 == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test update rule
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
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 == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test update rule idempotence
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
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 == "{{ test_cs_lb_public_ip }}"
|
||||
- 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: "{{ test_cs_lb_member }}"
|
||||
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 == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
- "'{{ test_cs_lb_member }}' in lb.vms"
|
||||
|
||||
- name: test add members to rule idempotence
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
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 == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
- "'{{ test_cs_lb_member }}' in lb.vms"
|
||||
|
||||
- name: test remove members to rule
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
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 == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
- "'{{ test_cs_lb_member }}' not in lb.vms"
|
||||
|
||||
- name: test remove members to rule idempotence
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
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: "{{ test_cs_lb_public_ip }}"
|
||||
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 == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test remove rule idempotence
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify remove rule idempotence
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- not lb|changed
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,210 +0,0 @@
|
|||
---
|
||||
- name: setup pod is absent
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
state: absent
|
||||
register: pod
|
||||
- name: verify setup pod is absent
|
||||
assert:
|
||||
that:
|
||||
- pod|success
|
||||
|
||||
- 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: 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
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
cs_portforward_public_ip: "10.100.212.5"
|
||||
cs_portforward_vm: "{{ cs_resource_prefix }}-vm"
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,111 +0,0 @@
|
|||
---
|
||||
- name: setup
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
state: absent
|
||||
register: pf
|
||||
- name: verify setup
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
register: pf
|
||||
- name: verify results of absent port forwarding idempotence
|
||||
assert:
|
||||
that:
|
||||
- pf|success
|
||||
- not pf|changed
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
test_cs_instance_template: CentOS 5.3(64-bit) no GUI (Simulator)
|
||||
test_cs_instance_offering_1: Small Instance
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,101 +0,0 @@
|
|||
---
|
||||
- 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
|
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
test_cs_instance_1: "{{ cs_resource_prefix }}-vm1"
|
||||
test_cs_instance_2: "{{ cs_resource_prefix }}-vm2"
|
||||
test_cs_instance_template: CentOS 5.3(64-bit) no GUI (Simulator)
|
||||
test_cs_instance_offering_1: Small Instance
|
||||
test_cs_disk_offering_1: Custom
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,215 +0,0 @@
|
|||
---
|
||||
- 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
|
Loading…
Add table
Add a link
Reference in a new issue