|
| 1 | +--- |
| 2 | +- name: test remove http range rule in check mode |
| 3 | + ngine_io.cloudstack.security_group_rule: |
| 4 | + security_group: default |
| 5 | + start_port: 8000 |
| 6 | + end_port: 8888 |
| 7 | + cidr: 1.2.3.4/32 |
| 8 | + state: absent |
| 9 | + register: sg_rule |
| 10 | + check_mode: true |
| 11 | +- name: verify create http range rule in check mode |
| 12 | + assert: |
| 13 | + that: |
| 14 | + - sg_rule is successful |
| 15 | + - sg_rule is changed |
| 16 | + - sg_rule.type == 'ingress' |
| 17 | + - sg_rule.security_group == 'default' |
| 18 | + - sg_rule.protocol == 'tcp' |
| 19 | + - sg_rule.start_port == 8000 |
| 20 | + - sg_rule.end_port == 8888 |
| 21 | + - sg_rule.cidr == '1.2.3.4/32' |
| 22 | + |
| 23 | +- name: test remove http range rule |
| 24 | + ngine_io.cloudstack.security_group_rule: |
| 25 | + security_group: default |
| 26 | + start_port: 8000 |
| 27 | + end_port: 8888 |
| 28 | + cidr: 1.2.3.4/32 |
| 29 | + state: absent |
| 30 | + register: sg_rule |
| 31 | +- name: verify create http range rule |
| 32 | + assert: |
| 33 | + that: |
| 34 | + - sg_rule is successful |
| 35 | + - sg_rule is changed |
| 36 | + - sg_rule.type == 'ingress' |
| 37 | + - sg_rule.security_group == 'default' |
| 38 | + - sg_rule.protocol == 'tcp' |
| 39 | + - sg_rule.start_port == 8000 |
| 40 | + - sg_rule.end_port == 8888 |
| 41 | + - sg_rule.cidr == '1.2.3.4/32' |
| 42 | + |
| 43 | +- name: test remove http range rule idempotence |
| 44 | + ngine_io.cloudstack.security_group_rule: |
| 45 | + security_group: default |
| 46 | + start_port: 8000 |
| 47 | + end_port: 8888 |
| 48 | + cidr: 1.2.3.4/32 |
| 49 | + state: absent |
| 50 | + register: sg_rule |
| 51 | +- name: verify create http range rule idempotence |
| 52 | + assert: |
| 53 | + that: |
| 54 | + - sg_rule is successful |
| 55 | + - sg_rule is not changed |
| 56 | + |
| 57 | +- name: test remove single port udp rule in check mode |
| 58 | + ngine_io.cloudstack.security_group_rule: |
| 59 | + security_group: default |
| 60 | + port: 5353 |
| 61 | + protocol: udp |
| 62 | + type: egress |
| 63 | + user_security_group: "{{ cs_resource_prefix }}_sg" |
| 64 | + state: absent |
| 65 | + register: sg_rule |
| 66 | + check_mode: true |
| 67 | +- name: verify remove single port udp rule in check mode |
| 68 | + assert: |
| 69 | + that: |
| 70 | + - sg_rule is successful |
| 71 | + - sg_rule is changed |
| 72 | + - sg_rule.type == 'egress' |
| 73 | + - sg_rule.security_group == 'default' |
| 74 | + - sg_rule.protocol == 'udp' |
| 75 | + - sg_rule.start_port == 5353 |
| 76 | + - sg_rule.end_port == 5353 |
| 77 | + - sg_rule.user_security_group == cs_resource_prefix + "_sg" |
| 78 | + |
| 79 | +- name: test remove single port udp rule |
| 80 | + ngine_io.cloudstack.security_group_rule: |
| 81 | + security_group: default |
| 82 | + port: 5353 |
| 83 | + protocol: udp |
| 84 | + type: egress |
| 85 | + user_security_group: "{{ cs_resource_prefix }}_sg" |
| 86 | + state: absent |
| 87 | + register: sg_rule |
| 88 | +- name: verify remove single port udp rule |
| 89 | + assert: |
| 90 | + that: |
| 91 | + - sg_rule is successful |
| 92 | + - sg_rule is changed |
| 93 | + - sg_rule.type == 'egress' |
| 94 | + - sg_rule.security_group == 'default' |
| 95 | + - sg_rule.protocol == 'udp' |
| 96 | + - sg_rule.start_port == 5353 |
| 97 | + - sg_rule.end_port == 5353 |
| 98 | + - sg_rule.user_security_group == cs_resource_prefix + "_sg" |
| 99 | + |
| 100 | +- name: test remove single port udp rule idempotence |
| 101 | + ngine_io.cloudstack.security_group_rule: |
| 102 | + security_group: default |
| 103 | + port: 5353 |
| 104 | + protocol: udp |
| 105 | + type: egress |
| 106 | + user_security_group: "{{ cs_resource_prefix }}_sg" |
| 107 | + state: absent |
| 108 | + register: sg_rule |
| 109 | +- name: verify remove single port udp rule idempotence |
| 110 | + assert: |
| 111 | + that: |
| 112 | + - sg_rule is successful |
| 113 | + - sg_rule is not changed |
| 114 | + |
| 115 | +- name: test remove icmp rule in check mode |
| 116 | + ngine_io.cloudstack.security_group_rule: |
| 117 | + security_group: default |
| 118 | + protocol: icmp |
| 119 | + type: ingress |
| 120 | + icmp_type: -1 |
| 121 | + icmp_code: -1 |
| 122 | + state: absent |
| 123 | + register: sg_rule |
| 124 | + check_mode: true |
| 125 | +- name: verify icmp rule in check mode |
| 126 | + assert: |
| 127 | + that: |
| 128 | + - sg_rule is successful |
| 129 | + - sg_rule is changed |
| 130 | + - sg_rule.type == 'ingress' |
| 131 | + - sg_rule.security_group == 'default' |
| 132 | + - sg_rule.cidr == '0.0.0.0/0' |
| 133 | + - sg_rule.protocol == 'icmp' |
| 134 | + - sg_rule.icmp_code == -1 |
| 135 | + - sg_rule.icmp_type == -1 |
| 136 | + |
| 137 | +- name: test remove icmp rule |
| 138 | + ngine_io.cloudstack.security_group_rule: |
| 139 | + security_group: default |
| 140 | + protocol: icmp |
| 141 | + type: ingress |
| 142 | + icmp_type: -1 |
| 143 | + icmp_code: -1 |
| 144 | + state: absent |
| 145 | + register: sg_rule |
| 146 | +- name: verify icmp rule |
| 147 | + assert: |
| 148 | + that: |
| 149 | + - sg_rule is successful |
| 150 | + - sg_rule is changed |
| 151 | + - sg_rule.type == 'ingress' |
| 152 | + - sg_rule.security_group == 'default' |
| 153 | + - sg_rule.cidr == '0.0.0.0/0' |
| 154 | + - sg_rule.protocol == 'icmp' |
| 155 | + - sg_rule.icmp_code == -1 |
| 156 | + - sg_rule.icmp_type == -1 |
| 157 | + |
| 158 | +- name: test remove icmp rule idempotence |
| 159 | + ngine_io.cloudstack.security_group_rule: |
| 160 | + security_group: default |
| 161 | + protocol: icmp |
| 162 | + type: ingress |
| 163 | + icmp_type: -1 |
| 164 | + icmp_code: -1 |
| 165 | + state: absent |
| 166 | + register: sg_rule |
| 167 | +- name: verify icmp rule idempotence |
| 168 | + assert: |
| 169 | + that: |
| 170 | + - sg_rule is successful |
| 171 | + - sg_rule is not changed |
0 commit comments