-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cloud/cs | ||
cs/group2 | ||
cs/group3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- cs_common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
--- | ||
- name: setup network | ||
ngine_io.cloudstack.network: | ||
name: "net_router" | ||
zone: "{{ cs_common_zone_adv }}" | ||
network_offering: DefaultSharedNetworkOffering | ||
network_domain: example.com | ||
vlan: 1234 | ||
start_ip: 10.100.12.11 | ||
end_ip: 10.100.12.250 | ||
gateway: 10.100.12.1 | ||
netmask: 255.255.255.0 | ||
register: net | ||
- name: verify setup network | ||
assert: | ||
that: | ||
- net.name == "net_router" | ||
|
||
- name: setup instance | ||
ngine_io.cloudstack.instance: | ||
name: "instance-vm" | ||
template: "{{ cs_common_template }}" | ||
service_offering: "{{ cs_common_service_offering }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
network: "net_router" | ||
state: started | ||
register: instance | ||
- name: verify setup instance | ||
assert: | ||
that: | ||
- instance is successful | ||
- instance.name == "instance-vm" | ||
- instance.state == "Running" | ||
|
||
- name: setup instance starts a router | ||
ngine_io.cloudstack.instance: | ||
name: "instance-vm" | ||
template: "{{ cs_common_template }}" | ||
service_offering: "{{ cs_common_service_offering }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
network: "net_router" | ||
state: started | ||
register: instance | ||
- name: verify setup instance | ||
assert: | ||
that: | ||
- instance is successful | ||
- instance.name == "instance-vm" | ||
- instance.state == "Running" | ||
|
||
- name: setup find the routers name | ||
shell: cs listRouters listall=true networkid="{{ net.id }}" zone="{{ cs_common_zone_adv }}" | ||
args: | ||
chdir: "{{ playbook_dir }}" | ||
register: router | ||
|
||
- debug: | ||
var: router.stdout | ||
|
||
- set_fact: | ||
router_json: "{{ router.stdout | from_json }}" | ||
|
||
- set_fact: | ||
router_name: "{{ router_json.router[0].name }}" | ||
|
||
- name: test router started | ||
ngine_io.cloudstack.router: | ||
name: "{{ router_name }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
state: started | ||
register: router | ||
- name: verify test router started | ||
assert: | ||
that: | ||
- router is successful | ||
|
||
- name: test stop router in check mode | ||
ngine_io.cloudstack.router: | ||
name: "{{ router_name }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
state: stopped | ||
check_mode: true | ||
register: router | ||
- name: verify test stop router in check mode | ||
assert: | ||
that: | ||
- router is changed | ||
- router.state == "Running" | ||
- router.service_offering == "System Offering For Software Router" | ||
|
||
- name: test stop router | ||
ngine_io.cloudstack.router: | ||
name: "{{ router_name }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
state: stopped | ||
register: router | ||
- name: verify test stop router | ||
assert: | ||
that: | ||
- router is changed | ||
- router.state == "Stopped" | ||
- router.service_offering == "System Offering For Software Router" | ||
|
||
- name: test stop router idempotence | ||
ngine_io.cloudstack.router: | ||
name: "{{ router_name }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
state: stopped | ||
register: router | ||
- name: verify test stop router idempotence | ||
assert: | ||
that: | ||
- router is not changed | ||
- router.state == "Stopped" | ||
- router.service_offering == "System Offering For Software Router" | ||
|
||
- name: test start router in check mode | ||
ngine_io.cloudstack.router: | ||
name: "{{ router_name }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
state: started | ||
register: router | ||
check_mode: true | ||
- name: verify test start router in check mode | ||
assert: | ||
that: | ||
- router is changed | ||
- router.state == "Stopped" | ||
- router.service_offering == "System Offering For Software Router" | ||
|
||
- name: test start router | ||
ngine_io.cloudstack.router: | ||
name: "{{ router_name }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
state: started | ||
register: router | ||
- name: verify test start router | ||
assert: | ||
that: | ||
- router is changed | ||
- router.state == "Running" | ||
- router.service_offering == "System Offering For Software Router" | ||
|
||
- name: test start router idempotence | ||
ngine_io.cloudstack.router: | ||
name: "{{ router_name }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
state: started | ||
register: router | ||
- name: verify test start router idempotence | ||
assert: | ||
that: | ||
- router is not changed | ||
- router.state == "Running" | ||
- router.service_offering == "System Offering For Software Router" | ||
|
||
- name: test restart router in check mode | ||
ngine_io.cloudstack.router: | ||
name: "{{ router_name }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
state: restarted | ||
register: router | ||
check_mode: true | ||
- name: verify test restart router in check mode | ||
assert: | ||
that: | ||
- router is changed | ||
- router.state == "Running" | ||
- router.service_offering == "System Offering For Software Router" | ||
|
||
- name: test restart router | ||
ngine_io.cloudstack.router: | ||
name: "{{ router_name }}" | ||
zone: "{{ cs_common_zone_adv }}" | ||
state: restarted | ||
register: router | ||
- name: verify test restart router | ||
assert: | ||
that: | ||
- router is changed | ||
- router.state == "Running" | ||
- router.service_offering == "System Offering For Software Router" |