|
| 1 | +--- |
| 2 | +- name: setup vpc |
| 3 | + ngine_io.cloudstack.vpc: |
| 4 | + name: my_vpc |
| 5 | + display_text: my_vpc |
| 6 | + cidr: 10.79.1.1/16 |
| 7 | + zone: "{{ cs_common_zone_adv }}" |
| 8 | + register: vpc |
| 9 | +- name: verify setup vpc |
| 10 | + assert: |
| 11 | + that: |
| 12 | + - vpc is successful |
| 13 | + |
| 14 | +- name: setup customer gateway |
| 15 | + ngine_io.cloudstack.vpn_customer_gateway: |
| 16 | + name: my_vpn_customer_gateway |
| 17 | + cidr: 192.168.79.0/24 |
| 18 | + esp_policy: aes256-sha1;modp1536 |
| 19 | + gateway: 10.79.1.1 |
| 20 | + ike_policy: aes256-sha1;modp1536 |
| 21 | + ipsec_psk: verysecurepassphrase |
| 22 | + esp_lifetime: 3600 |
| 23 | + register: vcg |
| 24 | +- name: setup customer gateway |
| 25 | + assert: |
| 26 | + that: |
| 27 | + - vcg is successful |
| 28 | + |
| 29 | +- name: setup remove vpn connection |
| 30 | + ngine_io.cloudstack.vpn_connection: |
| 31 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 32 | + vpc: my_vpc |
| 33 | + zone: "{{ cs_common_zone_adv }}" |
| 34 | + state: absent |
| 35 | + register: vpn_conn |
| 36 | +- name: verify setup remove vpn connection |
| 37 | + assert: |
| 38 | + that: |
| 39 | + - vpn_conn is successful |
| 40 | + |
| 41 | +- name: setup vpn gateway absent |
| 42 | + ngine_io.cloudstack.vpn_gateway: |
| 43 | + vpc: my_vpc |
| 44 | + zone: "{{ cs_common_zone_adv }}" |
| 45 | + state: absent |
| 46 | + register: vpn_gateway |
| 47 | +- name: verify setup vpn gateway absent |
| 48 | + assert: |
| 49 | + that: |
| 50 | + - vpn_gateway is successful |
| 51 | + |
| 52 | +- name: test fail create vpn connection without gateway and force |
| 53 | + ngine_io.cloudstack.vpn_connection: |
| 54 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 55 | + vpc: my_vpc |
| 56 | + zone: "{{ cs_common_zone_adv }}" |
| 57 | + ignore_errors: yes |
| 58 | + register: vpn_conn |
| 59 | +- name: verify test fail create vpn connection without gateway and force |
| 60 | + assert: |
| 61 | + that: |
| 62 | + - vpn_conn is failed |
| 63 | + - vpn_conn.msg == "VPN gateway not found and not forced to create one" |
| 64 | + |
| 65 | +- name: test create vpn connection with force in check mode |
| 66 | + ngine_io.cloudstack.vpn_connection: |
| 67 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 68 | + vpc: my_vpc |
| 69 | + force: yes |
| 70 | + zone: "{{ cs_common_zone_adv }}" |
| 71 | + check_mode: yes |
| 72 | + register: vpn_conn |
| 73 | +- name: verify test create vpn connection with force in check mode |
| 74 | + assert: |
| 75 | + that: |
| 76 | + - vpn_conn is changed |
| 77 | + |
| 78 | +- name: test create vpn connection with force |
| 79 | + ngine_io.cloudstack.vpn_connection: |
| 80 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 81 | + vpc: my_vpc |
| 82 | + force: yes |
| 83 | + zone: "{{ cs_common_zone_adv }}" |
| 84 | + register: vpn_conn |
| 85 | +- name: verify test create vpn connection with force |
| 86 | + assert: |
| 87 | + that: |
| 88 | + - vpn_conn is changed |
| 89 | + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" |
| 90 | + - vpn_conn.vpc == "my_vpc" |
| 91 | + |
| 92 | +- name: test create vpn connection with force idempotence |
| 93 | + ngine_io.cloudstack.vpn_connection: |
| 94 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 95 | + vpc: my_vpc |
| 96 | + force: yes |
| 97 | + zone: "{{ cs_common_zone_adv }}" |
| 98 | + register: vpn_conn |
| 99 | +- name: verify test create vpn connection with force idempotence |
| 100 | + assert: |
| 101 | + that: |
| 102 | + - vpn_conn is not changed |
| 103 | + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" |
| 104 | + - vpn_conn.vpc == "my_vpc" |
| 105 | + |
| 106 | +- name: test remove vpn connection in check mode |
| 107 | + ngine_io.cloudstack.vpn_connection: |
| 108 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 109 | + vpc: my_vpc |
| 110 | + zone: "{{ cs_common_zone_adv }}" |
| 111 | + state: absent |
| 112 | + check_mode: yes |
| 113 | + register: vpn_conn |
| 114 | +- name: verify test remove vpn connection in check mode |
| 115 | + assert: |
| 116 | + that: |
| 117 | + - vpn_conn is changed |
| 118 | + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" |
| 119 | + - vpn_conn.vpc == "my_vpc" |
| 120 | + |
| 121 | +- name: test remove vpn connection |
| 122 | + ngine_io.cloudstack.vpn_connection: |
| 123 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 124 | + vpc: my_vpc |
| 125 | + zone: "{{ cs_common_zone_adv }}" |
| 126 | + state: absent |
| 127 | + register: vpn_conn |
| 128 | +- name: verify test remove vpn connection |
| 129 | + assert: |
| 130 | + that: |
| 131 | + - vpn_conn is changed |
| 132 | + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" |
| 133 | + - vpn_conn.vpc == "my_vpc" |
| 134 | + |
| 135 | +- name: test remove vpn connection idempotence |
| 136 | + ngine_io.cloudstack.vpn_connection: |
| 137 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 138 | + vpc: my_vpc |
| 139 | + zone: "{{ cs_common_zone_adv }}" |
| 140 | + state: absent |
| 141 | + register: vpn_conn |
| 142 | +- name: verify test remove vpn connection idempotence |
| 143 | + assert: |
| 144 | + that: |
| 145 | + - vpn_conn is not changed |
| 146 | + |
| 147 | +- name: setup create vpn gateway |
| 148 | + ngine_io.cloudstack.vpn_gateway: |
| 149 | + vpc: my_vpc |
| 150 | + zone: "{{ cs_common_zone_adv }}" |
| 151 | + register: vpn_gateway |
| 152 | +- name: verify setup create vpn gateway |
| 153 | + assert: |
| 154 | + that: |
| 155 | + - vpn_gateway is success |
| 156 | + |
| 157 | +- name: test create vpn connection without force in check mode |
| 158 | + ngine_io.cloudstack.vpn_connection: |
| 159 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 160 | + vpc: my_vpc |
| 161 | + zone: "{{ cs_common_zone_adv }}" |
| 162 | + check_mode: yes |
| 163 | + register: vpn_conn |
| 164 | +- name: verify test create vpn connection without force in check mode |
| 165 | + assert: |
| 166 | + that: |
| 167 | + - vpn_conn is changed |
| 168 | + |
| 169 | +- name: test create vpn connection without force |
| 170 | + ngine_io.cloudstack.vpn_connection: |
| 171 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 172 | + vpc: my_vpc |
| 173 | + zone: "{{ cs_common_zone_adv }}" |
| 174 | + register: vpn_conn |
| 175 | +- name: verify test create vpn connection without force |
| 176 | + assert: |
| 177 | + that: |
| 178 | + - vpn_conn is changed |
| 179 | + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" |
| 180 | + - vpn_conn.vpc == "my_vpc" |
| 181 | + |
| 182 | +- name: test create vpn connection without force |
| 183 | + ngine_io.cloudstack.vpn_connection: |
| 184 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 185 | + vpc: my_vpc |
| 186 | + zone: "{{ cs_common_zone_adv }}" |
| 187 | + register: vpn_conn |
| 188 | +- name: verify test create vpn connection without force |
| 189 | + assert: |
| 190 | + that: |
| 191 | + - vpn_conn is not changed |
| 192 | + - vpn_conn.vpn_customer_gateway == "my_vpn_customer_gateway" |
| 193 | + - vpn_conn.vpc == "my_vpc" |
| 194 | + |
| 195 | +- name: cleanup remove vpn connection |
| 196 | + ngine_io.cloudstack.vpn_connection: |
| 197 | + vpn_customer_gateway: my_vpn_customer_gateway |
| 198 | + vpc: my_vpc |
| 199 | + zone: "{{ cs_common_zone_adv }}" |
| 200 | + state: absent |
| 201 | + register: vpn_conn |
| 202 | +- name: verify cleanup remove vpn connection idempotence |
| 203 | + assert: |
| 204 | + that: |
| 205 | + - vpn_conn is successful |
0 commit comments