mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02: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
|
@ -242,11 +242,6 @@ rackspace: $(CREDENTIALS_FILE)
|
|||
CLOUD_RESOURCE_PREFIX="$(CLOUD_RESOURCE_PREFIX)" make rackspace_cleanup ; \
|
||||
exit $$RC;
|
||||
|
||||
cloudstack:
|
||||
ansible-playbook cloudstack.yml -i $(INVENTORY) -e @$(VARS_FILE) -e "resource_prefix=$(CLOUD_RESOURCE_PREFIX)" -v $(TEST_FLAGS) ; \
|
||||
RC=$$? ; \
|
||||
exit $$RC;
|
||||
|
||||
exoscale:
|
||||
ansible-playbook exoscale.yml -i $(INVENTORY) -e @$(VARS_FILE) -v $(TEST_FLAGS) ; \
|
||||
RC=$$? ; \
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
connection: local
|
||||
gather_facts: no
|
||||
tags:
|
||||
- cloudstack
|
||||
vars:
|
||||
cs_resource_prefix: "{{ resource_prefix | default('cs-') }}"
|
||||
roles:
|
||||
- { role: test_cs_user, tags: test_cs_user }
|
||||
- { role: test_cs_project, tags: test_cs_project }
|
||||
- { role: test_cs_iso, tags: test_cs_iso }
|
||||
- { role: test_cs_domain, tags: test_cs_domain }
|
||||
- { role: test_cs_vmsnapshot, tags: test_cs_vmsnapshot }
|
||||
- { role: test_cs_sshkeypair, tags: test_cs_sshkeypair }
|
||||
- { role: test_cs_affinitygroup, tags: test_cs_affinitygroup }
|
||||
- { role: test_cs_securitygroup, tags: test_cs_securitygroup }
|
||||
- { role: test_cs_securitygroup_rule, tags: test_cs_securitygroup_rule }
|
||||
- { role: test_cs_instance, tags: test_cs_instance }
|
||||
- { role: test_cs_instancegroup, tags: test_cs_instancegroup }
|
||||
- { role: test_cs_portforward, tags: test_cs_portforward }
|
||||
- { role: test_cs_account, tags: test_cs_account }
|
||||
- { role: test_cs_firewall, tags: test_cs_firewall }
|
||||
- { role: test_cs_loadbalancer_rule, tags: test_cs_loadbalancer_rule }
|
||||
- { role: test_cs_volume, tags: test_cs_volume }
|
||||
- { role: test_cs_instance_facts, tags: test_cs_instance_facts }
|
||||
- { role: test_cs_configuration, tags: test_cs_configuration }
|
||||
- { role: test_cs_pod, tags: test_cs_pod }
|
||||
- { role: test_cs_cluster, tags: test_cs_cluster }
|
||||
- { role: test_cs_resourcelimit, tags: test_cs_resourcelimit }
|
|
@ -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,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -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,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -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,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -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,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,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "{{ cs_resource_prefix }}.local"
|
||||
network_domain: "example.com"
|
||||
register: acc
|
||||
- name: verify results of create account
|
||||
assert:
|
||||
|
@ -44,7 +44,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -57,7 +57,7 @@
|
|||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "{{ cs_resource_prefix }}.local"
|
||||
network_domain: "example.com"
|
||||
register: acc
|
||||
- name: verify results of create account idempotence
|
||||
assert:
|
||||
|
@ -65,7 +65,7 @@
|
|||
- acc|success
|
||||
- not acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -81,7 +81,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -97,7 +97,7 @@
|
|||
- acc|success
|
||||
- not acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -113,7 +113,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "disabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -129,7 +129,7 @@
|
|||
- acc|success
|
||||
- not acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "disabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -145,7 +145,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -161,7 +161,7 @@
|
|||
- acc|success
|
||||
- not acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -177,7 +177,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -193,7 +193,7 @@
|
|||
- acc|success
|
||||
- not acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -209,7 +209,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -233,7 +233,7 @@
|
|||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "{{ cs_resource_prefix }}.local"
|
||||
network_domain: "example.com"
|
||||
state: disabled
|
||||
register: acc
|
||||
- name: verify results of create disabled account
|
||||
|
@ -242,7 +242,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "disabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -258,7 +258,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "disabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -271,7 +271,7 @@
|
|||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "{{ cs_resource_prefix }}.local"
|
||||
network_domain: "example.com"
|
||||
state: locked
|
||||
register: acc
|
||||
- name: verify results of create locked account
|
||||
|
@ -280,7 +280,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -296,7 +296,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "locked"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -309,7 +309,7 @@
|
|||
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||
email: "{{ cs_resource_prefix }}@example.com"
|
||||
network_domain: "{{ cs_resource_prefix }}.local"
|
||||
network_domain: "example.com"
|
||||
state: unlocked
|
||||
register: acc
|
||||
- name: verify results of create unlocked/enabled account
|
||||
|
@ -318,7 +318,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
@ -334,7 +334,7 @@
|
|||
- acc|success
|
||||
- acc|changed
|
||||
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||
- acc.network_domain == "example.com"
|
||||
- acc.account_type == "user"
|
||||
- acc.state == "enabled"
|
||||
- acc.domain == "ROOT"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
5
test/integration/targets/cs_common/defaults/main.yml
Normal file
5
test/integration/targets/cs_common/defaults/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
cs_resource_prefix: "cs-{{ (ansible_date_time.iso8601_micro | to_uuid).split('-')[0] }}"
|
||||
cs_common_template: CentOS 5.6 (64-bit) no GUI (Simulator)
|
||||
cs_common_service_offering: Small Instance
|
||||
cs_common_zone_adv: Sandbox-simulator-advanced
|
3
test/integration/targets/cs_configuration/aliases
Normal file
3
test/integration/targets/cs_configuration/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
test_cs_configuration_storage: PS0-adv
|
||||
test_cs_configuration_cluster: C0-basic
|
||||
test_cs_configuration_account: admin
|
||||
test_cs_configuration_zone: Sandbox-simulator-basic
|
3
test/integration/targets/cs_configuration/meta/main.yml
Normal file
3
test/integration/targets/cs_configuration/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
3
test/integration/targets/cs_firewall/aliases
Normal file
3
test/integration/targets/cs_firewall/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
cs_firewall_ip_address: 10.100.212.5
|
||||
cs_firewall_network: test
|
||||
cs_firewall_network: ansible test
|
3
test/integration/targets/cs_firewall/meta/main.yml
Normal file
3
test/integration/targets/cs_firewall/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
|
@ -1,8 +1,35 @@
|
|||
---
|
||||
- name: network setup
|
||||
cs_network:
|
||||
name: "{{ cs_firewall_network }}"
|
||||
network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService
|
||||
network_domain: example.com
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: net
|
||||
- name: verify network setup
|
||||
assert:
|
||||
that:
|
||||
- net|success
|
||||
|
||||
- name: public ip address setup
|
||||
cs_ip_address:
|
||||
network: ansible test
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: ip_address
|
||||
- name: verify public ip address setup
|
||||
assert:
|
||||
that:
|
||||
- ip_address|success
|
||||
|
||||
- name: set ip address as fact
|
||||
set_fact:
|
||||
cs_firewall_ip_address: "{{ ip_address.ip_address }}"
|
||||
|
||||
- name: setup 80
|
||||
cs_firewall:
|
||||
port: 80
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify setup
|
||||
|
@ -17,6 +44,7 @@
|
|||
start_port: 5300
|
||||
end_port: 5333
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify setup
|
||||
|
@ -29,6 +57,7 @@
|
|||
network: "{{ cs_firewall_network }}"
|
||||
protocol: all
|
||||
type: egress
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify setup
|
||||
|
@ -44,34 +73,37 @@
|
|||
assert:
|
||||
that:
|
||||
- fw|failed
|
||||
- fw.msg == "missing required argument for protocol 'tcp': start_port or end_port"
|
||||
- "fw.msg == 'one of the following is required: ip_address,network'"
|
||||
|
||||
- name: test fail if missing params ip_address ingress
|
||||
- name: test fail if missing params
|
||||
cs_firewall:
|
||||
port: 80
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing params ip_address
|
||||
- name: verify results of fail if missing params
|
||||
assert:
|
||||
that:
|
||||
- fw|failed
|
||||
- fw.msg == "missing required argument for type ingress: ip_address"
|
||||
- "fw.msg == \"missing required argument for protocol 'tcp': start_port or end_port\""
|
||||
|
||||
- name: test fail if missing params network egress
|
||||
cs_firewall:
|
||||
type: egress
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing params ip_address
|
||||
assert:
|
||||
that:
|
||||
- fw|failed
|
||||
- fw.msg == "missing required argument for type egress: network"
|
||||
- "fw.msg == 'one of the following is required: ip_address,network'"
|
||||
|
||||
- name: test present firewall rule ingress 80
|
||||
cs_firewall:
|
||||
port: 80
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
- name: verify results of present firewall rule ingress 80
|
||||
assert:
|
||||
|
@ -89,6 +121,7 @@
|
|||
cs_firewall:
|
||||
port: 80
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
- name: verify results of present firewall rule ingress 80 idempotence
|
||||
assert:
|
||||
|
@ -109,6 +142,7 @@
|
|||
start_port: 5300
|
||||
end_port: 5333
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
- name: verify results of present firewall rule ingress 5300
|
||||
assert:
|
||||
|
@ -129,6 +163,7 @@
|
|||
start_port: 5300
|
||||
end_port: 5333
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
- name: verify results of present firewall rule ingress 5300 idempotence
|
||||
assert:
|
||||
|
@ -147,6 +182,7 @@
|
|||
network: "{{ cs_firewall_network }}"
|
||||
protocol: all
|
||||
type: egress
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
- name: verify results of present firewall rule egress all
|
||||
assert:
|
||||
|
@ -163,6 +199,7 @@
|
|||
network: "{{ cs_firewall_network }}"
|
||||
protocol: all
|
||||
type: egress
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
- name: verify results of present firewall rule egress all idempotence
|
||||
assert:
|
||||
|
@ -178,6 +215,7 @@
|
|||
cs_firewall:
|
||||
port: 80
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify results of absent firewall rule ingress 80
|
||||
|
@ -196,6 +234,7 @@
|
|||
cs_firewall:
|
||||
port: 80
|
||||
ip_address: "{{ cs_firewall_ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify results of absent firewall rule ingress 80 idempotence
|
||||
|
@ -211,6 +250,7 @@
|
|||
start_port: 5300
|
||||
end_port: 5333
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify results of absent firewall rule ingress 5300
|
||||
|
@ -232,6 +272,7 @@
|
|||
start_port: 5300
|
||||
end_port: 5333
|
||||
cidr: 1.2.3.4/24
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify results of absent firewall rule ingress 5300 idempotence
|
||||
|
@ -246,6 +287,7 @@
|
|||
protocol: all
|
||||
type: egress
|
||||
state: absent
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: fw
|
||||
- name: verify results of absent firewall rule egress all
|
||||
assert:
|
||||
|
@ -262,6 +304,7 @@
|
|||
network: "{{ cs_firewall_network }}"
|
||||
protocol: all
|
||||
type: egress
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: fw
|
||||
- name: verify results of absent firewall rule egress all idempotence
|
||||
|
@ -269,3 +312,14 @@
|
|||
that:
|
||||
- fw|success
|
||||
- not fw|changed
|
||||
|
||||
- name: network cleanup
|
||||
cs_network:
|
||||
name: "{{ cs_firewall_network }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: net
|
||||
- name: verify network cleanup
|
||||
assert:
|
||||
that:
|
||||
- net|success
|
3
test/integration/targets/cs_instance/aliases
Normal file
3
test/integration/targets/cs_instance/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
instance_number: 1
|
||||
test_cs_instance_template: CentOS 5.3(64-bit) no GUI (Simulator)
|
||||
test_cs_instance_template: "{{ cs_common_template }}"
|
||||
test_cs_instance_offering_1: Small Instance
|
||||
test_cs_instance_offering_2: Medium Instance
|
3
test/integration/targets/cs_instance/meta/main.yml
Normal file
3
test/integration/targets/cs_instance/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
3
test/integration/targets/cs_instance_facts/aliases
Normal file
3
test/integration/targets/cs_instance_facts/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
test_cs_instance_template: "{{ cs_common_template }}"
|
||||
test_cs_instance_offering_1: Small Instance
|
3
test/integration/targets/cs_instance_facts/meta/main.yml
Normal file
3
test/integration/targets/cs_instance_facts/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
3
test/integration/targets/cs_iso/aliases
Normal file
3
test/integration/targets/cs_iso/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
3
test/integration/targets/cs_iso/meta/main.yml
Normal file
3
test/integration/targets/cs_iso/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
3
test/integration/targets/cs_loadbalancer_rule/aliases
Normal file
3
test/integration/targets/cs_loadbalancer_rule/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
|
@ -1,25 +1,53 @@
|
|||
---
|
||||
- name: setup
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify setup
|
||||
- name: test create network for lb
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_lb"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network_offering: Offering for Isolated networks with Source Nat service enabled
|
||||
register: lb_net
|
||||
- name: verify test create network for lb
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- lb_net|success
|
||||
- lb_net|changed
|
||||
- lb_net.name == "{{ cs_resource_prefix }}_net_lb"
|
||||
|
||||
- name: setup instance
|
||||
- name: setup instance in lb
|
||||
cs_instance:
|
||||
name: "{{ test_cs_lb_member }}"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
name: "{{ cs_resource_prefix }}-vm-lb"
|
||||
template: "{{ cs_common_template }}"
|
||||
service_offering: "{{ cs_common_service_offering }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network: "{{ cs_resource_prefix }}_net_lb"
|
||||
register: instance
|
||||
- name: verify create instance
|
||||
- name: verify setup instance in lb
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.name == "{{ cs_resource_prefix }}-vm-lb"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: setup get ip address for lb
|
||||
cs_ip_address:
|
||||
network: "{{ cs_resource_prefix }}_net_lb"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: ip_address
|
||||
- name: verify setup instance in lb
|
||||
assert:
|
||||
that:
|
||||
- ip_address|success
|
||||
|
||||
- name: setup lb rule absent
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ ip_address.ip_address }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify setup lb rule absent
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
|
||||
- name: test rule requires params
|
||||
cs_loadbalancer_rule:
|
||||
|
@ -34,7 +62,7 @@
|
|||
- name: test create rule
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
public_ip: "{{ ip_address.ip_address }}"
|
||||
algorithm: roundrobin
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
|
@ -46,33 +74,33 @@
|
|||
- lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "roundrobin"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_ip == "{{ ip_address.ip_address }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test create rule idempotence
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
public_ip: "{{ ip_address.ip_address }}"
|
||||
algorithm: roundrobin
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
register: lb
|
||||
- name: verify test create rule idempotence
|
||||
- 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_ip == "{{ ip_address.ip_address }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test update rule
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
public_ip: "{{ ip_address.ip_address }}"
|
||||
algorithm: source
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
|
@ -84,14 +112,14 @@
|
|||
- lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_ip == "{{ ip_address.ip_address }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test update rule idempotence
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
public_ip: "{{ ip_address.ip_address }}"
|
||||
algorithm: source
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
|
@ -103,7 +131,7 @@
|
|||
- not lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_ip == "{{ ip_address.ip_address }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
|
@ -120,7 +148,7 @@
|
|||
- name: test add members to rule
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-lb"
|
||||
register: lb
|
||||
- name: verify add members to rule
|
||||
assert:
|
||||
|
@ -129,15 +157,15 @@
|
|||
- lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_ip == "{{ ip_address.ip_address }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
- "'{{ test_cs_lb_member }}' in lb.vms"
|
||||
- "'{{ cs_resource_prefix }}-vm-lb' in lb.vms"
|
||||
|
||||
- name: test add members to rule idempotence
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-lb"
|
||||
register: lb
|
||||
- name: verify add members to rule idempotence
|
||||
assert:
|
||||
|
@ -146,15 +174,15 @@
|
|||
- not lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_ip == "{{ ip_address.ip_address }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
- "'{{ test_cs_lb_member }}' in lb.vms"
|
||||
- "'{{ cs_resource_prefix }}-vm-lb' in lb.vms"
|
||||
|
||||
- name: test remove members to rule
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-lb"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify remove members to rule
|
||||
|
@ -164,15 +192,15 @@
|
|||
- lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_ip == "{{ ip_address.ip_address }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
- "'{{ test_cs_lb_member }}' not in lb.vms"
|
||||
- "'{{ cs_resource_prefix }}-vm-lb' not in lb.vms"
|
||||
|
||||
- name: test remove members to rule idempotence
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-lb"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify remove members to rule
|
||||
|
@ -184,7 +212,7 @@
|
|||
- name: test remove rule
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
public_ip: "{{ ip_address.ip_address }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify remove rule
|
||||
|
@ -194,14 +222,14 @@
|
|||
- lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_ip == "{{ ip_address.ip_address }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test remove rule idempotence
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
public_ip: "{{ ip_address.ip_address }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify remove rule idempotence
|
3
test/integration/targets/cs_pod/aliases
Normal file
3
test/integration/targets/cs_pod/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
3
test/integration/targets/cs_pod/meta/main.yml
Normal file
3
test/integration/targets/cs_pod/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
|
@ -1,14 +1,4 @@
|
|||
---
|
||||
- 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"
|
||||
|
@ -21,6 +11,17 @@
|
|||
that:
|
||||
- zone|success
|
||||
|
||||
- name: setup pod is absent
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: absent
|
||||
register: pod
|
||||
- name: verify setup pod is absent
|
||||
assert:
|
||||
that:
|
||||
- pod|success
|
||||
|
||||
- name: test fail if missing name
|
||||
cs_pod:
|
||||
register: pod
|
3
test/integration/targets/cs_portforward/aliases
Normal file
3
test/integration/targets/cs_portforward/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
cs_portforward_public_ip: "10.100.212.5"
|
||||
cs_portforward_vm: "cs-{{ cs_resource_prefix }}-pf-vm"
|
3
test/integration/targets/cs_portforward/meta/main.yml
Normal file
3
test/integration/targets/cs_portforward/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
|
@ -1,12 +1,52 @@
|
|||
---
|
||||
- name: setup
|
||||
- name: network setup
|
||||
cs_network:
|
||||
name: ansible test
|
||||
network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService
|
||||
network_domain: example.com
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: net
|
||||
- name: verify network setup
|
||||
assert:
|
||||
that:
|
||||
- net|success
|
||||
|
||||
- name: instance setup
|
||||
cs_instance:
|
||||
name: "{{ cs_portforward_vm }}"
|
||||
template: "{{ cs_common_template }}"
|
||||
service_offering: "{{ cs_common_service_offering }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network: "ansible test"
|
||||
register: instance
|
||||
- name: verify instance setup
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
|
||||
- name: public ip address setup
|
||||
cs_ip_address:
|
||||
network: ansible test
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: ip_address
|
||||
- name: verify public ip address setup
|
||||
assert:
|
||||
that:
|
||||
- ip_address|success
|
||||
|
||||
- name: set ip address as fact
|
||||
set_fact:
|
||||
cs_portforward_public_ip: "{{ ip_address.ip_address }}"
|
||||
|
||||
- name: clear existing port forwarding
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
state: absent
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: pf
|
||||
- name: verify setup
|
||||
- name: verify clear existing port forwarding
|
||||
assert:
|
||||
that:
|
||||
- pf|success
|
||||
|
@ -27,6 +67,7 @@
|
|||
public_port: 80
|
||||
vm: "{{ cs_portforward_vm }}"
|
||||
private_port: 8080
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: pf
|
||||
- name: verify results of present port forwarding
|
||||
assert:
|
||||
|
@ -46,6 +87,7 @@
|
|||
public_port: 80
|
||||
vm: "{{ cs_portforward_vm }}"
|
||||
private_port: 8080
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: pf
|
||||
- name: verify results of present port forwarding idempotence
|
||||
assert:
|
||||
|
@ -65,6 +107,7 @@
|
|||
public_port: 80
|
||||
vm: "{{ cs_portforward_vm }}"
|
||||
private_port: 8888
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: pf
|
||||
- name: verify results of change port forwarding
|
||||
assert:
|
||||
|
@ -84,6 +127,7 @@
|
|||
public_port: 80
|
||||
private_port: 8888
|
||||
state: absent
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: pf
|
||||
- name: verify results of absent port forwarding
|
||||
assert:
|
||||
|
@ -103,9 +147,32 @@
|
|||
public_port: 80
|
||||
private_port: 8888
|
||||
state: absent
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: pf
|
||||
- name: verify results of absent port forwarding idempotence
|
||||
assert:
|
||||
that:
|
||||
- pf|success
|
||||
- not pf|changed
|
||||
|
||||
- name: instance cleanup
|
||||
cs_instance:
|
||||
name: "{{ cs_portforward_vm }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: expunged
|
||||
register: instance
|
||||
- name: verify instance cleanup
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
|
||||
- name: network cleanup
|
||||
cs_network:
|
||||
name: ansible test
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: net
|
||||
- name: verify network cleanup
|
||||
assert:
|
||||
that:
|
||||
- net|success
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
---
|
||||
- name: setup cleanup
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
|
||||
cs_sshkeypair: name=first-sshkey state=absent
|
||||
|
||||
- name: setup cleanup
|
||||
cs_sshkeypair: name=second-sshkey state=absent
|
||||
|
||||
|
||||
- name: test fail on missing name
|
||||
action: cs_sshkeypair
|
||||
|
@ -13,7 +17,8 @@
|
|||
- "sshkey.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test ssh key creation
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
register: sshkey
|
||||
- name: verify results of ssh key creation
|
||||
assert:
|
||||
|
@ -22,10 +27,11 @@
|
|||
- sshkey|changed
|
||||
- sshkey.fingerprint is defined and sshkey.fingerprint != ""
|
||||
- sshkey.private_key is defined and sshkey.private_key != ""
|
||||
- sshkey.name == "{{ cs_resource_prefix }}-sshkey"
|
||||
- sshkey.name == "first-sshkey"
|
||||
|
||||
- name: test ssh key creation idempotence
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
register: sshkey2
|
||||
- name: verify results of ssh key creation idempotence
|
||||
assert:
|
||||
|
@ -34,12 +40,12 @@
|
|||
- not sshkey2|changed
|
||||
- sshkey2.fingerprint is defined and sshkey2.fingerprint == sshkey.fingerprint
|
||||
- sshkey2.private_key is not defined
|
||||
- sshkey2.name == "{{ cs_resource_prefix }}-sshkey"
|
||||
- sshkey2.name == "first-sshkey"
|
||||
|
||||
- name: test replace ssh public key
|
||||
cs_sshkeypair: |
|
||||
name={{ cs_resource_prefix }}-sshkey
|
||||
public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
register: sshkey3
|
||||
- name: verify results of replace ssh public key
|
||||
assert:
|
||||
|
@ -48,12 +54,12 @@
|
|||
- sshkey3|changed
|
||||
- sshkey3.fingerprint is defined and sshkey3.fingerprint != sshkey2.fingerprint
|
||||
- sshkey3.private_key is not defined
|
||||
- sshkey3.name == "{{ cs_resource_prefix }}-sshkey"
|
||||
- sshkey3.name == "first-sshkey"
|
||||
|
||||
- name: test replace ssh public key idempotence
|
||||
cs_sshkeypair: |
|
||||
name={{ cs_resource_prefix }}-sshkey
|
||||
public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
cs_sshkeypair:
|
||||
name: "first-sshkey"
|
||||
public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
register: sshkey4
|
||||
- name: verify results of ssh public key idempotence
|
||||
assert:
|
||||
|
@ -62,10 +68,28 @@
|
|||
- not sshkey4|changed
|
||||
- sshkey4.fingerprint is defined and sshkey4.fingerprint == sshkey3.fingerprint
|
||||
- sshkey4.private_key is not defined
|
||||
- sshkey4.name == "{{ cs_resource_prefix }}-sshkey"
|
||||
- sshkey4.name == "first-sshkey"
|
||||
|
||||
- name: setup ssh key with name "second-sshke"
|
||||
cs_sshkeypair:
|
||||
name: "second-sshkey"
|
||||
|
||||
- name: test different but exisitng name but same ssh public key as first-sshkey
|
||||
cs_sshkeypair:
|
||||
name: "second-sshkey"
|
||||
public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
|
||||
register: sshkey
|
||||
- name: verify test different but exisitng name but same ssh public key as first-sshkey
|
||||
assert:
|
||||
that:
|
||||
- sshkey|success
|
||||
- sshkey|changed
|
||||
- sshkey.fingerprint is defined and sshkey.fingerprint == sshkey4.fingerprint
|
||||
- sshkey.private_key is not defined
|
||||
- sshkey.name == "second-sshkey"
|
||||
|
||||
- name: test ssh key absent
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
|
||||
cs_sshkeypair: name=second-sshkey state=absent
|
||||
register: sshkey5
|
||||
- name: verify result of key absent
|
||||
assert:
|
||||
|
@ -74,10 +98,10 @@
|
|||
- sshkey5|changed
|
||||
- sshkey5.fingerprint is defined and sshkey5.fingerprint == sshkey3.fingerprint
|
||||
- sshkey5.private_key is not defined
|
||||
- sshkey5.name == "{{ cs_resource_prefix }}-sshkey"
|
||||
- sshkey5.name == "second-sshkey"
|
||||
|
||||
- name: test ssh key absent idempotence
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
|
||||
cs_sshkeypair: name=second-sshkey state=absent
|
||||
register: sshkey6
|
||||
- name: verify result of ssh key absent idempotence
|
||||
assert:
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
|
3
test/integration/targets/cs_vmsnapshot/aliases
Normal file
3
test/integration/targets/cs_vmsnapshot/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
3
test/integration/targets/cs_vmsnapshot/defaults/main.yml
Normal file
3
test/integration/targets/cs_vmsnapshot/defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
test_cs_instance_template: "{{ cs_common_template }}"
|
||||
test_cs_instance_offering_1: Small Instance
|
3
test/integration/targets/cs_vmsnapshot/meta/main.yml
Normal file
3
test/integration/targets/cs_vmsnapshot/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
3
test/integration/targets/cs_volume/aliases
Normal file
3
test/integration/targets/cs_volume/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
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_template: "{{ cs_common_template }}"
|
||||
test_cs_instance_offering_1: Small Instance
|
||||
test_cs_disk_offering_1: Custom
|
3
test/integration/targets/cs_volume/meta/main.yml
Normal file
3
test/integration/targets/cs_volume/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
3
test/integration/targets/cs_vpc/aliases
Normal file
3
test/integration/targets/cs_vpc/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
3
test/integration/targets/cs_vpc/meta/main.yml
Normal file
3
test/integration/targets/cs_vpc/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- cs_common
|
399
test/integration/targets/cs_vpc/tasks/main.yml
Normal file
399
test/integration/targets/cs_vpc/tasks/main.yml
Normal file
|
@ -0,0 +1,399 @@
|
|||
---
|
||||
- name: setup
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
register: vpc
|
||||
- name: verify setup
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
|
||||
- name: test fail missing name
|
||||
cs_vpc:
|
||||
ignore_errors: true
|
||||
register: vpc
|
||||
- name: verify test fail missing name
|
||||
assert:
|
||||
that:
|
||||
- vpc|failed
|
||||
- 'vpc.msg == "missing required arguments: name"'
|
||||
|
||||
- name: test fail missing cidr
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
ignore_errors: true
|
||||
register: vpc
|
||||
- name: verify test fail missing name
|
||||
assert:
|
||||
that:
|
||||
- vpc|failed
|
||||
- 'vpc.msg == "state is present but the following are missing: cidr"'
|
||||
|
||||
- name: test create vpc
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
display_text: "{{ cs_resource_prefix }}_display_text"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test create vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test create vpc idempotence
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
display_text: "{{ cs_resource_prefix }}_display_text"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test create vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- not vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test create vpc idempotence2
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test create vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- not vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test update vpc
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
display_text: "{{ cs_resource_prefix }}_display_text2"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test create vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text2"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test update vpc idempotence
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
display_text: "{{ cs_resource_prefix }}_display_text2"
|
||||
cidr: 10.10.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test create vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- not vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text2"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test create network in vpc
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network_offering: Offering for Isolated Vpc networks with Source Nat service enabled
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
gateway: 10.10.0.1
|
||||
netmask: 255.255.255.0
|
||||
register: vpc_net
|
||||
- name: verify test create network in vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc_net|success
|
||||
- vpc_net|changed
|
||||
- vpc_net.name == "{{ cs_resource_prefix }}_net_vpc"
|
||||
|
||||
- name: test create network in vpc idempotence
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network_offering: Offering for Isolated Vpc networks with Source Nat service enabled
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
gateway: 10.10.0.1
|
||||
netmask: 255.255.255.0
|
||||
register: vpc_net
|
||||
- name: verify test create network in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- vpc_net|success
|
||||
- not vpc_net|changed
|
||||
- vpc_net.name == "{{ cs_resource_prefix }}_net_vpc"
|
||||
|
||||
- name: test create instance in vpc
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
template: "{{ cs_common_template }}"
|
||||
service_offering: "{{ cs_common_service_offering }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
register: instance
|
||||
- name: verify test create instance in vpc
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.name == "{{ cs_resource_prefix }}-vm-vpc"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: test create instance in vpc idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
template: "{{ cs_common_template }}"
|
||||
service_offering: "{{ cs_common_service_offering }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
register: instance
|
||||
- name: verify test create instance in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- not instance|changed
|
||||
- instance.name == "{{ cs_resource_prefix }}-vm-vpc"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: test get ip address in vpc
|
||||
cs_ip_address:
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: ip_address
|
||||
when: instance.public_ip is undefined
|
||||
|
||||
- name: test static nat in vpc
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
register: static_nat
|
||||
- name: verify test static nat in vpc
|
||||
assert:
|
||||
that:
|
||||
- static_nat|success
|
||||
- static_nat|changed
|
||||
|
||||
- name: test static nat in vpc idempotence
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
register: static_nat
|
||||
- name: verify test static nat in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- static_nat|success
|
||||
- not static_nat|changed
|
||||
|
||||
- name: test remove static nat in vpc
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
state: absent
|
||||
register: static_nat
|
||||
- name: verify test remove static nat in vpc
|
||||
assert:
|
||||
that:
|
||||
- static_nat|success
|
||||
- static_nat|changed
|
||||
|
||||
- name: test remove static nat in vpc idempotence
|
||||
cs_staticnat:
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
state: absent
|
||||
register: static_nat
|
||||
- name: verify test remove static nat in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- static_nat|success
|
||||
- not static_nat|changed
|
||||
|
||||
- name: test create port forwarding in vpc
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: port_forward
|
||||
- name: verify test create port forwarding in vpc
|
||||
assert:
|
||||
that:
|
||||
- port_forward|success
|
||||
- port_forward|changed
|
||||
|
||||
- name: test create port forwarding in vpc idempotence
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: port_forward
|
||||
- name: verify test create port forwarding in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- port_forward|success
|
||||
- not port_forward|changed
|
||||
|
||||
- name: test remove port forwarding in vpc
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: port_forward
|
||||
- name: verify test remove port forwarding in vpc
|
||||
assert:
|
||||
that:
|
||||
- port_forward|success
|
||||
- port_forward|changed
|
||||
|
||||
- name: test remove port forwarding in vpc idempotence
|
||||
cs_portforward:
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
vm: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: absent
|
||||
register: port_forward
|
||||
- name: verify test remove port forwarding in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- port_forward|success
|
||||
- not port_forward|changed
|
||||
|
||||
- name: test remove ip address from vpc
|
||||
cs_ip_address:
|
||||
network: "{{ cs_resource_prefix }}_net_vpc"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
ip_address: "{{ ip_address.ip_address }}"
|
||||
state: absent
|
||||
register: ip_address_removed
|
||||
- name: verify test remove static nat in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- ip_address_removed|success
|
||||
- ip_address_removed|changed
|
||||
|
||||
- name: test remove instance in vpc
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: expunged
|
||||
register: instance
|
||||
- name: verify test remove instance in vpc
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.name == "{{ cs_resource_prefix }}-vm-vpc"
|
||||
- instance.state == "Running"
|
||||
|
||||
- name: test remove instance in vpc idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
state: expunged
|
||||
register: instance
|
||||
- name: verify test remove instance in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- not instance|changed
|
||||
|
||||
- name: test remove network in vpc
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
register: vpc_net
|
||||
- name: verify test remove network in vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc_net|success
|
||||
- vpc_net|changed
|
||||
- vpc_net.name == "{{ cs_resource_prefix }}_net_vpc"
|
||||
|
||||
- name: test remove network in vpc idempotence
|
||||
cs_network:
|
||||
name: "{{ cs_resource_prefix }}_net_vpc"
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
register: vpc_net
|
||||
- name: verify test remove network in vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- vpc_net|success
|
||||
- not vpc_net|changed
|
||||
|
||||
- name: test remove vpc
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
register: vpc
|
||||
- name: verify test remove vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- vpc|changed
|
||||
- vpc.name == "{{ cs_resource_prefix }}_vpc"
|
||||
- vpc.display_text == "{{ cs_resource_prefix }}_display_text2"
|
||||
- vpc.cidr == "10.10.0.0/16"
|
||||
|
||||
- name: test remove vpc idempotence
|
||||
cs_vpc:
|
||||
name: "{{ cs_resource_prefix }}_vpc"
|
||||
state: absent
|
||||
register: vpc
|
||||
- name: verify test remove vpc idempotence
|
||||
assert:
|
||||
that:
|
||||
- vpc|success
|
||||
- not vpc|changed
|
|
@ -1,2 +0,0 @@
|
|||
---
|
||||
cs_resource_prefix: cloudstack
|
64
test/utils/docker/cloudstack-simulator/Dockerfile
Normal file
64
test/utils/docker/cloudstack-simulator/Dockerfile
Normal file
|
@ -0,0 +1,64 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
MAINTAINER "René Moser" <mail@renemoser.net>
|
||||
|
||||
RUN echo 'mysql-server mysql-server/root_password password root' | debconf-set-selections; \
|
||||
echo 'mysql-server mysql-server/root_password_again password root' | debconf-set-selections;
|
||||
|
||||
RUN apt-get -y update && apt-get install -y \
|
||||
genisoimage \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
sudo \
|
||||
ipmitool \
|
||||
maven \
|
||||
netcat \
|
||||
openjdk-8-jdk \
|
||||
python-dev \
|
||||
python-setuptools \
|
||||
python-pip \
|
||||
python-mysql.connector \
|
||||
supervisor \
|
||||
wget \
|
||||
nginx \
|
||||
jq \
|
||||
mysql-server \
|
||||
openssh-client \
|
||||
&& apt-get clean all \
|
||||
&& rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
# TODO: check if and why this is needed
|
||||
RUN mkdir -p /root/.ssh \
|
||||
&& chmod 0700 /root/.ssh \
|
||||
&& ssh-keygen -t rsa -N "" -f id_rsa.cloud
|
||||
|
||||
RUN mkdir -p /var/run/mysqld; \
|
||||
chown mysql /var/run/mysqld; \
|
||||
echo '''sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"''' >> /etc/mysql/mysql.conf.d/mysqld.cnf
|
||||
|
||||
RUN (/usr/bin/mysqld_safe &); sleep 5; mysqladmin -u root -proot password ''
|
||||
|
||||
RUN wget https://github.com/apache/cloudstack/archive/4.9.2.0.tar.gz -O /opt/cloudstack.tar.gz; \
|
||||
mkdir -p /opt/cloudstack; \
|
||||
tar xvzf /opt/cloudstack.tar.gz -C /opt/cloudstack --strip-components=1
|
||||
|
||||
WORKDIR /opt/cloudstack
|
||||
|
||||
RUN mvn -Pdeveloper -Dsimulator -DskipTests clean install
|
||||
|
||||
RUN (/usr/bin/mysqld_safe &); \
|
||||
sleep 5; \
|
||||
mvn -Pdeveloper -pl developer -Ddeploydb; \
|
||||
mvn -Pdeveloper -pl developer -Ddeploydb-simulator; \
|
||||
MARVIN_FILE=$(find /opt/cloudstack/tools/marvin/dist/ -name "Marvin*.tar.gz"); \
|
||||
pip install $MARVIN_FILE;
|
||||
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY zones.cfg /opt/zones.cfg
|
||||
COPY nginx_default.conf /etc/nginx/sites-available/default
|
||||
RUN pip install cs
|
||||
COPY run.sh /opt/run.sh
|
||||
|
||||
EXPOSE 8888 8080 8096
|
||||
|
||||
CMD ["/usr/bin/supervisord"]
|
14
test/utils/docker/cloudstack-simulator/Makefile
Normal file
14
test/utils/docker/cloudstack-simulator/Makefile
Normal file
|
@ -0,0 +1,14 @@
|
|||
build:
|
||||
docker build -t cloudstack-sim .
|
||||
|
||||
clean:
|
||||
docker rm -f cloudstack
|
||||
|
||||
run:
|
||||
docker run --name cloudstack -d -p 8080:8080 -p 8888:8888 cloudstack-sim
|
||||
|
||||
shell:
|
||||
docker exec -it cloudstack /bin/bash
|
||||
|
||||
logs:
|
||||
docker logs -f cloudstack
|
31
test/utils/docker/cloudstack-simulator/README.rst
Normal file
31
test/utils/docker/cloudstack-simulator/README.rst
Normal file
|
@ -0,0 +1,31 @@
|
|||
CloudStack Simulator as Docker Image
|
||||
====================================
|
||||
|
||||
The purpose of this docker image is to run automated integration tests for the CloudStack modules in Ansible.
|
||||
|
||||
Setup
|
||||
-----
|
||||
|
||||
The docker image runs the CloudStack simulator and contains two zones for the different network setups: `basic` and `advanced` networking.
|
||||
|
||||
- CloudStack Zone: Sandbox-simulator-advanced
|
||||
- Zone: Sandbox-simulator-basic
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
docker build -t ansible/cloudstack-simulator .
|
||||
|
||||
Run
|
||||
---
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
docker run --name cloudstack-simulator -d -p 8888:8888 ansible/cloudstack-simulator
|
||||
|
||||
|
||||
.. Note::
|
||||
|
||||
It may take some time until the zones are deployed. The web server will respond with HTTP 503 on port 8888 unless the zones are fully deployed.
|
23
test/utils/docker/cloudstack-simulator/nginx_default.conf
Normal file
23
test/utils/docker/cloudstack-simulator/nginx_default.conf
Normal file
|
@ -0,0 +1,23 @@
|
|||
upstream cloudstack-backend {
|
||||
server 127.0.0.1:8080;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8888 default_server;
|
||||
|
||||
root /var/www/html;
|
||||
|
||||
server_name _;
|
||||
|
||||
# waiting for zone to be deployed
|
||||
if (!-f /var/www/html/admin.json) {
|
||||
return 503;
|
||||
}
|
||||
|
||||
location /client {
|
||||
proxy_pass http://cloudstack-backend;
|
||||
}
|
||||
location / {
|
||||
|
||||
}
|
||||
}
|
15
test/utils/docker/cloudstack-simulator/run.sh
Executable file
15
test/utils/docker/cloudstack-simulator/run.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
until nc -z localhost 8096; do
|
||||
echo "waiting for port 8096..."
|
||||
sleep 3
|
||||
done
|
||||
|
||||
sleep 3
|
||||
if [ ! -e /var/www/html/admin.json ]
|
||||
then
|
||||
python /opt/cloudstack/tools/marvin/marvin/deployDataCenter.py -i /opt/zones.cfg
|
||||
export CLOUDSTACK_ENDPOINT=http://127.0.0.1:8096
|
||||
export CLOUDSTACK_KEY=""
|
||||
export CLOUDSTACK_SECRET=""
|
||||
cs listUsers account=admin | jq .user[0] > /var/www/html/admin.json
|
||||
fi
|
28
test/utils/docker/cloudstack-simulator/supervisord.conf
Normal file
28
test/utils/docker/cloudstack-simulator/supervisord.conf
Normal file
|
@ -0,0 +1,28 @@
|
|||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:mysqld]
|
||||
command=/usr/bin/mysqld_safe
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
|
||||
[program:cloudstack]
|
||||
command=/bin/bash -c "mvn -pl client jetty:run -Dsimulator -Dorg.eclipse.jetty.annotations.maxWait=120"
|
||||
directory=/opt/cloudstack
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
user=root
|
||||
|
||||
[program:nginx]
|
||||
command=/usr/sbin/nginx
|
||||
autostart=true
|
||||
autorestart=false
|
||||
user=root
|
||||
|
||||
[program:deploy-zones]
|
||||
command = /opt/run.sh
|
||||
startsecs = 0
|
||||
autorestart = false
|
||||
startretries = 1
|
||||
user=root
|
310
test/utils/docker/cloudstack-simulator/zones.cfg
Normal file
310
test/utils/docker/cloudstack-simulator/zones.cfg
Normal file
|
@ -0,0 +1,310 @@
|
|||
{
|
||||
"zones": [
|
||||
{
|
||||
"name": "Sandbox-simulator-basic",
|
||||
"dns1": "8.8.8.8",
|
||||
"physical_networks": [
|
||||
{
|
||||
"broadcastdomainrange": "Zone",
|
||||
"name": "Sandbox-pnet",
|
||||
"traffictypes": [
|
||||
{
|
||||
"typ": "Guest"
|
||||
},
|
||||
{
|
||||
"typ": "Management"
|
||||
}
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"broadcastdomainrange": "ZONE",
|
||||
"name": "VirtualRouter"
|
||||
},
|
||||
{
|
||||
"broadcastdomainrange": "Pod",
|
||||
"name": "SecurityGroupProvider"
|
||||
}
|
||||
],
|
||||
"isolationmethods": [
|
||||
"L3"
|
||||
]
|
||||
}
|
||||
],
|
||||
"securitygroupenabled": "true",
|
||||
"networktype": "Basic",
|
||||
"pods": [
|
||||
{
|
||||
"endip": "172.16.15.254",
|
||||
"name": "POD0-basic",
|
||||
"startip": "172.16.15.2",
|
||||
"guestIpRanges": [
|
||||
{
|
||||
"startip": "60.147.41.2",
|
||||
"endip": "60.147.41.254",
|
||||
"netmask": "255.255.255.0",
|
||||
"gateway": "60.147.41.1"
|
||||
}
|
||||
],
|
||||
"netmask": "255.255.255.0",
|
||||
"clusters": [
|
||||
{
|
||||
"clustername": "C0-basic",
|
||||
"hypervisor": "simulator",
|
||||
"hosts": [
|
||||
{
|
||||
"username": "root",
|
||||
"url": "http://sim/c0-basic/h0",
|
||||
"password": "password"
|
||||
},
|
||||
{
|
||||
"username": "root",
|
||||
"url": "http://sim/c0-basic/h1",
|
||||
"password": "password"
|
||||
}
|
||||
],
|
||||
"clustertype": "CloudManaged",
|
||||
"primaryStorages": [
|
||||
{
|
||||
"url": "nfs://nfsstor:/export/home/sandbox/primary",
|
||||
"name": "PS0-basic"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"gateway": "172.16.15.1"
|
||||
}
|
||||
],
|
||||
"internaldns1": "8.8.8.8",
|
||||
"secondaryStorages": [
|
||||
{
|
||||
"url": "nfs://nfsstor:/export/home/sandbox/secondary",
|
||||
"provider" : "NFS"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Sandbox-simulator-advanced",
|
||||
"guestcidraddress": "10.1.1.0/24",
|
||||
"dns1": "10.147.28.7",
|
||||
"physical_networks": [
|
||||
{
|
||||
"broadcastdomainrange": "Zone",
|
||||
"vlan": "100-200",
|
||||
"name": "Sandbox-pnet",
|
||||
"traffictypes": [
|
||||
{
|
||||
"typ": "Guest"
|
||||
},
|
||||
{
|
||||
"typ": "Management"
|
||||
},
|
||||
{
|
||||
"typ": "Public"
|
||||
}
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"broadcastdomainrange": "ZONE",
|
||||
"name": "VirtualRouter"
|
||||
},
|
||||
{
|
||||
"broadcastdomainrange": "ZONE",
|
||||
"name": "VpcVirtualRouter"
|
||||
},
|
||||
{
|
||||
"broadcastdomainrange": "ZONE",
|
||||
"name": "InternalLbVm"
|
||||
}
|
||||
],
|
||||
"isolationmethods": [
|
||||
"VLAN"
|
||||
]
|
||||
}
|
||||
],
|
||||
"vmwaredc": {
|
||||
"username": "",
|
||||
"vcenter": "",
|
||||
"password": "",
|
||||
"name": ""
|
||||
},
|
||||
"ipranges": [
|
||||
{
|
||||
"startip": "192.168.2.2",
|
||||
"endip": "192.168.2.200",
|
||||
"netmask": "255.255.255.0",
|
||||
"vlan": "50",
|
||||
"gateway": "192.168.2.1"
|
||||
}
|
||||
],
|
||||
"networktype": "Advanced",
|
||||
"pods": [
|
||||
{
|
||||
"endip": "172.16.15.200",
|
||||
"name": "POD0-adv",
|
||||
"startip": "172.16.15.2",
|
||||
"netmask": "255.255.255.0",
|
||||
"clusters": [
|
||||
{
|
||||
"clustername": "C0-adv",
|
||||
"hypervisor": "simulator",
|
||||
"hosts": [
|
||||
{
|
||||
"username": "root",
|
||||
"url": "http://sim/c0-adv/h0",
|
||||
"password": "password"
|
||||
},
|
||||
{
|
||||
"username": "root",
|
||||
"url": "http://sim/c0-adv/h1",
|
||||
"password": "password"
|
||||
}
|
||||
],
|
||||
"clustertype": "CloudManaged",
|
||||
"primaryStorages": [
|
||||
{
|
||||
"url": "nfs://10.147.28.7:/export/home/sandbox/primary0",
|
||||
"name": "PS0-adv"
|
||||
},
|
||||
{
|
||||
"url": "nfs://10.147.28.7:/export/home/sandbox/primary1",
|
||||
"name": "PS1-adv"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"clustername": "C1-adv",
|
||||
"hypervisor": "simulator",
|
||||
"hosts": [
|
||||
{
|
||||
"username": "root",
|
||||
"url": "http://sim/c1-adv/h0",
|
||||
"password": "password"
|
||||
}
|
||||
],
|
||||
"clustertype": "CloudManaged",
|
||||
"primaryStorages": [
|
||||
{
|
||||
"url": "nfs://10.147.28.7:/export/home/sandbox/primary2",
|
||||
"name": "PS2-adv"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"gateway": "172.16.15.1"
|
||||
}
|
||||
],
|
||||
"internaldns1": "10.147.28.7",
|
||||
"secondaryStorages": [
|
||||
{
|
||||
"url": "nfs://10.147.28.7:/export/home/sandbox/secondary",
|
||||
"provider" : "NFS"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"dbSvr": {
|
||||
"dbSvr": "localhost",
|
||||
"passwd": "cloud",
|
||||
"db": "cloud",
|
||||
"port": 3306,
|
||||
"user": "cloud"
|
||||
},
|
||||
"logger":
|
||||
{
|
||||
"LogFolderPath": "/tmp/"
|
||||
},
|
||||
"globalConfig": [
|
||||
{
|
||||
"name": "network.gc.wait",
|
||||
"value": "20"
|
||||
},
|
||||
{
|
||||
"name": "storage.cleanup.interval",
|
||||
"value": "40"
|
||||
},
|
||||
{
|
||||
"name": "vm.op.wait.interval",
|
||||
"value": "5"
|
||||
},
|
||||
{
|
||||
"name": "default.page.size",
|
||||
"value": "500"
|
||||
},
|
||||
{
|
||||
"name": "network.gc.interval",
|
||||
"value": "20"
|
||||
},
|
||||
{
|
||||
"name": "instance.name",
|
||||
"value": "QA"
|
||||
},
|
||||
{
|
||||
"name": "workers",
|
||||
"value": "10"
|
||||
},
|
||||
{
|
||||
"name": "account.cleanup.interval",
|
||||
"value": "20"
|
||||
},
|
||||
{
|
||||
"name": "guest.domain.suffix",
|
||||
"value": "sandbox.simulator"
|
||||
},
|
||||
{
|
||||
"name": "expunge.delay",
|
||||
"value": "20"
|
||||
},
|
||||
{
|
||||
"name": "vm.allocation.algorithm",
|
||||
"value": "random"
|
||||
},
|
||||
{
|
||||
"name": "expunge.interval",
|
||||
"value": "20"
|
||||
},
|
||||
{
|
||||
"name": "expunge.workers",
|
||||
"value": "3"
|
||||
},
|
||||
{
|
||||
"name": "check.pod.cidrs",
|
||||
"value": "true"
|
||||
},
|
||||
{
|
||||
"name": "secstorage.allowed.internal.sites",
|
||||
"value": "10.147.28.0/24"
|
||||
},
|
||||
{
|
||||
"name": "direct.agent.load.size",
|
||||
"value": "1000"
|
||||
},
|
||||
{
|
||||
"name": "enable.dynamic.scale.vm",
|
||||
"value": "true"
|
||||
},
|
||||
{
|
||||
"name": "ping.interval",
|
||||
"value": "10"
|
||||
},
|
||||
{
|
||||
"name": "ping.timeout",
|
||||
"value": "1.5"
|
||||
},
|
||||
{
|
||||
"name": "outofbandmanagement.sync.interval",
|
||||
"value": "1000"
|
||||
}
|
||||
],
|
||||
"mgtSvr": [
|
||||
{
|
||||
"mgtSvrIp": "localhost",
|
||||
"passwd": "password",
|
||||
"user": "root",
|
||||
"port": 8096,
|
||||
"hypervisor": "simulator",
|
||||
"useHttps": "False",
|
||||
"certCAPath": "NA",
|
||||
"certPath": "NA"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue