mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: add check mode tests (#24908)
* cloudstack: test: cs_network_acl: add check_mode tests * cloudstack: test: cs_pod: add check_mode tests * cloudstack: test: cs_user: add check_mode tests * cloudstack: test: cs_sshkeypair: add check_mode tests * cloudstack: test: cs_project: add check_mode tests * cloudstack: test: cs_vpc: add check_mode tests * cloudstack: test: cs_vpn_gateway: add check_mode tests * cloudstack: test: cs_volume: add check_mode tests * cloudstack: test: cs_vmsnapshot: add check_mode tests * cloudstack: test: cs_account: add check_mode tests * cloudstack: test: cs_affinitygroup: add check_mode tests * cloudstack: test: cs_cluster: add check_mode tests * cloudstack: test: cs_domain: add check_mode tests * cloudstack: test: cs_instancegroup: add check_mode tests * cloudstack: test: cs_iso: add check_mode tests * cloudstack: test: cs_loadbalancer_rule: add check_mode tests * cloudstack: test: cs_portforward: add check_mode tests * cloudstack: test: cs_resourcelimit: add check_mode tests * cloudstack: test: cs_securitygroup: add check_mode tests * cloudstack: test: cs_securitygroup_rule: add check_mode tests * cloudstack: test: cs_configuration: add check_mode tests * cloudstack: test: cs_firewall: add check_mode tests * cloudstack: test: cs_instance: add check_mode tests * cloudstack: query current tags from API Fixes unexpected tags returned in check mode.
This commit is contained in:
parent
2af5556901
commit
d5b04aa1f1
32 changed files with 1838 additions and 33 deletions
|
@ -507,9 +507,17 @@ class AnsibleCloudStack(object):
|
|||
return self._get_by_key(key, self.domain)
|
||||
self.fail_json(msg="Domain '%s' not found" % domain)
|
||||
|
||||
def get_tags(self, resource=None):
|
||||
def query_tags(self, resource, resource_type):
|
||||
args = {
|
||||
'resourceids': resource['id'],
|
||||
'resourcetype': resource_type,
|
||||
}
|
||||
tags = self.cs.listTags(**args)
|
||||
return self.get_tags(resource=tags, key='tag')
|
||||
|
||||
def get_tags(self, resource=None, key='tags'):
|
||||
existing_tags = []
|
||||
for tag in resource.get('tags', []):
|
||||
for tag in resource.get(key) or []:
|
||||
existing_tags.append({'key': tag['key'], 'value': tag['value']})
|
||||
return existing_tags
|
||||
|
||||
|
@ -545,7 +553,7 @@ class AnsibleCloudStack(object):
|
|||
if tags is not None:
|
||||
self._process_tags(resource, resource_type, self._tags_that_should_not_exist(resource, tags), operation="delete")
|
||||
self._process_tags(resource, resource_type, self._tags_that_should_exist_or_be_updated(resource, tags))
|
||||
resource['tags'] = tags
|
||||
resource['tags'] = self.query_tags(resource=resource, resource_type=resource_type)
|
||||
return resource
|
||||
|
||||
def get_capabilities(self, key=None):
|
||||
|
|
|
@ -28,6 +28,23 @@
|
|||
- acc|failed
|
||||
- 'acc.msg == "missing required arguments: email,username,password,first_name,last_name"'
|
||||
|
||||
- name: test create user account in check mode
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
username: "{{ cs_resource_prefix }}_username"
|
||||
password: "{{ cs_resource_prefix }}_password"
|
||||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "example.com"
|
||||
register: acc
|
||||
check_mode: true
|
||||
- name: verify results of create account in check mode
|
||||
assert:
|
||||
that:
|
||||
- acc|success
|
||||
- acc|changed
|
||||
|
||||
- name: test create user account
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -70,6 +87,23 @@
|
|||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
||||
- name: test lock user account in check mode
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
state: locked
|
||||
register: acc
|
||||
check_mode: true
|
||||
- name: verify results of lock user account in check mode
|
||||
assert:
|
||||
that:
|
||||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
||||
- name: test lock user account
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -102,6 +136,23 @@
|
|||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
||||
- name: test disable user account in check mode
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
state: disabled
|
||||
register: acc
|
||||
check_mode: true
|
||||
- name: verify results of disable user account in check mode
|
||||
assert:
|
||||
that:
|
||||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
||||
- name: test disable user account
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -134,6 +185,23 @@
|
|||
- acc.state == "disabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
||||
- name: test lock disabled user account in check mode
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
state: locked
|
||||
register: acc
|
||||
check_mode: true
|
||||
- name: verify results of lock disabled user account in check mode
|
||||
assert:
|
||||
that:
|
||||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "disabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
||||
- name: test lock disabled user account
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -166,6 +234,23 @@
|
|||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
||||
- name: test enable user account in check mode
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
state: enabled
|
||||
register: acc
|
||||
check_mode: true
|
||||
- name: verify results of enable user account in check mode
|
||||
assert:
|
||||
that:
|
||||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
||||
- name: test enable user account
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -198,6 +283,23 @@
|
|||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
||||
- name: test remove user account in check mode
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
state: absent
|
||||
register: acc
|
||||
check_mode: true
|
||||
- name: verify results of remove user account in check mode
|
||||
assert:
|
||||
that:
|
||||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
||||
- name: test remove user account
|
||||
cs_account:
|
||||
name: "{{ cs_resource_prefix }}_user"
|
||||
|
|
|
@ -17,6 +17,16 @@
|
|||
- ag|failed
|
||||
- "ag.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test present affinity group in check mode
|
||||
cs_affinitygroup: name={{ cs_resource_prefix }}_ag
|
||||
register: ag
|
||||
check_mode: true
|
||||
- name: verify results of create affinity group in check mode
|
||||
assert:
|
||||
that:
|
||||
- ag|success
|
||||
- ag|changed
|
||||
|
||||
- name: test present affinity group
|
||||
cs_affinitygroup: name={{ cs_resource_prefix }}_ag
|
||||
register: ag
|
||||
|
@ -37,6 +47,17 @@
|
|||
- not ag|changed
|
||||
- ag.name == "{{ cs_resource_prefix }}_ag"
|
||||
|
||||
- name: test absent affinity group in check mode
|
||||
cs_affinitygroup: name={{ cs_resource_prefix }}_ag state=absent
|
||||
register: ag
|
||||
check_mode: true
|
||||
- name: verify results of absent affinity group in check mode
|
||||
assert:
|
||||
that:
|
||||
- ag|success
|
||||
- ag|changed
|
||||
- ag.name == "{{ cs_resource_prefix }}_ag"
|
||||
|
||||
- name: test absent affinity group
|
||||
cs_affinitygroup: name={{ cs_resource_prefix }}_ag state=absent
|
||||
register: ag
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
that:
|
||||
- zone|success
|
||||
|
||||
- name: setup pod is preset
|
||||
- name: setup pod is present
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
|
@ -29,7 +29,7 @@
|
|||
gateway: 10.100.10.1
|
||||
netmask: 255.255.255.0
|
||||
register: pod
|
||||
- name: verify setup pod is preset
|
||||
- name: verify setup pod is present
|
||||
assert:
|
||||
that:
|
||||
- pod|success
|
||||
|
@ -44,6 +44,20 @@
|
|||
- cluster|failed
|
||||
- "cluster.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test create cluster in check mode
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
hypervisor: simulator
|
||||
cluster_type: CloudManaged
|
||||
register: cluster_origin
|
||||
check_mode: true
|
||||
tags: disable
|
||||
- name: verify test create cluster in check mode
|
||||
assert:
|
||||
that:
|
||||
- cluster_origin|changed
|
||||
|
||||
- name: test create cluster
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
|
@ -80,6 +94,25 @@
|
|||
- cluster_origin.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "CloudManaged"
|
||||
|
||||
- name: test update cluster in check mode
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
hypervisor: simulator
|
||||
cluster_type: ExternalManaged
|
||||
register: cluster
|
||||
check_mode: true
|
||||
- name: verify test update cluster in check mode
|
||||
assert:
|
||||
that:
|
||||
- cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Enabled"
|
||||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "CloudManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
|
||||
- name: test update cluster
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
|
@ -116,12 +149,28 @@
|
|||
- cluster.cluster_type == "ExternalManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
|
||||
- name: test disable cluster in check mode
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
state: disabled
|
||||
register: cluster
|
||||
check_mode: true
|
||||
- name: verify test disable cluster in check mode
|
||||
assert:
|
||||
that:
|
||||
- cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Enabled"
|
||||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "ExternalManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
|
||||
- name: test disable cluster
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
state: disabled
|
||||
register: cluster
|
||||
tags: disable
|
||||
- name: verify test disable cluster
|
||||
assert:
|
||||
that:
|
||||
|
@ -132,14 +181,12 @@
|
|||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "ExternalManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
tags: disable
|
||||
|
||||
- name: test disable cluster idempotence
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
state: disabled
|
||||
register: cluster
|
||||
tags: disable
|
||||
- name: verify test disable cluster idempotence
|
||||
assert:
|
||||
that:
|
||||
|
@ -149,7 +196,23 @@
|
|||
- cluster.allocation_state == "Disabled"
|
||||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "ExternalManaged"
|
||||
tags: disable
|
||||
|
||||
- name: test enable cluster in check mode
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
state: enabled
|
||||
register: cluster
|
||||
check_mode: true
|
||||
- name: verify test enable cluster in check mode
|
||||
assert:
|
||||
that:
|
||||
- cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Disabled"
|
||||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "ExternalManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
|
||||
- name: test enable cluster
|
||||
cs_cluster:
|
||||
|
@ -183,6 +246,23 @@
|
|||
- cluster.cluster_type == "ExternalManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
|
||||
- name: test remove cluster in check mode
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: absent
|
||||
register: cluster
|
||||
check_mode: true
|
||||
- name: verify test remove cluster in check mode
|
||||
assert:
|
||||
that:
|
||||
- cluster.id == cluster_origin.id
|
||||
- cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Enabled"
|
||||
- cluster_origin.hypervisor == "Simulator"
|
||||
|
||||
- name: test remove cluster
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
|
|
|
@ -10,6 +10,23 @@
|
|||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration account in check mode
|
||||
cs_configuration:
|
||||
name: allow.public.user.templates
|
||||
account: "{{ test_cs_configuration_account }}"
|
||||
value: false
|
||||
register: config
|
||||
check_mode: true
|
||||
- name: verify update configuration account in check mode
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "true"
|
||||
- config.name == "allow.public.user.templates"
|
||||
- config.scope == "account"
|
||||
- config.account == "{{ test_cs_configuration_account }}"
|
||||
|
||||
- name: test update configuration account
|
||||
cs_configuration:
|
||||
name: allow.public.user.templates
|
||||
|
|
|
@ -10,6 +10,23 @@
|
|||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration cluster in check mode
|
||||
cs_configuration:
|
||||
name: cpu.overprovisioning.factor
|
||||
cluster: "{{ test_cs_configuration_cluster }}"
|
||||
value: 2.0
|
||||
register: config
|
||||
check_mode: true
|
||||
- name: verify update configuration cluster in check mode
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "1.0"
|
||||
- config.name == "cpu.overprovisioning.factor"
|
||||
- config.scope == "cluster"
|
||||
- config.cluster == "{{ test_cs_configuration_cluster }}"
|
||||
|
||||
- name: test update configuration cluster
|
||||
cs_configuration:
|
||||
name: cpu.overprovisioning.factor
|
||||
|
|
|
@ -19,6 +19,20 @@
|
|||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration string in check mode
|
||||
cs_configuration:
|
||||
name: network.loadbalancer.haproxy.stats.visibility
|
||||
value: all
|
||||
register: config
|
||||
check_mode: true
|
||||
- name: verify test update configuration string in check mode
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "global"
|
||||
- config.name == "network.loadbalancer.haproxy.stats.visibility"
|
||||
|
||||
- name: test update configuration string
|
||||
cs_configuration:
|
||||
name: network.loadbalancer.haproxy.stats.visibility
|
||||
|
@ -68,6 +82,20 @@
|
|||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration bool in check mode
|
||||
cs_configuration:
|
||||
name: vmware.recycle.hung.wokervm
|
||||
value: true
|
||||
register: config
|
||||
check_mode: true
|
||||
- name: verify test update configuration bool in check mode
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "false"
|
||||
- config.name == "vmware.recycle.hung.wokervm"
|
||||
|
||||
- name: test update configuration bool
|
||||
cs_configuration:
|
||||
name: vmware.recycle.hung.wokervm
|
||||
|
@ -117,6 +145,20 @@
|
|||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration float in check mode
|
||||
cs_configuration:
|
||||
name: agent.load.threshold
|
||||
value: 0.81
|
||||
register: config
|
||||
check_mode: true
|
||||
- name: verify update configuration float in check mode
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "0.7"
|
||||
- config.name == "agent.load.threshold"
|
||||
|
||||
- name: test update configuration float
|
||||
cs_configuration:
|
||||
name: agent.load.threshold
|
||||
|
|
|
@ -10,6 +10,23 @@
|
|||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration storage in check mode
|
||||
cs_configuration:
|
||||
name: storage.overprovisioning.factor
|
||||
storage: "{{ test_cs_configuration_storage }}"
|
||||
value: 3.0
|
||||
register: config
|
||||
check_mode: true
|
||||
- name: verify update configuration storage in check mode
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "2.0"
|
||||
- config.name == "storage.overprovisioning.factor"
|
||||
- config.scope == "storagepool"
|
||||
- config.storage == "{{ test_cs_configuration_storage }}"
|
||||
|
||||
- name: test update configuration storage
|
||||
cs_configuration:
|
||||
name: storage.overprovisioning.factor
|
||||
|
|
|
@ -27,6 +27,15 @@
|
|||
- dom|failed
|
||||
- dom.msg == "Path '{{ cs_resource_prefix }}_domain/' must not end with /"
|
||||
|
||||
- name: test create a domain in check mode
|
||||
cs_domain: path={{ cs_resource_prefix }}_domain
|
||||
register: dom
|
||||
check_mode: true
|
||||
- name: verify results of test create a domain in check mode
|
||||
assert:
|
||||
that:
|
||||
- dom|changed
|
||||
|
||||
- name: test create a domain
|
||||
cs_domain: path={{ cs_resource_prefix }}_domain
|
||||
register: dom
|
||||
|
@ -47,6 +56,15 @@
|
|||
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain"
|
||||
- dom.name == "{{ cs_resource_prefix }}_domain"
|
||||
|
||||
- name: test create a subdomain in check mode
|
||||
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
|
||||
register: dom
|
||||
check_mode: true
|
||||
- name: verify results of test create a domain in check mode
|
||||
assert:
|
||||
that:
|
||||
- dom|changed
|
||||
|
||||
- name: test create a subdomain
|
||||
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
|
||||
register: dom
|
||||
|
@ -65,10 +83,21 @@
|
|||
that:
|
||||
- not dom|changed
|
||||
|
||||
- name: test delete a subdomain in check mode
|
||||
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain state=absent
|
||||
register: dom
|
||||
check_mode: true
|
||||
- name: verify results of test delete a subdomain in check mode
|
||||
assert:
|
||||
that:
|
||||
- dom|changed
|
||||
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
|
||||
- dom.name == "{{ cs_resource_prefix }}_subdomain"
|
||||
|
||||
- name: test delete a subdomain
|
||||
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain state=absent
|
||||
register: dom
|
||||
- name: verify results of test delete a subdomain idempotence
|
||||
- name: verify results of test delete a subdomain
|
||||
assert:
|
||||
that:
|
||||
- dom|changed
|
||||
|
@ -93,6 +122,17 @@
|
|||
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
|
||||
- dom.name == "{{ cs_resource_prefix }}_subdomain"
|
||||
|
||||
- name: test delete a domain with clean up in check mode
|
||||
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain state=absent clean_up=true
|
||||
register: dom
|
||||
check_mode: true
|
||||
- name: verify results of test delete a domain with clean up in check mode
|
||||
assert:
|
||||
that:
|
||||
- dom|changed
|
||||
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain"
|
||||
- dom.name == "{{ cs_resource_prefix }}_domain"
|
||||
|
||||
- name: test delete a domain with clean up
|
||||
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain state=absent clean_up=true
|
||||
register: dom
|
||||
|
|
|
@ -99,6 +99,19 @@
|
|||
- fw|failed
|
||||
- "fw.msg == 'one of the following is required: ip_address,network'"
|
||||
|
||||
- name: test present firewall rule ingress 80 in check mode
|
||||
cs_firewall:
|
||||
port: 80
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
check_mode: true
|
||||
- name: verify results of present firewall rule ingress 80 in check mode
|
||||
assert:
|
||||
that:
|
||||
- fw|success
|
||||
- fw|changed
|
||||
|
||||
- name: test present firewall rule ingress 80
|
||||
cs_firewall:
|
||||
port: 80
|
||||
|
@ -135,6 +148,22 @@
|
|||
- fw.end_port == 80
|
||||
- fw.type == "ingress"
|
||||
|
||||
- name: test present firewall rule ingress 5300 in check mode
|
||||
cs_firewall:
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
protocol: udp
|
||||
start_port: 5300
|
||||
end_port: 5333
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
check_mode: true
|
||||
- name: verify results of present firewall rule ingress 5300 in check mode
|
||||
assert:
|
||||
that:
|
||||
- fw|success
|
||||
- fw|changed
|
||||
|
||||
- name: test present firewall rule ingress 5300
|
||||
cs_firewall:
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
|
@ -177,6 +206,20 @@
|
|||
- fw.end_port == 5333
|
||||
- fw.type == "ingress"
|
||||
|
||||
- name: test present firewall rule egress all in check mode
|
||||
cs_firewall:
|
||||
network: "{{ cs_firewall_network }}"
|
||||
protocol: all
|
||||
type: egress
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
check_mode: true
|
||||
- name: verify results of present firewall rule egress all in check mode
|
||||
assert:
|
||||
that:
|
||||
- fw|success
|
||||
- fw|changed
|
||||
|
||||
- name: test present firewall rule egress all
|
||||
cs_firewall:
|
||||
network: "{{ cs_firewall_network }}"
|
||||
|
@ -211,6 +254,26 @@
|
|||
- fw.protocol == "all"
|
||||
- fw.type == "egress"
|
||||
|
||||
- name: test absent firewall rule ingress 80 in check mode
|
||||
cs_firewall:
|
||||
port: 80
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
check_mode: true
|
||||
- name: verify results of absent firewall rule ingress 80 in check mode
|
||||
assert:
|
||||
that:
|
||||
- fw|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
|
||||
cs_firewall:
|
||||
port: 80
|
||||
|
@ -243,6 +306,29 @@
|
|||
- fw|success
|
||||
- not fw|changed
|
||||
|
||||
- name: test absent firewall rule ingress 5300 in check mode
|
||||
cs_firewall:
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
protocol: udp
|
||||
start_port: 5300
|
||||
end_port: 5333
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
check_mode: true
|
||||
- name: verify results of absent firewall rule ingress 5300 in check mode
|
||||
assert:
|
||||
that:
|
||||
- fw|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
|
||||
cs_firewall:
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
|
@ -281,6 +367,25 @@
|
|||
- fw|success
|
||||
- not fw|changed
|
||||
|
||||
- name: test absent firewall rule egress all in check mode
|
||||
cs_firewall:
|
||||
network: "{{ cs_firewall_network }}"
|
||||
protocol: all
|
||||
type: egress
|
||||
state: absent
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
check_mode: true
|
||||
- name: verify results of absent firewall rule egress all in check mode
|
||||
assert:
|
||||
that:
|
||||
- fw|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
|
||||
cs_firewall:
|
||||
network: "{{ cs_firewall_network }}"
|
||||
|
|
|
@ -1,4 +1,17 @@
|
|||
---
|
||||
- name: test destroy instance in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: absent
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify destroy instance in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.state != "Destroyed"
|
||||
|
||||
- name: test destroy instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -22,6 +35,19 @@
|
|||
- instance|success
|
||||
- not instance|changed
|
||||
|
||||
- name: test recover to stopped state and update a deleted instance in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
state: stopped
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify test recover to stopped state and update a deleted instance in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
|
||||
- name: test recover to stopped state and update a deleted instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -36,8 +62,54 @@
|
|||
- instance.state == "Stopped"
|
||||
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||
|
||||
# force expunge, only works with admin permissions
|
||||
- cs_instance:
|
||||
- name: test recover to stopped state and update a deleted instance idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
state: stopped
|
||||
register: instance
|
||||
- name: verify test recover to stopped state and update a deleted instance idempotence
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- not instance|changed
|
||||
- instance.state == "Stopped"
|
||||
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||
|
||||
- name: test expunge instance in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: expunged
|
||||
failed_when: false
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify test expunge instance in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.state == "Stopped"
|
||||
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||
|
||||
- name: test expunge instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: expunged
|
||||
register: instance
|
||||
- name: verify test expunge instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.state == "Stopped"
|
||||
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||
|
||||
- name: test expunge instance idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: expunged
|
||||
register: instance
|
||||
- name: verify test expunge instance idempotence
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- not instance|changed
|
||||
|
|
|
@ -7,6 +7,23 @@
|
|||
that:
|
||||
- instance|success
|
||||
|
||||
- name: test create instance in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
affinity_group: "{{ cs_resource_prefix }}-ag"
|
||||
security_group: "{{ cs_resource_prefix }}-sg"
|
||||
ssh_key: "{{ cs_resource_prefix }}-sshkey"
|
||||
tags: []
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify create instance in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
|
||||
- name: test create instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -51,6 +68,23 @@
|
|||
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey"
|
||||
- not instance.tags
|
||||
|
||||
- name: test running instance not updated in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
service_offering: "{{ test_cs_instance_offering_2 }}"
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify running instance not updated in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|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 running instance not updated
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -66,6 +100,22 @@
|
|||
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: test stopping instance in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: stopped
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify stopping instance in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|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"
|
||||
|
||||
- name: test stopping instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -93,6 +143,23 @@
|
|||
- not instance|changed
|
||||
- instance.state == "Stopped"
|
||||
|
||||
- name: test updating stopped instance in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}"
|
||||
service_offering: "{{ test_cs_instance_offering_2 }}"
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify updating stopped instance in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|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 updating stopped instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -109,6 +176,38 @@
|
|||
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
|
||||
- instance.state == "Stopped"
|
||||
|
||||
- name: test updating stopped instance idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}"
|
||||
service_offering: "{{ test_cs_instance_offering_2 }}"
|
||||
register: instance
|
||||
- name: verify updating stopped instance idempotence
|
||||
assert:
|
||||
that:
|
||||
- instance|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 == "Stopped"
|
||||
|
||||
- name: test starting instance in check mdoe
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: started
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify starting instance in check mode
|
||||
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 }}"
|
||||
|
@ -139,6 +238,23 @@
|
|||
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: test force update running instance in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
force: true
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify force update running instance in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|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 force update running instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -171,6 +287,22 @@
|
|||
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: test restore instance in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
state: restored
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify restore instance in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|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 }}"
|
||||
|
||||
- name: test restore instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
|
|
@ -1,4 +1,21 @@
|
|||
---
|
||||
- name: test add tags to instance in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
tags:
|
||||
- { key: "{{ cs_resource_prefix }}-tag1", value: "{{ cs_resource_prefix }}-value1" }
|
||||
- { key: "{{ cs_resource_prefix }}-tag2", value: "{{ cs_resource_prefix }}-value2" }
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify add tags to instance in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- not instance.tags
|
||||
|
||||
- name: test add tags to instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -37,6 +54,25 @@
|
|||
- "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]"
|
||||
- "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]"
|
||||
|
||||
- name: test change tags of instance in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
tags:
|
||||
- { key: "{{ cs_resource_prefix }}-tag2", value: "{{ cs_resource_prefix }}-value2" }
|
||||
- { key: "{{ cs_resource_prefix }}-tag3", value: "{{ cs_resource_prefix }}-value3" }
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify tags to instance idempotence in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|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 change tags of instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -70,6 +106,19 @@
|
|||
- "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value3' ]"
|
||||
- "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value3' ]"
|
||||
|
||||
- name: test remove tags in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
tags: []
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify remove tags in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.tags|length != 0
|
||||
|
||||
- name: test remove tags
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
|
|
@ -17,6 +17,16 @@
|
|||
- ig|failed
|
||||
- "ig.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test present instance group in check mode
|
||||
cs_instancegroup: name={{ cs_resource_prefix }}_ig
|
||||
register: ig
|
||||
check_mode: true
|
||||
- name: verify results of create instance group in check mode
|
||||
assert:
|
||||
that:
|
||||
- ig|success
|
||||
- ig|changed
|
||||
|
||||
- name: test present instance group
|
||||
cs_instancegroup: name={{ cs_resource_prefix }}_ig
|
||||
register: ig
|
||||
|
@ -37,6 +47,17 @@
|
|||
- not ig|changed
|
||||
- ig.name == "{{ cs_resource_prefix }}_ig"
|
||||
|
||||
- name: test absent instance group in check mode
|
||||
cs_instancegroup: name={{ cs_resource_prefix }}_ig state=absent
|
||||
register: ig
|
||||
check_mode: true
|
||||
- name: verify results of absent instance group in check mode
|
||||
assert:
|
||||
that:
|
||||
- ig|success
|
||||
- ig|changed
|
||||
- ig.name == "{{ cs_resource_prefix }}_ig"
|
||||
|
||||
- name: test absent instance group
|
||||
cs_instancegroup: name={{ cs_resource_prefix }}_ig state=absent
|
||||
register: ig
|
||||
|
|
|
@ -1,14 +1,26 @@
|
|||
---
|
||||
- name: ensure iso is deleted
|
||||
- name: setup iso
|
||||
cs_iso:
|
||||
name: "{{ cs_resource_prefix }}-iso"
|
||||
state: absent
|
||||
register: iso
|
||||
- name: verify ensure iso is deleted
|
||||
- name: verify setup iso
|
||||
assert:
|
||||
that:
|
||||
- iso|success
|
||||
|
||||
- name: test download iso in check mode
|
||||
cs_iso:
|
||||
name: "{{ cs_resource_prefix }}-iso"
|
||||
url: http://mirror.switch.ch/ftp/mirror/debian-cd/current/amd64/iso-cd/debian-7.7.0-amd64-netinst.iso
|
||||
os_type: Debian GNU/Linux 7(64-bit)
|
||||
register: iso
|
||||
check_mode: true
|
||||
- name: verify test download iso in check mode
|
||||
assert:
|
||||
that:
|
||||
- iso|changed
|
||||
|
||||
- name: test download iso
|
||||
cs_iso:
|
||||
name: "{{ cs_resource_prefix }}-iso"
|
||||
|
@ -33,21 +45,17 @@
|
|||
- 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 in check mode
|
||||
cs_iso:
|
||||
name: "{{ cs_resource_prefix }}-iso"
|
||||
state: absent
|
||||
register: iso
|
||||
check_mode: true
|
||||
- name: verify test remove iso in check mode
|
||||
assert:
|
||||
that:
|
||||
- iso|changed
|
||||
- iso.name == "{{ cs_resource_prefix }}-iso"
|
||||
|
||||
- name: test remove iso
|
||||
cs_iso:
|
||||
|
|
|
@ -59,6 +59,22 @@
|
|||
- lb|failed
|
||||
- "lb.msg.startswith('missing required arguments: ')"
|
||||
|
||||
|
||||
- name: test create rule in check mode
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ ip_address.ip_address }}"
|
||||
algorithm: roundrobin
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
register: lb
|
||||
check_mode: true
|
||||
- name: verify test create rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- lb|changed
|
||||
|
||||
- name: test create rule
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
|
@ -97,6 +113,26 @@
|
|||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test update rule in check mode
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ ip_address.ip_address }}"
|
||||
algorithm: source
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
register: lb
|
||||
check_mode: true
|
||||
- name: verify test update rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- lb|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 update rule
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
|
@ -145,6 +181,24 @@
|
|||
- lb|failed
|
||||
- "lb.msg.startswith('missing required arguments: ')"
|
||||
|
||||
- name: test add members to rule in check mode
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ cs_resource_prefix }}-vm-lb"
|
||||
register: lb
|
||||
check_mode: true
|
||||
- name: verify add members to rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- lb|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 add members to rule
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
|
@ -179,6 +233,25 @@
|
|||
- lb.private_port == 8080
|
||||
- "'{{ cs_resource_prefix }}-vm-lb' in lb.vms"
|
||||
|
||||
- name: test remove members to rule in check mode
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ cs_resource_prefix }}-vm-lb"
|
||||
state: absent
|
||||
register: lb
|
||||
check_mode: true
|
||||
- name: verify remove members to rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- lb|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 remove members to rule
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
|
@ -209,6 +282,24 @@
|
|||
- lb|success
|
||||
- not lb|changed
|
||||
|
||||
- name: test remove rule in check mode
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ ip_address.ip_address }}"
|
||||
state: absent
|
||||
register: lb
|
||||
check_mode: true
|
||||
- name: verify remove rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- lb|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
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
|
|
|
@ -33,6 +33,19 @@
|
|||
- acl|failed
|
||||
- "acl.msg.startswith('missing required arguments: ')"
|
||||
|
||||
- name: test create network acl in check mode
|
||||
cs_network_acl:
|
||||
name: "{{ cs_resource_prefix }}_acl"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: acl
|
||||
check_mode: true
|
||||
- name: verify test create network acl in check mode
|
||||
assert:
|
||||
that:
|
||||
- acl|success
|
||||
- acl|changed
|
||||
|
||||
- name: test create network acl
|
||||
cs_network_acl:
|
||||
name: "{{ cs_resource_prefix }}_acl"
|
||||
|
@ -61,6 +74,22 @@
|
|||
- acl.vpc == "{{ cs_resource_prefix }}_vpc"
|
||||
- acl.name == "{{ cs_resource_prefix }}_acl"
|
||||
|
||||
- name: test remove network acl in check mode
|
||||
cs_network_acl:
|
||||
name: "{{ cs_resource_prefix }}_acl"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: acl
|
||||
check_mode: true
|
||||
- name: verify test remove network acl in check mode
|
||||
assert:
|
||||
that:
|
||||
- acl|success
|
||||
- acl|changed
|
||||
- acl.vpc == "{{ cs_resource_prefix }}_vpc"
|
||||
- acl.name == "{{ cs_resource_prefix }}_acl"
|
||||
|
||||
- name: test remove network acl
|
||||
cs_network_acl:
|
||||
name: "{{ cs_resource_prefix }}_acl"
|
||||
|
|
|
@ -32,6 +32,22 @@
|
|||
- pod|failed
|
||||
- "pod.msg == 'missing required arguments: name'"
|
||||
|
||||
|
||||
- name: test create pod in check mode
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
start_ip: 10.100.10.101
|
||||
gateway: 10.100.10.1
|
||||
netmask: 255.255.255.0
|
||||
register: pod_origin
|
||||
check_mode: true
|
||||
- name: verify test create pod in check mode
|
||||
assert:
|
||||
that:
|
||||
- pod_origin|changed
|
||||
- pod_origin.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test create pod
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
|
@ -70,6 +86,26 @@
|
|||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test update pod in check mode
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
start_ip: 10.100.10.102
|
||||
gateway: 10.100.10.1
|
||||
netmask: 255.255.255.0
|
||||
register: pod
|
||||
check_mode: true
|
||||
- name: verify test update pod in check mode
|
||||
assert:
|
||||
that:
|
||||
- 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"
|
||||
|
@ -108,6 +144,25 @@
|
|||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test disable pod in check mode
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: disabled
|
||||
register: pod
|
||||
check_mode: true
|
||||
- name: verify test enable pod in check mode
|
||||
assert:
|
||||
that:
|
||||
- pod|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 disable pod
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
|
@ -144,6 +199,25 @@
|
|||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test enable pod in check mode
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: enabled
|
||||
register: pod
|
||||
check_mode: true
|
||||
- name: verify test disable pod in check mode
|
||||
assert:
|
||||
that:
|
||||
- pod|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"
|
||||
|
@ -181,6 +255,25 @@
|
|||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test absent pod in check mode
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: absent
|
||||
register: pod
|
||||
check_mode: true
|
||||
- name: verify test create pod in check mode
|
||||
assert:
|
||||
that:
|
||||
- pod|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
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
|
|
|
@ -61,6 +61,21 @@
|
|||
- pf|failed
|
||||
- 'pf.msg.startswith("missing required arguments: ")'
|
||||
|
||||
- name: test present port forwarding in check mode
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
vm: "{{ cs_portforward_vm }}"
|
||||
private_port: 8080
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: pf
|
||||
check_mode: true
|
||||
- name: verify results of present port forwarding in check mode
|
||||
assert:
|
||||
that:
|
||||
- pf|success
|
||||
- pf|changed
|
||||
|
||||
- name: test present port forwarding
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
|
@ -101,6 +116,27 @@
|
|||
- pf.private_port == 8080
|
||||
- pf.private_end_port == 8080
|
||||
|
||||
- name: test change port forwarding in check mode
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
vm: "{{ cs_portforward_vm }}"
|
||||
private_port: 8888
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: pf
|
||||
check_mode: true
|
||||
- name: verify results of change port forwarding in check mode
|
||||
assert:
|
||||
that:
|
||||
- pf|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 change port forwarding
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
|
@ -121,6 +157,47 @@
|
|||
- pf.private_port == 8888
|
||||
- pf.private_end_port == 8888
|
||||
|
||||
- name: test change port forwarding idempotence
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
vm: "{{ cs_portforward_vm }}"
|
||||
private_port: 8888
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: pf
|
||||
- name: verify results of change port forwarding idempotence
|
||||
assert:
|
||||
that:
|
||||
- pf|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 == 8888
|
||||
- pf.private_end_port == 8888
|
||||
|
||||
- name: test absent port forwarding in check mode
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
private_port: 8888
|
||||
state: absent
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: pf
|
||||
check_mode: true
|
||||
- name: verify results of absent port forwarding in check mode
|
||||
assert:
|
||||
that:
|
||||
- pf|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 }}"
|
||||
|
|
|
@ -9,6 +9,16 @@
|
|||
that:
|
||||
- prj|success
|
||||
|
||||
- name: test create project in check mode
|
||||
cs_project:
|
||||
name: "{{ cs_resource_prefix }}-prj"
|
||||
register: prj
|
||||
check_mode: true
|
||||
- name: verify test create project in check mode
|
||||
assert:
|
||||
that:
|
||||
- prj|changed
|
||||
|
||||
- name: test create project
|
||||
cs_project:
|
||||
name: "{{ cs_resource_prefix }}-prj"
|
||||
|
@ -29,6 +39,19 @@
|
|||
- not prj|changed
|
||||
- prj.name == "{{ cs_resource_prefix }}-prj"
|
||||
|
||||
- name: test suspend project in check mode
|
||||
cs_project:
|
||||
name: "{{ cs_resource_prefix }}-prj"
|
||||
state: suspended
|
||||
register: prj
|
||||
check_mode: true
|
||||
- name: verify test suspend project in check mode
|
||||
assert:
|
||||
that:
|
||||
- prj|changed
|
||||
- prj.name == "{{ cs_resource_prefix }}-prj"
|
||||
- prj.state != "Suspended"
|
||||
|
||||
- name: test suspend project
|
||||
cs_project:
|
||||
name: "{{ cs_resource_prefix }}-prj"
|
||||
|
@ -53,6 +76,19 @@
|
|||
- prj.name == "{{ cs_resource_prefix }}-prj"
|
||||
- prj.state == "Suspended"
|
||||
|
||||
- name: test activate project in check mode
|
||||
cs_project:
|
||||
name: "{{ cs_resource_prefix }}-prj"
|
||||
state: active
|
||||
register: prj
|
||||
check_mode: true
|
||||
- name: verify test activate project in check mode
|
||||
assert:
|
||||
that:
|
||||
- prj|changed
|
||||
- prj.name == "{{ cs_resource_prefix }}-prj"
|
||||
- prj.state != "Active"
|
||||
|
||||
- name: test activate project
|
||||
cs_project:
|
||||
name: "{{ cs_resource_prefix }}-prj"
|
||||
|
@ -77,6 +113,19 @@
|
|||
- prj.name == "{{ cs_resource_prefix }}-prj"
|
||||
- prj.state == "Active"
|
||||
|
||||
- name: test delete project in check mode
|
||||
cs_project:
|
||||
name: "{{ cs_resource_prefix }}-prj"
|
||||
state: absent
|
||||
register: prj
|
||||
check_mode: true
|
||||
- name: verify test delete project in check mode
|
||||
assert:
|
||||
that:
|
||||
- prj|changed
|
||||
- prj.name == "{{ cs_resource_prefix }}-prj"
|
||||
- prj.state == "Active"
|
||||
|
||||
- name: test delete project
|
||||
cs_project:
|
||||
name: "{{ cs_resource_prefix }}-prj"
|
||||
|
|
|
@ -15,6 +15,35 @@
|
|||
- rl.limit == 20
|
||||
- rl.resource_type == "cpu"
|
||||
|
||||
- name: setup cpu limits for domain
|
||||
cs_resourcelimit:
|
||||
type: cpu
|
||||
limit: -1
|
||||
domain: "{{ cs_resource_prefix }}-domain"
|
||||
register: rl
|
||||
- name: verify setup cpu limits for domain
|
||||
assert:
|
||||
that:
|
||||
- rl|success
|
||||
- rl.domain == "{{ cs_resource_prefix }}-domain"
|
||||
- rl.limit == -1
|
||||
- rl.resource_type == "cpu"
|
||||
|
||||
- name: set cpu limits for domain in check mode
|
||||
cs_resourcelimit:
|
||||
type: cpu
|
||||
limit: 12
|
||||
domain: "{{ cs_resource_prefix }}-domain"
|
||||
register: rl
|
||||
check_mode: true
|
||||
- name: verify set cpu limits for domain in check mode
|
||||
assert:
|
||||
that:
|
||||
- rl|changed
|
||||
- rl.domain == "{{ cs_resource_prefix }}-domain"
|
||||
- rl.limit == -1
|
||||
- rl.resource_type == "cpu"
|
||||
|
||||
- name: set cpu limits for domain
|
||||
cs_resourcelimit:
|
||||
type: cpu
|
||||
|
@ -43,6 +72,23 @@
|
|||
- rl.limit == 12
|
||||
- rl.resource_type == "cpu"
|
||||
|
||||
- name: set cpu limits for account in check mode
|
||||
cs_resourcelimit:
|
||||
type: cpu
|
||||
limit: 10
|
||||
account: "{{ cs_resource_prefix }}_user"
|
||||
domain: "{{ cs_resource_prefix }}-domain"
|
||||
register: rl
|
||||
check_mode: true
|
||||
- name: verify set cpu limits for account in check mode
|
||||
assert:
|
||||
that:
|
||||
- rl|changed
|
||||
- rl.domain == "{{ cs_resource_prefix }}-domain"
|
||||
- rl.account == "{{ cs_resource_prefix }}_user"
|
||||
- rl.limit == 20
|
||||
- rl.resource_type == "cpu"
|
||||
|
||||
- name: set cpu limits for account
|
||||
cs_resourcelimit:
|
||||
type: cpu
|
||||
|
|
|
@ -15,6 +15,21 @@
|
|||
- rl.limit == 20
|
||||
- rl.resource_type == "instance"
|
||||
|
||||
- name: set instance limits for domain in check mode
|
||||
cs_resourcelimit:
|
||||
type: instance
|
||||
limit: 12
|
||||
domain: "{{ cs_resource_prefix }}-domain"
|
||||
register: rl
|
||||
check_mode: true
|
||||
- name: verify set instance limits for domain in check mode
|
||||
assert:
|
||||
that:
|
||||
- rl|changed
|
||||
- rl.domain == "{{ cs_resource_prefix }}-domain"
|
||||
- rl.limit == 20
|
||||
- rl.resource_type == "instance"
|
||||
|
||||
- name: set instance limits for domain
|
||||
cs_resourcelimit:
|
||||
type: instance
|
||||
|
@ -43,6 +58,23 @@
|
|||
- rl.limit == 12
|
||||
- rl.resource_type == "instance"
|
||||
|
||||
- name: set instance limits for account in check mode
|
||||
cs_resourcelimit:
|
||||
type: instance
|
||||
limit: 10
|
||||
account: "{{ cs_resource_prefix }}_user"
|
||||
domain: "{{ cs_resource_prefix }}-domain"
|
||||
register: rl
|
||||
check_mode: true
|
||||
- name: verify set instance limits for account in check mode
|
||||
assert:
|
||||
that:
|
||||
- rl|changed
|
||||
- rl.domain == "{{ cs_resource_prefix }}-domain"
|
||||
- rl.account == "{{ cs_resource_prefix }}_user"
|
||||
- rl.limit != 10
|
||||
- rl.resource_type == "instance"
|
||||
|
||||
- name: set instance limits for account
|
||||
cs_resourcelimit:
|
||||
type: instance
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
- name: setup resource limits domain
|
||||
cs_resourcelimit:
|
||||
type: instance
|
||||
limit: 20
|
||||
limit: 10
|
||||
domain: "{{ cs_resource_prefix }}-domain"
|
||||
register: rl
|
||||
- name: verify setup resource limits domain
|
||||
|
@ -55,6 +55,49 @@
|
|||
that:
|
||||
- rl|success
|
||||
- rl.domain == "{{ cs_resource_prefix }}-domain"
|
||||
- rl.limit == 10
|
||||
|
||||
- name: set resource limits domain to 20 in check mode
|
||||
cs_resourcelimit:
|
||||
type: instance
|
||||
limit: 20
|
||||
domain: "{{ cs_resource_prefix }}-domain"
|
||||
register: rl
|
||||
check_mode: true
|
||||
- name: verify setup resource limits domain to 20 in check mode
|
||||
assert:
|
||||
that:
|
||||
- rl|success
|
||||
- rl|changed
|
||||
- rl.domain == "{{ cs_resource_prefix }}-domain"
|
||||
- rl.limit == 10
|
||||
|
||||
- name: set resource limits domain to 20
|
||||
cs_resourcelimit:
|
||||
type: instance
|
||||
limit: 20
|
||||
domain: "{{ cs_resource_prefix }}-domain"
|
||||
register: rl
|
||||
- name: verify setup resource limits domain to 20
|
||||
assert:
|
||||
that:
|
||||
- rl|success
|
||||
- rl|changed
|
||||
- rl.domain == "{{ cs_resource_prefix }}-domain"
|
||||
- rl.limit == 20
|
||||
|
||||
- name: set resource limits domain to 20 idempotence
|
||||
cs_resourcelimit:
|
||||
type: instance
|
||||
limit: 20
|
||||
domain: "{{ cs_resource_prefix }}-domain"
|
||||
register: rl
|
||||
- name: verify setup resource limits domain to 20 idempotence
|
||||
assert:
|
||||
that:
|
||||
- rl|success
|
||||
- not rl|changed
|
||||
- rl.domain == "{{ cs_resource_prefix }}-domain"
|
||||
- rl.limit == 20
|
||||
|
||||
- include: instance.yml
|
||||
|
|
|
@ -17,6 +17,16 @@
|
|||
- sg|failed
|
||||
- "sg.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test present security group in check mode
|
||||
cs_securitygroup: name={{ cs_resource_prefix }}_sg
|
||||
register: sg
|
||||
check_mode: true
|
||||
- name: verify results of create security group in check mode
|
||||
assert:
|
||||
that:
|
||||
- sg|success
|
||||
- sg|changed
|
||||
|
||||
- name: test present security group
|
||||
cs_securitygroup: name={{ cs_resource_prefix }}_sg
|
||||
register: sg
|
||||
|
@ -37,6 +47,17 @@
|
|||
- not sg|changed
|
||||
- sg.name == "{{ cs_resource_prefix }}_sg"
|
||||
|
||||
- name: test absent security group in check mode
|
||||
cs_securitygroup: name={{ cs_resource_prefix }}_sg state=absent
|
||||
register: sg
|
||||
check_mode: true
|
||||
- name: verify results of absent security group in check mode
|
||||
assert:
|
||||
that:
|
||||
- sg|success
|
||||
- sg|changed
|
||||
- sg.name == "{{ cs_resource_prefix }}_sg"
|
||||
|
||||
- name: test absent security group
|
||||
cs_securitygroup: name={{ cs_resource_prefix }}_sg state=absent
|
||||
register: sg
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
---
|
||||
- name: test remove http range rule in check mode
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
start_port: 8000
|
||||
end_port: 8888
|
||||
cidr: 1.2.3.4/32
|
||||
state: absent
|
||||
register: sg_rule
|
||||
check_mode: true
|
||||
- name: verify create http range rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- sg_rule|success
|
||||
- sg_rule|changed
|
||||
- sg_rule.type == 'ingress'
|
||||
- sg_rule.security_group == 'default'
|
||||
- sg_rule.protocol == 'tcp'
|
||||
- sg_rule.start_port == 8000
|
||||
- sg_rule.end_port == 8888
|
||||
- sg_rule.cidr == '1.2.3.4/32'
|
||||
|
||||
- name: test remove http range rule
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
|
@ -32,6 +54,28 @@
|
|||
- sg_rule|success
|
||||
- not sg_rule|changed
|
||||
|
||||
- name: test remove single port udp rule in check mode
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
port: 5353
|
||||
protocol: udp
|
||||
type: egress
|
||||
user_security_group: '{{ cs_resource_prefix }}_sg'
|
||||
state: absent
|
||||
register: sg_rule
|
||||
check_mode: true
|
||||
- name: verify remove single port udp rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- sg_rule|success
|
||||
- sg_rule|changed
|
||||
- sg_rule.type == 'egress'
|
||||
- sg_rule.security_group == 'default'
|
||||
- sg_rule.protocol == 'udp'
|
||||
- sg_rule.start_port == 5353
|
||||
- sg_rule.end_port == 5353
|
||||
- sg_rule.user_security_group == '{{ cs_resource_prefix }}_sg'
|
||||
|
||||
- name: test remove single port udp rule
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
|
@ -68,6 +112,28 @@
|
|||
- sg_rule|success
|
||||
- not sg_rule|changed
|
||||
|
||||
- name: test remove icmp rule in check mode
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
protocol: icmp
|
||||
type: ingress
|
||||
icmp_type: -1
|
||||
icmp_code: -1
|
||||
state: absent
|
||||
register: sg_rule
|
||||
check_mode: true
|
||||
- name: verify icmp rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- sg_rule|success
|
||||
- sg_rule|changed
|
||||
- sg_rule.type == 'ingress'
|
||||
- sg_rule.security_group == 'default'
|
||||
- sg_rule.cidr == '0.0.0.0/0'
|
||||
- sg_rule.protocol == 'icmp'
|
||||
- sg_rule.icmp_code == -1
|
||||
- sg_rule.icmp_type == -1
|
||||
|
||||
- name: test remove icmp rule
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
---
|
||||
- name: test create http range rule in check mode
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
start_port: 8000
|
||||
end_port: 8888
|
||||
cidr: 1.2.3.4/32
|
||||
register: sg_rule
|
||||
check_mode: true
|
||||
- name: verify create http range rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- sg_rule|success
|
||||
- sg_rule|changed
|
||||
|
||||
- name: test create http range rule
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
|
@ -36,6 +51,21 @@
|
|||
- sg_rule.end_port == 8888
|
||||
- sg_rule.cidr == '1.2.3.4/32'
|
||||
|
||||
- name: test create single port udp rule in check mode
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
port: 5353
|
||||
protocol: udp
|
||||
type: egress
|
||||
user_security_group: '{{ cs_resource_prefix }}_sg'
|
||||
register: sg_rule
|
||||
check_mode: true
|
||||
- name: verify create single port udp rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- sg_rule|success
|
||||
- sg_rule|changed
|
||||
|
||||
- name: test create single port udp rule
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
|
@ -77,6 +107,21 @@
|
|||
- sg_rule.end_port == 5353
|
||||
- sg_rule.user_security_group == '{{ cs_resource_prefix }}_sg'
|
||||
|
||||
- name: test icmp rule in check mode
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
protocol: icmp
|
||||
type: ingress
|
||||
icmp_type: -1
|
||||
icmp_code: -1
|
||||
register: sg_rule
|
||||
check_mode: true
|
||||
- name: verify icmp rule in check mode
|
||||
assert:
|
||||
that:
|
||||
- sg_rule|success
|
||||
- sg_rule|changed
|
||||
|
||||
- name: test icmp rule
|
||||
cs_securitygroup_rule:
|
||||
security_group: default
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
- name: setup cleanup
|
||||
cs_sshkeypair: name=second-sshkey state=absent
|
||||
|
||||
|
||||
- name: test fail on missing name
|
||||
action: cs_sshkeypair
|
||||
ignore_errors: true
|
||||
|
@ -16,6 +15,17 @@
|
|||
- sshkey|failed
|
||||
- "sshkey.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test ssh key creation in check mode
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
register: sshkey
|
||||
check_mode: true
|
||||
- name: verify results of ssh key creation in check mode
|
||||
assert:
|
||||
that:
|
||||
- sshkey|success
|
||||
- sshkey|changed
|
||||
|
||||
- name: test ssh key creation
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
|
@ -42,6 +52,21 @@
|
|||
- sshkey2.private_key is not defined
|
||||
- sshkey2.name == "first-sshkey"
|
||||
|
||||
- name: test replace ssh public key in check mode
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
register: sshkey2
|
||||
check_mode: true
|
||||
- name: verify results of replace ssh public key in check mode
|
||||
assert:
|
||||
that:
|
||||
- sshkey2|success
|
||||
- sshkey2|changed
|
||||
- sshkey2.fingerprint is defined and sshkey2.fingerprint == sshkey.fingerprint
|
||||
- sshkey2.private_key is not defined
|
||||
- sshkey2.name == "first-sshkey"
|
||||
|
||||
- name: test replace ssh public key
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
|
@ -88,6 +113,19 @@
|
|||
- sshkey.private_key is not defined
|
||||
- sshkey.name == "second-sshkey"
|
||||
|
||||
- name: test ssh key absent in check mode
|
||||
cs_sshkeypair: name=second-sshkey state=absent
|
||||
register: sshkey5
|
||||
check_mode: true
|
||||
- name: verify result of key absent in check mode
|
||||
assert:
|
||||
that:
|
||||
- sshkey5|success
|
||||
- sshkey5|changed
|
||||
- sshkey5.fingerprint is defined and sshkey5.fingerprint == sshkey3.fingerprint
|
||||
- sshkey5.private_key is not defined
|
||||
- sshkey5.name == "second-sshkey"
|
||||
|
||||
- name: test ssh key absent
|
||||
cs_sshkeypair: name=second-sshkey state=absent
|
||||
register: sshkey5
|
||||
|
|
|
@ -28,6 +28,22 @@
|
|||
- user|failed
|
||||
- 'user.msg == "missing required arguments: account,email,password,first_name,last_name"'
|
||||
|
||||
- name: test create user in check mode
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
password: "{{ cs_resource_prefix }}_password"
|
||||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
account: "admin"
|
||||
register: user
|
||||
check_mode: true
|
||||
- name: verify results of create user in check mode
|
||||
assert:
|
||||
that:
|
||||
- user|success
|
||||
- user|changed
|
||||
|
||||
- name: test create user
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -74,6 +90,30 @@
|
|||
- user.state == "enabled"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test update user in check mode
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
password: "{{ cs_resource_prefix }}_password"
|
||||
last_name: "{{ cs_resource_prefix }}_last_name1"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name1"
|
||||
email: "{{ cs_resource_prefix }}@example.com1"
|
||||
account: "admin"
|
||||
register: user
|
||||
check_mode: true
|
||||
- name: verify results of update user in check mode
|
||||
assert:
|
||||
that:
|
||||
- user|success
|
||||
- user|changed
|
||||
- user.username == "{{ cs_resource_prefix }}_user"
|
||||
- user.first_name == "{{ cs_resource_prefix }}_first_name"
|
||||
- user.last_name == "{{ cs_resource_prefix }}_last_name"
|
||||
- user.email == "{{ cs_resource_prefix }}@example.com"
|
||||
- user.account_type == "root_admin"
|
||||
- user.account == "admin"
|
||||
- user.state == "enabled"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test update user
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -120,6 +160,23 @@
|
|||
- user.state == "enabled"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test lock user in check mode
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
state: locked
|
||||
register: user
|
||||
check_mode: true
|
||||
- name: verify results of lock user in check mode
|
||||
assert:
|
||||
that:
|
||||
- user|success
|
||||
- user|changed
|
||||
- user.username == "{{ cs_resource_prefix }}_user"
|
||||
- user.account_type == "root_admin"
|
||||
- user.account == "admin"
|
||||
- user.state != "locked"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test lock user
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -152,6 +209,23 @@
|
|||
- user.state == "locked"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test disable user in check mode
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
state: disabled
|
||||
register: user
|
||||
check_mode: true
|
||||
- name: verify results of disable user in check mode
|
||||
assert:
|
||||
that:
|
||||
- user|success
|
||||
- user|changed
|
||||
- user.username == "{{ cs_resource_prefix }}_user"
|
||||
- user.account_type == "root_admin"
|
||||
- user.account == "admin"
|
||||
- user.state != "disabled"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test disable user
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -184,6 +258,23 @@
|
|||
- user.state == "disabled"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test lock disabled user in check mode
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
state: locked
|
||||
register: user
|
||||
check_mode: true
|
||||
- name: verify results of lock disabled user in check mode
|
||||
assert:
|
||||
that:
|
||||
- user|success
|
||||
- user|changed
|
||||
- user.username == "{{ cs_resource_prefix }}_user"
|
||||
- user.account_type == "root_admin"
|
||||
- user.account == "admin"
|
||||
- user.state == "disabled"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test lock disabled user
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -216,6 +307,23 @@
|
|||
- user.state == "locked"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test enable user in check mode
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
state: enabled
|
||||
register: user
|
||||
check_mode: true
|
||||
- name: verify results of enable user in check mode
|
||||
assert:
|
||||
that:
|
||||
- user|success
|
||||
- user|changed
|
||||
- user.username == "{{ cs_resource_prefix }}_user"
|
||||
- user.account_type == "root_admin"
|
||||
- user.account == "admin"
|
||||
- user.state != "enabled"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test enable user
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
|
@ -248,6 +356,23 @@
|
|||
- user.state == "enabled"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test remove user in check mode
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
state: absent
|
||||
register: user
|
||||
check_mode: true
|
||||
- name: verify results of remove user in check mode
|
||||
assert:
|
||||
that:
|
||||
- user|success
|
||||
- user|changed
|
||||
- user.username == "{{ cs_resource_prefix }}_user"
|
||||
- user.account_type == "root_admin"
|
||||
- user.account == "admin"
|
||||
- user.state == "enabled"
|
||||
- user.domain == "ROOT"
|
||||
|
||||
- name: test remove user
|
||||
cs_user:
|
||||
username: "{{ cs_resource_prefix }}_user"
|
||||
|
|
|
@ -31,6 +31,18 @@
|
|||
- snap|failed
|
||||
- 'snap.msg.startswith("missing required arguments: ")'
|
||||
|
||||
- name: test create snapshot in check mode
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
snapshot_memory: yes
|
||||
register: snap
|
||||
check_mode: true
|
||||
- name: verify test create snapshot in check mode
|
||||
assert:
|
||||
that:
|
||||
- snap|changed
|
||||
|
||||
- name: test create snapshot
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
|
@ -55,6 +67,19 @@
|
|||
- not snap|changed
|
||||
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
||||
|
||||
- name: test revert snapshot in check mode
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
state: revert
|
||||
register: snap
|
||||
check_mode: true
|
||||
- name: verify test revert snapshot in check mode
|
||||
assert:
|
||||
that:
|
||||
- snap|changed
|
||||
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
||||
|
||||
- name: test revert snapshot
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
|
@ -67,6 +92,19 @@
|
|||
- snap|changed
|
||||
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
||||
|
||||
- name: test remove snapshot in check mode
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
||||
state: absent
|
||||
register: snap
|
||||
check_mode: true
|
||||
- name: verify test remove snapshot in check mode
|
||||
assert:
|
||||
that:
|
||||
- snap|changed
|
||||
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
||||
|
||||
- name: test remove snapshot
|
||||
cs_vmsnapshot:
|
||||
name: "{{ cs_resource_prefix }}_snapshot"
|
||||
|
|
|
@ -39,6 +39,18 @@
|
|||
- vol|failed
|
||||
- "vol.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test create volume in check mode
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
disk_offering: "{{ test_cs_disk_offering_1 }}"
|
||||
size: 20
|
||||
register: vol
|
||||
check_mode: true
|
||||
- name: verify results test create volume in check mode
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
|
||||
- name: test create volume
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
|
@ -65,6 +77,21 @@
|
|||
- vol.size == 20 * 1024 ** 3
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
|
||||
- name: test shrink volume in check mode
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
disk_offering: "{{ test_cs_disk_offering_1 }}"
|
||||
size: 10
|
||||
shrink_ok: yes
|
||||
register: vol
|
||||
check_mode: true
|
||||
- name: verify results test create volume in check mode
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
- vol.size == 20 * 1024 ** 3
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
|
||||
- name: test shrink volume
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
|
@ -93,6 +120,20 @@
|
|||
- vol.size == 10 * 1024 ** 3
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
|
||||
- name: test attach volume in check mode
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
vm: "{{ test_cs_instance_1 }}"
|
||||
state: attached
|
||||
register: vol
|
||||
check_mode: true
|
||||
- name: verify results test attach volume in check mode
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
- vol.attached is not defined
|
||||
|
||||
- name: test attach volume
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
|
@ -121,6 +162,21 @@
|
|||
- vol.vm == "{{ test_cs_instance_1 }}"
|
||||
- vol.attached is defined
|
||||
|
||||
- name: test attach attached volume to another vm in check mdoe
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
vm: "{{ test_cs_instance_2 }}"
|
||||
state: attached
|
||||
register: vol
|
||||
check_mode: true
|
||||
- name: verify results test attach attached volume to another vm in check mode
|
||||
assert:
|
||||
that:
|
||||
- vol|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"
|
||||
|
@ -149,6 +205,19 @@
|
|||
- vol.vm == "{{ test_cs_instance_2 }}"
|
||||
- vol.attached is defined
|
||||
|
||||
- name: test detach volume in check mode
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
state: detached
|
||||
register: vol
|
||||
check_mode: true
|
||||
- name: verify results test detach volume in check mdoe
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
- vol.attached is defined
|
||||
|
||||
- name: test detach volume
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
|
@ -173,6 +242,18 @@
|
|||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
- vol.attached is undefined
|
||||
|
||||
- name: test delete volume in check mode
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
state: absent
|
||||
register: vol
|
||||
check_mode: true
|
||||
- name: verify results test create volume in check mode
|
||||
assert:
|
||||
that:
|
||||
- vol|changed
|
||||
- vol.name == "{{ cs_resource_prefix }}_vol"
|
||||
|
||||
- name: test delete volume
|
||||
cs_volume:
|
||||
name: "{{ cs_resource_prefix }}_vol"
|
||||
|
|
|
@ -33,6 +33,20 @@
|
|||
- vpc|failed
|
||||
- 'vpc.msg == "state is present but the following are missing: cidr"'
|
||||
|
||||
- name: test create vpc in check mode
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
display_text: "{{ cs_resource_prefix }}_display_text"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
check_mode: true
|
||||
- name: verify test create vpc in check mode
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- vpc|changed
|
||||
|
||||
- name: test create vpc
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
|
@ -80,6 +94,23 @@
|
|||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test update vpc in check mode
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
display_text: "{{ cs_resource_prefix }}_display_text2"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
check_mode: true
|
||||
- name: verify test update vpc in check mode
|
||||
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 update vpc
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
|
@ -112,6 +143,22 @@
|
|||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text2"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test create network in vpc in check mode
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network_offering: Offering for Isolated Vpc networks with Source Nat service enabled
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
gateway: 10.10.0.1
|
||||
netmask: 255.255.255.0
|
||||
register: vpc_net
|
||||
check_mode: true
|
||||
- name: verify test create network in vpc in check mode
|
||||
assert:
|
||||
that:
|
||||
- vpc_net|success
|
||||
- vpc_net|changed
|
||||
|
||||
- name: test create network in vpc
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
|
@ -144,6 +191,21 @@
|
|||
- not vpc_net|changed
|
||||
- vpc_net.name == "{{ cs_resource_prefix }}_net_vpc"
|
||||
|
||||
- name: test create instance in vpc in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
template: "{{ cs_common_template }}"
|
||||
service_offering: "{{ cs_common_service_offering }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify test create instance in vpc in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
|
||||
- name: test create instance in vpc
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
|
@ -184,6 +246,21 @@
|
|||
register: ip_address
|
||||
when: instance.public_ip is undefined
|
||||
|
||||
- name: test static nat in vpc in check mode
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
register: static_nat
|
||||
check_mode: true
|
||||
- name: verify test static nat in vpc in check mode
|
||||
assert:
|
||||
that:
|
||||
- static_nat|success
|
||||
- static_nat|changed
|
||||
|
||||
- name: test static nat in vpc
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
|
@ -212,6 +289,22 @@
|
|||
- static_nat|success
|
||||
- not static_nat|changed
|
||||
|
||||
- name: test remove static nat in vpc in check mode
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
state: absent
|
||||
register: static_nat
|
||||
check_mode: true
|
||||
- name: verify test remove static nat in vpc in check mode
|
||||
assert:
|
||||
that:
|
||||
- static_nat|success
|
||||
- static_nat|changed
|
||||
|
||||
- name: test remove static nat in vpc
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
|
@ -242,6 +335,23 @@
|
|||
- static_nat|success
|
||||
- not static_nat|changed
|
||||
|
||||
- name: test create port forwarding in vpc in check mode
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: port_forward
|
||||
check_mode: true
|
||||
- name: verify test create port forwarding in vpc in check mode
|
||||
assert:
|
||||
that:
|
||||
- port_forward|success
|
||||
- port_forward|changed
|
||||
|
||||
- name: test create port forwarding in vpc
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
|
@ -274,6 +384,24 @@
|
|||
- port_forward|success
|
||||
- not port_forward|changed
|
||||
|
||||
- name: test remove port forwarding in vpc in check mode
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: port_forward
|
||||
check_mode: true
|
||||
- name: verify test remove port forwarding in vpc in check mode
|
||||
assert:
|
||||
that:
|
||||
- port_forward|success
|
||||
- port_forward|changed
|
||||
|
||||
- name: test remove port forwarding in vpc
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
|
@ -316,12 +444,27 @@
|
|||
ip_address: "{{ ip_address.ip_address }}"
|
||||
state: absent
|
||||
register: ip_address_removed
|
||||
- name: verify test remove static nat in vpc idempotence
|
||||
- name: verify test remove ip address from vpc
|
||||
assert:
|
||||
that:
|
||||
- ip_address_removed|success
|
||||
- ip_address_removed|changed
|
||||
|
||||
- name: test remove instance in vpc in check mdoe
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: expunged
|
||||
register: instance
|
||||
check_mode: true
|
||||
- name: verify test remove instance in vpc in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.name == "{{ cs_resource_prefix }}-vm-vpc"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: test remove instance in vpc
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
|
@ -348,6 +491,21 @@
|
|||
- instance|success
|
||||
- not instance|changed
|
||||
|
||||
- name: test remove network in vpc in check mode
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
register: vpc_net
|
||||
check_mode: true
|
||||
- name: verify test remove network in vpc in check mode
|
||||
assert:
|
||||
that:
|
||||
- vpc_net|success
|
||||
- vpc_net|changed
|
||||
- vpc_net.name == "{{ cs_resource_prefix }}_net_vpc"
|
||||
|
||||
- name: test remove network in vpc
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
|
@ -375,6 +533,22 @@
|
|||
- vpc_net|success
|
||||
- not vpc_net|changed
|
||||
|
||||
- name: test remove vpc in check mode
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
check_mode: true
|
||||
- name: verify test remove vpc in check mode
|
||||
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
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
|
|
|
@ -32,6 +32,18 @@
|
|||
- vpn_gateway|failed
|
||||
- "vpn_gateway.msg.startswith('missing required arguments: ')"
|
||||
|
||||
- name: test create vpn gateway in check mode
|
||||
cs_vpn_gateway:
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpn_gateway
|
||||
check_mode: true
|
||||
- name: verify test create vpn gateway in check mode
|
||||
assert:
|
||||
that:
|
||||
- vpn_gateway|success
|
||||
- vpn_gateway|changed
|
||||
|
||||
- name: test create vpn gateway
|
||||
cs_vpn_gateway:
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
|
@ -56,6 +68,20 @@
|
|||
- not vpn_gateway|changed
|
||||
- vpn_gateway.vpc == "{{ cs_resource_prefix }}_vpc"
|
||||
|
||||
- name: test remove vpn gateway in check mode
|
||||
cs_vpn_gateway:
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: vpn_gateway
|
||||
check_mode: true
|
||||
- name: verify test remove vpn gateway in check mode
|
||||
assert:
|
||||
that:
|
||||
- vpn_gateway|success
|
||||
- vpn_gateway|changed
|
||||
- vpn_gateway.vpc == "{{ cs_resource_prefix }}_vpc"
|
||||
|
||||
- name: test remove vpn gateway
|
||||
cs_vpn_gateway:
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
|
|
Loading…
Reference in a new issue