mirror of https://github.com/ansible/ansible.git
automated integration tests for cloudstack (#20552)
parent
b58cf0d23a
commit
aaf4f04574
@ -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
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
||||
@ -1,3 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
||||
@ -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
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
||||
@ -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
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
||||
@ -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
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
||||
@ -1,3 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
||||
@ -0,0 +1,3 @@
|
||||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
||||
@ -0,0 +1,3 @@
|
||||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
||||
@ -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"
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- 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,3 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
||||
- cs_common
|
||||
|
||||
@ -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
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
||||
@ -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
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
||||
@ -0,0 +1,3 @@
|
||||
cloud/cs
|
||||
posix/ci/cloud/cs
|
||||
skip/python3
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
||||
@ -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
|
||||
@ -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"]
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -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 / {
|
||||
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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 New Issue