Skip to content

Commit 5ad1112

Browse files
committed
add network_acl
1 parent 4fc256e commit 5ad1112

File tree

3 files changed

+126
-0
lines changed

3 files changed

+126
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cloud/cs
2+
cs/group1
3+
cs/group3
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
dependencies:
3+
- cs_common
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
- name: setup vpc
3+
ngine_io.cloudstack.vpc:
4+
name: "{{ cs_resource_prefix }}_vpc"
5+
display_text: "{{ cs_resource_prefix }}_display_text"
6+
cidr: 10.10.0.0/16
7+
vpc_offering: Redundant VPC offering
8+
zone: "{{ cs_common_zone_adv }}"
9+
register: vpc
10+
- name: verify setup vpc
11+
assert:
12+
that:
13+
- vpc is successful
14+
15+
- name: setup network acl absent
16+
ngine_io.cloudstack.network_acl:
17+
name: "{{ cs_resource_prefix }}_acl"
18+
vpc: "{{ cs_resource_prefix }}_vpc"
19+
zone: "{{ cs_common_zone_adv }}"
20+
state: absent
21+
register: acl
22+
- name: verify setup network acl absent
23+
assert:
24+
that:
25+
- acl is successful
26+
27+
- name: test fail missing param name and vpc for network acl
28+
ngine_io.cloudstack.network_acl:
29+
ignore_errors: true
30+
register: acl
31+
- name: verify test fail missing param name and vpc for network acl
32+
assert:
33+
that:
34+
- acl is failed
35+
- "acl.msg.startswith('missing required arguments: ')"
36+
37+
- name: test create network acl in check mode
38+
ngine_io.cloudstack.network_acl:
39+
name: "{{ cs_resource_prefix }}_acl"
40+
vpc: "{{ cs_resource_prefix }}_vpc"
41+
zone: "{{ cs_common_zone_adv }}"
42+
register: acl
43+
check_mode: true
44+
- name: verify test create network acl in check mode
45+
assert:
46+
that:
47+
- acl is successful
48+
- acl is changed
49+
50+
- name: test create network acl
51+
ngine_io.cloudstack.network_acl:
52+
name: "{{ cs_resource_prefix }}_acl"
53+
vpc: "{{ cs_resource_prefix }}_vpc"
54+
zone: "{{ cs_common_zone_adv }}"
55+
register: acl
56+
- name: verify test create network acl
57+
assert:
58+
that:
59+
- acl is successful
60+
- acl is changed
61+
- acl.vpc == cs_resource_prefix + "_vpc"
62+
- acl.name == cs_resource_prefix + "_acl"
63+
64+
- name: test create network acl idempotence
65+
ngine_io.cloudstack.network_acl:
66+
name: "{{ cs_resource_prefix }}_acl"
67+
vpc: "{{ cs_resource_prefix }}_vpc"
68+
zone: "{{ cs_common_zone_adv }}"
69+
register: acl
70+
- name: verify test create network acl idempotence
71+
assert:
72+
that:
73+
- acl is successful
74+
- acl is not changed
75+
- acl.vpc == cs_resource_prefix + "_vpc"
76+
- acl.name == cs_resource_prefix + "_acl"
77+
78+
- name: test remove network acl in check mode
79+
ngine_io.cloudstack.network_acl:
80+
name: "{{ cs_resource_prefix }}_acl"
81+
vpc: "{{ cs_resource_prefix }}_vpc"
82+
zone: "{{ cs_common_zone_adv }}"
83+
state: absent
84+
register: acl
85+
check_mode: true
86+
- name: verify test remove network acl in check mode
87+
assert:
88+
that:
89+
- acl is successful
90+
- acl is changed
91+
- acl.vpc == cs_resource_prefix + "_vpc"
92+
- acl.name == cs_resource_prefix + "_acl"
93+
94+
- name: test remove network acl
95+
ngine_io.cloudstack.network_acl:
96+
name: "{{ cs_resource_prefix }}_acl"
97+
vpc: "{{ cs_resource_prefix }}_vpc"
98+
zone: "{{ cs_common_zone_adv }}"
99+
state: absent
100+
register: acl
101+
- name: verify test remove network acl
102+
assert:
103+
that:
104+
- acl is successful
105+
- acl is changed
106+
- acl.vpc == cs_resource_prefix + "_vpc"
107+
- acl.name == cs_resource_prefix + "_acl"
108+
109+
- name: test remove network acl idempotence
110+
ngine_io.cloudstack.network_acl:
111+
name: "{{ cs_resource_prefix }}_acl"
112+
vpc: "{{ cs_resource_prefix }}_vpc"
113+
zone: "{{ cs_common_zone_adv }}"
114+
state: absent
115+
register: acl
116+
- name: verify test remove network acl idempotence
117+
assert:
118+
that:
119+
- acl is successful
120+
- acl is not changed

0 commit comments

Comments
 (0)