| 1 |
--- |
| 2 |
# tasks file for Route53 integration tests |
| 3 |
|
| 4 |
- ansible.builtin.set_fact: |
| 5 |
zone_one: '{{ resource_prefix | replace("-", "") }}.one.ansible.test.' |
| 6 |
zone_two: '{{ resource_prefix | replace("-", "") }}.two.ansible.test.' |
| 7 |
- ansible.builtin.debug: |
| 8 |
msg: Set zones {{ zone_one }} and {{ zone_two }} |
| 9 |
|
| 10 |
- name: Test basics (new zone, A and AAAA records) |
| 11 |
module_defaults: |
| 12 |
group/aws: |
| 13 |
access_key: "{{ aws_access_key }}" |
| 14 |
secret_key: "{{ aws_secret_key }}" |
| 15 |
session_token: "{{ security_token | default(omit) }}" |
| 16 |
region: "{{ aws_region }}" |
| 17 |
amazon.aws.route53: |
| 18 |
# Route53 is explicitly a global service |
| 19 |
region: |
| 20 |
block: |
| 21 |
- name: Create VPC |
| 22 |
amazon.aws.ec2_vpc_net: |
| 23 |
cidr_block: 192.0.2.0/24 |
| 24 |
name: "{{ resource_prefix }}_vpc" |
| 25 |
state: present |
| 26 |
register: vpc |
| 27 |
|
| 28 |
- name: Create a zone |
| 29 |
amazon.aws.route53_zone: |
| 30 |
zone: "{{ zone_one }}" |
| 31 |
comment: Created in Ansible test {{ resource_prefix }} |
| 32 |
tags: |
| 33 |
TestTag: "{{ resource_prefix }}.z1" |
| 34 |
register: z1 |
| 35 |
- ansible.builtin.assert: |
| 36 |
that: |
| 37 |
- z1 is success |
| 38 |
- z1 is changed |
| 39 |
- z1.comment == 'Created in Ansible test '+resource_prefix |
| 40 |
- z1.tags.TestTag == resource_prefix +'.z1' |
| 41 |
|
| 42 |
- name: Get zone details |
| 43 |
amazon.aws.route53_info: |
| 44 |
query: hosted_zone |
| 45 |
hosted_zone_id: "{{ z1.zone_id }}" |
| 46 |
hosted_zone_method: details |
| 47 |
register: hosted_zones |
| 48 |
- name: Assert newly created hosted zone only has NS and SOA records |
| 49 |
ansible.builtin.assert: |
| 50 |
that: |
| 51 |
- hosted_zones.HostedZone.ResourceRecordSetCount == 2 |
| 52 |
|
| 53 |
- name: Create a second zone |
| 54 |
amazon.aws.route53_zone: |
| 55 |
zone: "{{ zone_two }}" |
| 56 |
vpc_id: "{{ vpc.vpc.id }}" |
| 57 |
vpc_region: "{{ aws_region }}" |
| 58 |
comment: Created in Ansible test {{ resource_prefix }} |
| 59 |
tags: |
| 60 |
TestTag: "{{ resource_prefix }}.z2" |
| 61 |
register: z2 |
| 62 |
- ansible.builtin.assert: |
| 63 |
that: |
| 64 |
- z2 is success |
| 65 |
- z2 is changed |
| 66 |
- z2.comment == 'Created in Ansible test '+resource_prefix |
| 67 |
- z2.tags.TestTag == resource_prefix +'.z2' |
| 68 |
|
| 69 |
- name: Get zone details |
| 70 |
amazon.aws.route53_info: |
| 71 |
query: hosted_zone |
| 72 |
hosted_zone_id: "{{ z2.zone_id }}" |
| 73 |
hosted_zone_method: details |
| 74 |
register: hosted_zones |
| 75 |
|
| 76 |
- name: Assert newly created hosted zone only has NS and SOA records |
| 77 |
ansible.builtin.assert: |
| 78 |
that: |
| 79 |
- hosted_zones.HostedZone.ResourceRecordSetCount == 2 |
| 80 |
- hosted_zones.HostedZone.Config.PrivateZone |
| 81 |
|
| 82 |
# Ensure that we can use the non-paginated list_by_name method with max_items |
| 83 |
- name: Get zone 1 details only |
| 84 |
amazon.aws.route53_info: |
| 85 |
query: hosted_zone |
| 86 |
hosted_zone_method: list_by_name |
| 87 |
dns_name: "{{ zone_one }}" |
| 88 |
max_items: 1 |
| 89 |
register: list_by_name_result |
| 90 |
|
| 91 |
- name: Assert that we found exactly one zone when querying by name |
| 92 |
ansible.builtin.assert: |
| 93 |
that: |
| 94 |
- list_by_name_result.hosted_zones | length == 1 |
| 95 |
- list_by_name_result.hosted_zones[0].name == zone_one |
| 96 |
|
| 97 |
- name: Create A record using zone fqdn |
| 98 |
amazon.aws.route53: |
| 99 |
state: present |
| 100 |
zone: "{{ zone_one }}" |
| 101 |
record: qdn_test.{{ zone_one }} |
| 102 |
type: A |
| 103 |
value: 192.0.2.1 |
| 104 |
register: qdn |
| 105 |
- ansible.builtin.assert: |
| 106 |
that: |
| 107 |
- qdn is not failed |
| 108 |
- qdn is changed |
| 109 |
- "'wait_id' in qdn" |
| 110 |
- qdn.wait_id is string |
| 111 |
|
| 112 |
- name: Get A record using "get" method of route53 module |
| 113 |
amazon.aws.route53: |
| 114 |
state: get |
| 115 |
zone: "{{ zone_one }}" |
| 116 |
record: qdn_test.{{ zone_one }} |
| 117 |
type: A |
| 118 |
register: get_result |
| 119 |
- name: Check boto3 type get data |
| 120 |
ansible.builtin.assert: |
| 121 |
that: |
| 122 |
- get_result.nameservers | length > 0 |
| 123 |
- get_result.resource_record_sets | length == 1 |
| 124 |
- '"name" in record_set' |
| 125 |
- record_set.name == qdn_record |
| 126 |
- '"resource_records" in record_set' |
| 127 |
- record_set.resource_records | length == 1 |
| 128 |
- '"value" in record_set.resource_records[0]' |
| 129 |
- record_set.resource_records[0].value == '192.0.2.1' |
| 130 |
- '"ttl" in record_set' |
| 131 |
- record_set.ttl == 3600 |
| 132 |
- '"type" in record_set' |
| 133 |
- record_set.type == 'A' |
| 134 |
vars: |
| 135 |
record_set: "{{ get_result.resource_record_sets[0] }}" |
| 136 |
qdn_record: qdn_test.{{ zone_one }} |
| 137 |
|
| 138 |
- name: Check boto3 compat get data |
| 139 |
ansible.builtin.assert: |
| 140 |
that: |
| 141 |
- '"set" in get_result' |
| 142 |
- '"Name" in record_set' |
| 143 |
- record_set.Name == qdn_record |
| 144 |
- '"ResourceRecords" in record_set' |
| 145 |
- record_set.ResourceRecords | length == 1 |
| 146 |
- '"Value" in record_set.ResourceRecords[0]' |
| 147 |
- record_set.ResourceRecords[0].Value == '192.0.2.1' |
| 148 |
- '"TTL" in record_set' |
| 149 |
- record_set.TTL == 3600 |
| 150 |
- record_set.Type == 'A' |
| 151 |
vars: |
| 152 |
record_set: "{{ get_result.set }}" |
| 153 |
qdn_record: qdn_test.{{ zone_one }} |
| 154 |
|
| 155 |
- name: Check boto2 compat get data |
| 156 |
ansible.builtin.assert: |
| 157 |
that: |
| 158 |
- '"set" in get_result' |
| 159 |
- '"alias" in record_set' |
| 160 |
- record_set.alias == False |
| 161 |
- '"failover" in record_set' |
| 162 |
- '"health_check" in record_set' |
| 163 |
- '"hosted_zone_id" in record_set' |
| 164 |
- record_set.hosted_zone_id == z1.zone_id |
| 165 |
- '"identifier" in record_set' |
| 166 |
- '"record" in record_set' |
| 167 |
- record_set.record == qdn_record |
| 168 |
- '"ttl" in record_set' |
| 169 |
- record_set.ttl == "3600" |
| 170 |
- '"type" in record_set' |
| 171 |
- record_set.type == 'A' |
| 172 |
- '"value" in record_set' |
| 173 |
- record_set.value == '192.0.2.1' |
| 174 |
- '"values" in record_set' |
| 175 |
- record_set['values'] | length == 1 |
| 176 |
- record_set['values'][0] == '192.0.2.1' |
| 177 |
- '"weight" in record_set' |
| 178 |
- '"zone" in record_set' |
| 179 |
- record_set.zone == zone_one |
| 180 |
vars: |
| 181 |
record_set: "{{ get_result.set }}" |
| 182 |
qdn_record: qdn_test.{{ zone_one }} |
| 183 |
|
| 184 |
## test A recordset creation and order adjustments |
| 185 |
- name: Create same A record using zone non-qualified domain |
| 186 |
amazon.aws.route53: |
| 187 |
state: present |
| 188 |
zone: "{{ zone_one[:-1] }}" |
| 189 |
record: qdn_test.{{ zone_one[:-1] }} |
| 190 |
type: A |
| 191 |
value: 192.0.2.1 |
| 192 |
register: non_qdn |
| 193 |
- ansible.builtin.assert: |
| 194 |
that: |
| 195 |
- non_qdn is not failed |
| 196 |
- non_qdn is not changed |
| 197 |
- "'wait_id' not in non_qdn" |
| 198 |
|
| 199 |
- name: Create A record using zone ID |
| 200 |
amazon.aws.route53: |
| 201 |
state: present |
| 202 |
hosted_zone_id: "{{ z1.zone_id }}" |
| 203 |
record: zid_test.{{ zone_one }} |
| 204 |
type: A |
| 205 |
value: 192.0.2.1 |
| 206 |
register: zid |
| 207 |
- ansible.builtin.assert: |
| 208 |
that: |
| 209 |
- zid is not failed |
| 210 |
- zid is changed |
| 211 |
|
| 212 |
- name: Create a multi-value A record with values in different order |
| 213 |
amazon.aws.route53: |
| 214 |
state: present |
| 215 |
zone: "{{ zone_one }}" |
| 216 |
record: order_test.{{ zone_one }} |
| 217 |
type: A |
| 218 |
value: |
| 219 |
- 192.0.2.2 |
| 220 |
- 192.0.2.1 |
| 221 |
register: mv_a_record |
| 222 |
- ansible.builtin.assert: |
| 223 |
that: |
| 224 |
- mv_a_record is not failed |
| 225 |
- mv_a_record is changed |
| 226 |
|
| 227 |
- name: Create same multi-value A record with values in different order |
| 228 |
amazon.aws.route53: |
| 229 |
state: present |
| 230 |
zone: "{{ zone_one }}" |
| 231 |
record: order_test.{{ zone_one }} |
| 232 |
type: A |
| 233 |
value: |
| 234 |
- 192.0.2.2 |
| 235 |
- 192.0.2.1 |
| 236 |
register: mv_a_record |
| 237 |
- ansible.builtin.assert: |
| 238 |
that: |
| 239 |
- mv_a_record is not failed |
| 240 |
- mv_a_record is not changed |
| 241 |
|
| 242 |
# Get resulting A record and ensure max_items is applied |
| 243 |
- name: Get Route53 A record information |
| 244 |
amazon.aws.route53_info: |
| 245 |
type: A |
| 246 |
query: record_sets |
| 247 |
hosted_zone_id: "{{ z1.zone_id }}" |
| 248 |
start_record_name: order_test.{{ zone_one }} |
| 249 |
max_items: 1 |
| 250 |
register: records |
| 251 |
|
| 252 |
- ansible.builtin.assert: |
| 253 |
that: |
| 254 |
- records.resource_record_sets|length == 1 |
| 255 |
- records.resource_record_sets[0].resource_records|length == 2 |
| 256 |
- records.resource_record_sets[0].resource_records[0].value == '192.0.2.2' |
| 257 |
- records.resource_record_sets[0].resource_records[1].value == '192.0.2.1' |
| 258 |
|
| 259 |
- name: Remove a member from multi-value A record with values in different order |
| 260 |
amazon.aws.route53: |
| 261 |
state: present |
| 262 |
zone: "{{ zone_one }}" |
| 263 |
record: order_test.{{ zone_one }} |
| 264 |
type: A |
| 265 |
value: |
| 266 |
- 192.0.2.2 |
| 267 |
register: del_a_record |
| 268 |
ignore_errors: true |
| 269 |
- name: This should fail, because `overwrite` is false |
| 270 |
ansible.builtin.assert: |
| 271 |
that: |
| 272 |
- del_a_record is failed |
| 273 |
|
| 274 |
- name: Remove a member from multi-value A record with values in different order |
| 275 |
amazon.aws.route53: |
| 276 |
state: present |
| 277 |
zone: "{{ zone_one }}" |
| 278 |
record: order_test.{{ zone_one }} |
| 279 |
overwrite: true |
| 280 |
type: A |
| 281 |
value: |
| 282 |
- 192.0.2.2 |
| 283 |
register: del_a_record |
| 284 |
ignore_errors: true |
| 285 |
|
| 286 |
- name: This should not fail, because `overwrite` is true |
| 287 |
ansible.builtin.assert: |
| 288 |
that: |
| 289 |
- del_a_record is not failed |
| 290 |
- del_a_record is changed |
| 291 |
|
| 292 |
- name: Get Route53 zone A record information |
| 293 |
amazon.aws.route53_info: |
| 294 |
type: A |
| 295 |
query: record_sets |
| 296 |
hosted_zone_id: "{{ z1.zone_id }}" |
| 297 |
start_record_name: order_test.{{ zone_one }} |
| 298 |
max_items: 50 |
| 299 |
register: records |
| 300 |
|
| 301 |
- ansible.builtin.assert: |
| 302 |
that: |
| 303 |
- records.resource_record_sets|length == 3 |
| 304 |
- records.resource_record_sets[0].resource_records|length == 1 |
| 305 |
- records.resource_record_sets[0].resource_records[0].value == '192.0.2.2' |
| 306 |
|
| 307 |
## Test CNAME record creation and retrive info |
| 308 |
- name: Create CNAME record |
| 309 |
amazon.aws.route53: |
| 310 |
state: present |
| 311 |
zone: "{{ zone_one }}" |
| 312 |
type: CNAME |
| 313 |
record: cname_test.{{ zone_one }} |
| 314 |
value: order_test.{{ zone_one }} |
| 315 |
register: cname_record |
| 316 |
|
| 317 |
- ansible.builtin.assert: |
| 318 |
that: |
| 319 |
- cname_record is not failed |
| 320 |
- cname_record is changed |
| 321 |
|
| 322 |
- name: Get Route53 CNAME record information |
| 323 |
amazon.aws.route53_info: |
| 324 |
type: CNAME |
| 325 |
query: record_sets |
| 326 |
hosted_zone_id: "{{ z1.zone_id }}" |
| 327 |
start_record_name: cname_test.{{ zone_one }} |
| 328 |
max_items: 1 |
| 329 |
register: cname_records |
| 330 |
|
| 331 |
- ansible.builtin.assert: |
| 332 |
that: |
| 333 |
- cname_records.resource_record_sets|length == 1 |
| 334 |
- cname_records.resource_record_sets[0].resource_records|length == 1 |
| 335 |
- cname_records.resource_record_sets[0].resource_records[0].value == "order_test."+zone_one |
| 336 |
|
| 337 |
## Test CAA record creation |
| 338 |
- name: Create a LetsEncrypt CAA record |
| 339 |
amazon.aws.route53: |
| 340 |
state: present |
| 341 |
zone: "{{ zone_one }}" |
| 342 |
record: "{{ zone_one }}" |
| 343 |
type: CAA |
| 344 |
value: |
| 345 |
- "0 issue \"letsencrypt.org;\"" |
| 346 |
- "0 issuewild \"letsencrypt.org;\"" |
| 347 |
overwrite: true |
| 348 |
register: caa |
| 349 |
- ansible.builtin.assert: |
| 350 |
that: |
| 351 |
- caa is not failed |
| 352 |
- caa is changed |
| 353 |
|
| 354 |
- name: Re-create the same LetsEncrypt CAA record |
| 355 |
amazon.aws.route53: |
| 356 |
state: present |
| 357 |
zone: "{{ zone_one }}" |
| 358 |
record: "{{ zone_one }}" |
| 359 |
type: CAA |
| 360 |
value: |
| 361 |
- "0 issue \"letsencrypt.org;\"" |
| 362 |
- "0 issuewild \"letsencrypt.org;\"" |
| 363 |
overwrite: true |
| 364 |
register: caa |
| 365 |
- ansible.builtin.assert: |
| 366 |
that: |
| 367 |
- caa is not failed |
| 368 |
- caa is not changed |
| 369 |
|
| 370 |
- name: Re-create the same LetsEncrypt CAA record in opposite-order |
| 371 |
amazon.aws.route53: |
| 372 |
state: present |
| 373 |
zone: "{{ zone_one }}" |
| 374 |
record: "{{ zone_one }}" |
| 375 |
type: CAA |
| 376 |
value: |
| 377 |
- "0 issuewild \"letsencrypt.org;\"" |
| 378 |
- "0 issue \"letsencrypt.org;\"" |
| 379 |
overwrite: true |
| 380 |
register: caa |
| 381 |
- name: This should not be changed, as CAA records are not order sensitive |
| 382 |
ansible.builtin.assert: |
| 383 |
that: |
| 384 |
- caa is not failed |
| 385 |
- caa is not changed |
| 386 |
|
| 387 |
- name: Create an A record for a wildcard prefix |
| 388 |
amazon.aws.route53: |
| 389 |
state: present |
| 390 |
zone: "{{ zone_one }}" |
| 391 |
record: "*.wildcard_test.{{ zone_one }}" |
| 392 |
type: A |
| 393 |
value: |
| 394 |
- 192.0.2.1 |
| 395 |
register: wc_a_record |
| 396 |
- ansible.builtin.assert: |
| 397 |
that: |
| 398 |
- wc_a_record is not failed |
| 399 |
- wc_a_record is changed |
| 400 |
|
| 401 |
- name: Create an A record for a wildcard prefix (idempotency) |
| 402 |
amazon.aws.route53: |
| 403 |
state: present |
| 404 |
zone: "{{ zone_one }}" |
| 405 |
record: "*.wildcard_test.{{ zone_one }}" |
| 406 |
type: A |
| 407 |
value: |
| 408 |
- 192.0.2.1 |
| 409 |
register: wc_a_record |
| 410 |
- ansible.builtin.assert: |
| 411 |
that: |
| 412 |
- wc_a_record is not failed |
| 413 |
- wc_a_record is not changed |
| 414 |
|
| 415 |
- name: Create an A record for a wildcard prefix (change) |
| 416 |
amazon.aws.route53: |
| 417 |
state: present |
| 418 |
zone: "{{ zone_one }}" |
| 419 |
record: "*.wildcard_test.{{ zone_one }}" |
| 420 |
type: A |
| 421 |
value: |
| 422 |
- 192.0.2.2 |
| 423 |
overwrite: true |
| 424 |
register: wc_a_record |
| 425 |
- ansible.builtin.assert: |
| 426 |
that: |
| 427 |
- wc_a_record is not failed |
| 428 |
- wc_a_record is changed |
| 429 |
|
| 430 |
- name: Delete an A record for a wildcard prefix |
| 431 |
amazon.aws.route53: |
| 432 |
state: absent |
| 433 |
zone: "{{ zone_one }}" |
| 434 |
record: "*.wildcard_test.{{ zone_one }}" |
| 435 |
type: A |
| 436 |
value: |
| 437 |
- 192.0.2.2 |
| 438 |
diff: true |
| 439 |
register: wc_a_record |
| 440 |
- ansible.builtin.assert: |
| 441 |
that: |
| 442 |
- wc_a_record is not failed |
| 443 |
- wc_a_record is changed |
| 444 |
- wc_a_record.diff.after == {} |
| 445 |
|
| 446 |
- name: Create a record with different TTL |
| 447 |
amazon.aws.route53: |
| 448 |
state: present |
| 449 |
zone: "{{ zone_one }}" |
| 450 |
record: localhost.{{ zone_one }} |
| 451 |
type: A |
| 452 |
value: 127.0.0.1 |
| 453 |
ttl: 30 |
| 454 |
register: ttl30 |
| 455 |
- name: Check return values |
| 456 |
ansible.builtin.assert: |
| 457 |
that: |
| 458 |
- ttl30.resource_record_sets[0].ttl == "30" |
| 459 |
- ttl30 is changed |
| 460 |
|
| 461 |
- name: Delete previous record without mention ttl and value |
| 462 |
amazon.aws.route53: |
| 463 |
state: absent |
| 464 |
zone: "{{ zone_one }}" |
| 465 |
record: localhost.{{ zone_one }} |
| 466 |
type: A |
| 467 |
register: ttl30 |
| 468 |
- name: Check if record is deleted |
| 469 |
ansible.builtin.assert: |
| 470 |
that: |
| 471 |
- ttl30 is changed |
| 472 |
|
| 473 |
- name: Immutable delete previous record without mention ttl and value |
| 474 |
amazon.aws.route53: |
| 475 |
state: absent |
| 476 |
zone: "{{ zone_one }}" |
| 477 |
record: localhost.{{ zone_one }} |
| 478 |
type: A |
| 479 |
register: ttl30 |
| 480 |
- name: Check if record was deleted |
| 481 |
ansible.builtin.assert: |
| 482 |
that: |
| 483 |
- ttl30 is not changed |
| 484 |
|
| 485 |
# Tests on zone two (private zone) |
| 486 |
- name: Create A record using zone fqdn |
| 487 |
amazon.aws.route53: |
| 488 |
state: present |
| 489 |
zone: "{{ zone_two }}" |
| 490 |
record: qdn_test.{{ zone_two }} |
| 491 |
type: A |
| 492 |
value: 192.0.2.1 |
| 493 |
private_zone: true |
| 494 |
register: qdn |
| 495 |
- ansible.builtin.assert: |
| 496 |
that: |
| 497 |
- qdn is not failed |
| 498 |
- qdn is changed |
| 499 |
|
| 500 |
- name: Get A record using 'get' method of route53 module |
| 501 |
amazon.aws.route53: |
| 502 |
state: get |
| 503 |
zone: "{{ zone_two }}" |
| 504 |
record: qdn_test.{{ zone_two }} |
| 505 |
type: A |
| 506 |
private_zone: true |
| 507 |
register: get_result |
| 508 |
- ansible.builtin.assert: |
| 509 |
that: |
| 510 |
- get_result.nameservers|length > 0 |
| 511 |
- get_result.set.Name == "qdn_test."+zone_two |
| 512 |
- get_result.set.ResourceRecords[0].Value == "192.0.2.1" |
| 513 |
- get_result.set.Type == "A" |
| 514 |
|
| 515 |
- name: Get a record that does not exist |
| 516 |
amazon.aws.route53: |
| 517 |
state: get |
| 518 |
zone: "{{ zone_two }}" |
| 519 |
record: notfound.{{ zone_two }} |
| 520 |
type: A |
| 521 |
private_zone: true |
| 522 |
register: get_result |
| 523 |
- ansible.builtin.assert: |
| 524 |
that: |
| 525 |
- get_result.nameservers|length > 0 |
| 526 |
- get_result.set|length == 0 |
| 527 |
- get_result.resource_record_sets|length == 0 |
| 528 |
|
| 529 |
- name: Create same A record using zone non-qualified domain |
| 530 |
amazon.aws.route53: |
| 531 |
state: present |
| 532 |
zone: "{{ zone_two[:-1] }}" |
| 533 |
record: qdn_test.{{ zone_two[:-1] }} |
| 534 |
type: A |
| 535 |
value: 192.0.2.1 |
| 536 |
private_zone: true |
| 537 |
register: non_qdn |
| 538 |
- ansible.builtin.assert: |
| 539 |
that: |
| 540 |
- non_qdn is not failed |
| 541 |
- non_qdn is not changed |
| 542 |
|
| 543 |
- name: Create A record using zone ID |
| 544 |
amazon.aws.route53: |
| 545 |
state: present |
| 546 |
hosted_zone_id: "{{ z2.zone_id }}" |
| 547 |
record: zid_test.{{ zone_two }} |
| 548 |
type: A |
| 549 |
value: 192.0.2.2 |
| 550 |
private_zone: true |
| 551 |
register: zid |
| 552 |
- ansible.builtin.assert: |
| 553 |
that: |
| 554 |
- zid is not failed |
| 555 |
- zid is changed |
| 556 |
|
| 557 |
- name: Create A record using zone fqdn and vpc_id |
| 558 |
amazon.aws.route53: |
| 559 |
state: present |
| 560 |
zone: "{{ zone_two }}" |
| 561 |
record: qdn_test_vpc.{{ zone_two }} |
| 562 |
type: A |
| 563 |
value: 192.0.2.3 |
| 564 |
private_zone: true |
| 565 |
vpc_id: "{{ vpc.vpc.id }}" |
| 566 |
register: qdn |
| 567 |
- ansible.builtin.assert: |
| 568 |
that: |
| 569 |
- qdn is not failed |
| 570 |
- qdn is changed |
| 571 |
|
| 572 |
- name: Create A record using zone ID and vpc_id |
| 573 |
amazon.aws.route53: |
| 574 |
state: present |
| 575 |
hosted_zone_id: "{{ z2.zone_id }}" |
| 576 |
record: zid_test_vpc.{{ zone_two }} |
| 577 |
type: A |
| 578 |
value: 192.0.2.4 |
| 579 |
private_zone: true |
| 580 |
vpc_id: "{{ vpc.vpc.id }}" |
| 581 |
register: zid |
| 582 |
- ansible.builtin.assert: |
| 583 |
that: |
| 584 |
- zid is not failed |
| 585 |
- zid is changed |
| 586 |
|
| 587 |
- name: Create an Alias record |
| 588 |
amazon.aws.route53: |
| 589 |
state: present |
| 590 |
zone: "{{ zone_one }}" |
| 591 |
record: alias.{{ zone_one }} |
| 592 |
type: A |
| 593 |
alias: true |
| 594 |
alias_hosted_zone_id: "{{ z1.zone_id }}" |
| 595 |
value: zid_test.{{ zone_one }} |
| 596 |
overwrite: true |
| 597 |
register: alias_record |
| 598 |
- name: This should be changed |
| 599 |
ansible.builtin.assert: |
| 600 |
that: |
| 601 |
- alias_record is not failed |
| 602 |
- alias_record is changed |
| 603 |
|
| 604 |
- name: Re-Create an Alias record |
| 605 |
amazon.aws.route53: |
| 606 |
state: present |
| 607 |
zone: "{{ zone_one }}" |
| 608 |
record: alias.{{ zone_one }} |
| 609 |
type: A |
| 610 |
alias: true |
| 611 |
alias_hosted_zone_id: "{{ z1.zone_id }}" |
| 612 |
value: zid_test.{{ zone_one }} |
| 613 |
overwrite: true |
| 614 |
register: alias_record |
| 615 |
- name: This should not be changed |
| 616 |
ansible.builtin.assert: |
| 617 |
that: |
| 618 |
- alias_record is not failed |
| 619 |
- alias_record is not changed |
| 620 |
|
| 621 |
- name: Create a weighted record |
| 622 |
amazon.aws.route53: |
| 623 |
state: present |
| 624 |
zone: "{{ zone_one }}" |
| 625 |
record: weighted.{{ zone_one }} |
| 626 |
type: CNAME |
| 627 |
value: zid_test.{{ zone_one }} |
| 628 |
overwrite: true |
| 629 |
identifier: host1@www |
| 630 |
weight: 100 |
| 631 |
region: "{{ omit }}" |
| 632 |
register: weighted_record |
| 633 |
- name: This should be changed |
| 634 |
ansible.builtin.assert: |
| 635 |
that: |
| 636 |
- weighted_record is not failed |
| 637 |
- weighted_record is changed |
| 638 |
|
| 639 |
- name: Re-Create a weighted record |
| 640 |
amazon.aws.route53: |
| 641 |
state: present |
| 642 |
zone: "{{ zone_one }}" |
| 643 |
record: weighted.{{ zone_one }} |
| 644 |
type: CNAME |
| 645 |
value: zid_test.{{ zone_one }} |
| 646 |
overwrite: true |
| 647 |
identifier: host1@www |
| 648 |
weight: 100 |
| 649 |
region: "{{ omit }}" |
| 650 |
register: weighted_record |
| 651 |
- name: This should not be changed |
| 652 |
ansible.builtin.assert: |
| 653 |
that: |
| 654 |
- weighted_record is not failed |
| 655 |
- weighted_record is not changed |
| 656 |
|
| 657 |
- name: Create a zero weighted record |
| 658 |
amazon.aws.route53: |
| 659 |
state: present |
| 660 |
zone: "{{ zone_one }}" |
| 661 |
record: zero_weighted.{{ zone_one }} |
| 662 |
type: CNAME |
| 663 |
value: zid_test.{{ zone_one }} |
| 664 |
overwrite: true |
| 665 |
identifier: host1@www |
| 666 |
weight: 0 |
| 667 |
region: "{{ omit }}" |
| 668 |
register: weighted_record |
| 669 |
- name: This should be changed |
| 670 |
ansible.builtin.assert: |
| 671 |
that: |
| 672 |
- weighted_record is not failed |
| 673 |
- weighted_record is changed |
| 674 |
|
| 675 |
- name: Re-Create a zero weighted record |
| 676 |
amazon.aws.route53: |
| 677 |
state: present |
| 678 |
zone: "{{ zone_one }}" |
| 679 |
record: zero_weighted.{{ zone_one }} |
| 680 |
type: CNAME |
| 681 |
value: zid_test.{{ zone_one }} |
| 682 |
overwrite: true |
| 683 |
identifier: host1@www |
| 684 |
weight: 0 |
| 685 |
region: "{{ omit }}" |
| 686 |
register: weighted_record |
| 687 |
- name: This should not be changed |
| 688 |
ansible.builtin.assert: |
| 689 |
that: |
| 690 |
- weighted_record is not failed |
| 691 |
- weighted_record is not changed |
| 692 |
|
| 693 |
# Test Geo Location - Continent Code |
| 694 |
- name: Create a record with geo_location - continent_code (check_mode) |
| 695 |
amazon.aws.route53: |
| 696 |
state: present |
| 697 |
zone: "{{ zone_one }}" |
| 698 |
record: geo-test-1.{{ zone_one }} |
| 699 |
identifier: geohost1@www |
| 700 |
type: A |
| 701 |
value: 127.0.0.1 |
| 702 |
ttl: 30 |
| 703 |
geo_location: |
| 704 |
continent_code: NA |
| 705 |
check_mode: true |
| 706 |
register: create_geo_continent_check_mode |
| 707 |
- ansible.builtin.assert: |
| 708 |
that: |
| 709 |
- create_geo_continent_check_mode is changed |
| 710 |
- create_geo_continent_check_mode is not failed |
| 711 |
- '"route53:ChangeResourceRecordSets" not in create_geo_continent_check_mode.resource_actions' |
| 712 |
- '"wait_id" in create_geo_continent_check_mode' |
| 713 |
- create_geo_continent_check_mode.wait_id is none |
| 714 |
|
| 715 |
- name: Create a record with geo_location - continent_code |
| 716 |
amazon.aws.route53: |
| 717 |
state: present |
| 718 |
zone: "{{ zone_one }}" |
| 719 |
record: geo-test-1.{{ zone_one }} |
| 720 |
identifier: geohost1@www |
| 721 |
type: A |
| 722 |
value: 127.0.0.1 |
| 723 |
ttl: 30 |
| 724 |
geo_location: |
| 725 |
continent_code: NA |
| 726 |
register: create_geo_continent |
| 727 |
# Get resulting A record and geo_location parameters are applied |
| 728 |
- name: Get Route53 A record information |
| 729 |
amazon.aws.route53_info: |
| 730 |
type: A |
| 731 |
query: record_sets |
| 732 |
hosted_zone_id: "{{ z1.zone_id }}" |
| 733 |
start_record_name: geo-test-1.{{ zone_one }} |
| 734 |
max_items: 1 |
| 735 |
register: result |
| 736 |
|
| 737 |
- ansible.builtin.assert: |
| 738 |
that: |
| 739 |
- create_geo_continent is changed |
| 740 |
- create_geo_continent is not failed |
| 741 |
- '"route53:ChangeResourceRecordSets" in create_geo_continent.resource_actions' |
| 742 |
- result.resource_record_sets[0].geo_location.continent_code == "NA" |
| 743 |
|
| 744 |
- name: Create a record with geo_location - continent_code (idempotency) |
| 745 |
amazon.aws.route53: |
| 746 |
state: present |
| 747 |
zone: "{{ zone_one }}" |
| 748 |
record: geo-test-1.{{ zone_one }} |
| 749 |
identifier: geohost1@www |
| 750 |
type: A |
| 751 |
value: 127.0.0.1 |
| 752 |
ttl: 30 |
| 753 |
geo_location: |
| 754 |
continent_code: NA |
| 755 |
register: create_geo_continent_idem |
| 756 |
- ansible.builtin.assert: |
| 757 |
that: |
| 758 |
- create_geo_continent_idem is not changed |
| 759 |
- create_geo_continent_idem is not failed |
| 760 |
- '"route53:ChangeResourceRecordSets" not in create_geo_continent_idem.resource_actions' |
| 761 |
|
| 762 |
- name: Create a record with geo_location - continent_code (idempotency - check_mode) |
| 763 |
amazon.aws.route53: |
| 764 |
state: present |
| 765 |
zone: "{{ zone_one }}" |
| 766 |
record: geo-test-1.{{ zone_one }} |
| 767 |
identifier: geohost1@www |
| 768 |
type: A |
| 769 |
value: 127.0.0.1 |
| 770 |
ttl: 30 |
| 771 |
geo_location: |
| 772 |
continent_code: NA |
| 773 |
check_mode: true |
| 774 |
register: create_geo_continent_idem_check |
| 775 |
|
| 776 |
- ansible.builtin.assert: |
| 777 |
that: |
| 778 |
- create_geo_continent_idem_check is not changed |
| 779 |
- create_geo_continent_idem_check is not failed |
| 780 |
- '"route53:ChangeResourceRecordSets" not in create_geo_continent_idem_check.resource_actions' |
| 781 |
|
| 782 |
# Test Geo Location - Country Code |
| 783 |
- name: Create a record with geo_location - country_code (check_mode) |
| 784 |
amazon.aws.route53: |
| 785 |
state: present |
| 786 |
zone: "{{ zone_one }}" |
| 787 |
record: geo-test-2.{{ zone_one }} |
| 788 |
identifier: geohost2@www |
| 789 |
type: A |
| 790 |
value: 127.0.0.1 |
| 791 |
ttl: 30 |
| 792 |
geo_location: |
| 793 |
country_code: US |
| 794 |
check_mode: true |
| 795 |
register: create_geo_country_check_mode |
| 796 |
- ansible.builtin.assert: |
| 797 |
that: |
| 798 |
- create_geo_country_check_mode is changed |
| 799 |
- create_geo_country_check_mode is not failed |
| 800 |
- '"route53:ChangeResourceRecordSets" not in create_geo_country_check_mode.resource_actions' |
| 801 |
|
| 802 |
- name: Create a record with geo_location - country_code |
| 803 |
amazon.aws.route53: |
| 804 |
state: present |
| 805 |
zone: "{{ zone_one }}" |
| 806 |
record: geo-test-2.{{ zone_one }} |
| 807 |
identifier: geohost2@www |
| 808 |
type: A |
| 809 |
value: 127.0.0.1 |
| 810 |
ttl: 30 |
| 811 |
geo_location: |
| 812 |
country_code: US |
| 813 |
register: create_geo_country |
| 814 |
# Get resulting A record and geo_location parameters are applied |
| 815 |
- name: Get Route53 A record information |
| 816 |
amazon.aws.route53_info: |
| 817 |
type: A |
| 818 |
query: record_sets |
| 819 |
hosted_zone_id: "{{ z1.zone_id }}" |
| 820 |
start_record_name: geo-test-2.{{ zone_one }} |
| 821 |
max_items: 1 |
| 822 |
register: result |
| 823 |
- ansible.builtin.assert: |
| 824 |
that: |
| 825 |
- create_geo_country is changed |
| 826 |
- create_geo_country is not failed |
| 827 |
- '"route53:ChangeResourceRecordSets" in create_geo_country.resource_actions' |
| 828 |
- result.resource_record_sets[0].geo_location.country_code == "US" |
| 829 |
|
| 830 |
- name: Create a record with geo_location - country_code (idempotency) |
| 831 |
amazon.aws.route53: |
| 832 |
state: present |
| 833 |
zone: "{{ zone_one }}" |
| 834 |
record: geo-test-2.{{ zone_one }} |
| 835 |
identifier: geohost2@www |
| 836 |
type: A |
| 837 |
value: 127.0.0.1 |
| 838 |
ttl: 30 |
| 839 |
geo_location: |
| 840 |
country_code: US |
| 841 |
register: create_geo_country_idem |
| 842 |
- ansible.builtin.assert: |
| 843 |
that: |
| 844 |
- create_geo_country_idem is not changed |
| 845 |
- create_geo_country_idem is not failed |
| 846 |
- '"route53:ChangeResourceRecordSets" not in create_geo_country_idem.resource_actions' |
| 847 |
|
| 848 |
- name: Create a record with geo_location - country_code (idempotency - check_mode) |
| 849 |
amazon.aws.route53: |
| 850 |
state: present |
| 851 |
zone: "{{ zone_one }}" |
| 852 |
record: geo-test-2.{{ zone_one }} |
| 853 |
identifier: geohost2@www |
| 854 |
type: A |
| 855 |
value: 127.0.0.1 |
| 856 |
ttl: 30 |
| 857 |
geo_location: |
| 858 |
country_code: US |
| 859 |
check_mode: true |
| 860 |
register: create_geo_country_idem_check |
| 861 |
|
| 862 |
- ansible.builtin.assert: |
| 863 |
that: |
| 864 |
- create_geo_country_idem_check is not changed |
| 865 |
- create_geo_country_idem_check is not failed |
| 866 |
- '"route53:ChangeResourceRecordSets" not in create_geo_country_idem_check.resource_actions' |
| 867 |
|
| 868 |
# Test Geo Location - Subdivision Code |
| 869 |
- name: Create a record with geo_location - subdivision_code (check_mode) |
| 870 |
amazon.aws.route53: |
| 871 |
state: present |
| 872 |
zone: "{{ zone_one }}" |
| 873 |
record: geo-test-3.{{ zone_one }} |
| 874 |
identifier: geohost3@www |
| 875 |
type: A |
| 876 |
value: 127.0.0.1 |
| 877 |
ttl: 30 |
| 878 |
geo_location: |
| 879 |
country_code: US |
| 880 |
subdivision_code: TX |
| 881 |
check_mode: true |
| 882 |
register: create_geo_subdivision_check_mode |
| 883 |
- ansible.builtin.assert: |
| 884 |
that: |
| 885 |
- create_geo_subdivision_check_mode is changed |
| 886 |
- create_geo_subdivision_check_mode is not failed |
| 887 |
- '"route53:ChangeResourceRecordSets" not in create_geo_subdivision_check_mode.resource_actions' |
| 888 |
|
| 889 |
- name: Create a record with geo_location - subdivision_code |
| 890 |
amazon.aws.route53: |
| 891 |
state: present |
| 892 |
zone: "{{ zone_one }}" |
| 893 |
record: geo-test-3.{{ zone_one }} |
| 894 |
identifier: geohost3@www |
| 895 |
type: A |
| 896 |
value: 127.0.0.1 |
| 897 |
ttl: 30 |
| 898 |
geo_location: |
| 899 |
country_code: US |
| 900 |
subdivision_code: TX |
| 901 |
register: create_geo_subdivision |
| 902 |
# Get resulting A record and geo_location parameters are applied |
| 903 |
- name: Get Route53 A record information |
| 904 |
amazon.aws.route53_info: |
| 905 |
type: A |
| 906 |
query: record_sets |
| 907 |
hosted_zone_id: "{{ z1.zone_id }}" |
| 908 |
start_record_name: geo-test-3.{{ zone_one }} |
| 909 |
max_items: 1 |
| 910 |
register: result |
| 911 |
- ansible.builtin.assert: |
| 912 |
that: |
| 913 |
- create_geo_subdivision is changed |
| 914 |
- create_geo_subdivision is not failed |
| 915 |
- '"route53:ChangeResourceRecordSets" in create_geo_subdivision.resource_actions' |
| 916 |
- result.resource_record_sets[0].geo_location.country_code == "US" |
| 917 |
- result.resource_record_sets[0].geo_location.subdivision_code == "TX" |
| 918 |
|
| 919 |
- name: Create a record with geo_location - subdivision_code (idempotency) |
| 920 |
amazon.aws.route53: |
| 921 |
state: present |
| 922 |
zone: "{{ zone_one }}" |
| 923 |
record: geo-test-3.{{ zone_one }} |
| 924 |
identifier: geohost3@www |
| 925 |
type: A |
| 926 |
value: 127.0.0.1 |
| 927 |
ttl: 30 |
| 928 |
geo_location: |
| 929 |
country_code: US |
| 930 |
subdivision_code: TX |
| 931 |
register: create_geo_subdivision_idem |
| 932 |
- ansible.builtin.assert: |
| 933 |
that: |
| 934 |
- create_geo_subdivision_idem is not changed |
| 935 |
- create_geo_subdivision_idem is not failed |
| 936 |
- '"route53:ChangeResourceRecordSets" not in create_geo_subdivision_idem.resource_actions' |
| 937 |
|
| 938 |
- name: Create a record with geo_location - subdivision_code (idempotency - check_mode) |
| 939 |
amazon.aws.route53: |
| 940 |
state: present |
| 941 |
zone: "{{ zone_one }}" |
| 942 |
record: geo-test-3.{{ zone_one }} |
| 943 |
identifier: geohost3@www |
| 944 |
type: A |
| 945 |
value: 127.0.0.1 |
| 946 |
ttl: 30 |
| 947 |
geo_location: |
| 948 |
country_code: US |
| 949 |
subdivision_code: TX |
| 950 |
check_mode: true |
| 951 |
register: create_geo_subdivision_idem_check |
| 952 |
|
| 953 |
- ansible.builtin.assert: |
| 954 |
that: |
| 955 |
- create_geo_subdivision_idem_check is not changed |
| 956 |
- create_geo_subdivision_idem_check is not failed |
| 957 |
- '"route53:ChangeResourceRecordSets" not in create_geo_subdivision_idem_check.resource_actions' |
| 958 |
|
| 959 |
# Test Latency-based Routing - routing_region parameter |
| 960 |
- name: Create a record with routing_region for latency-based routing (check_mode) |
| 961 |
amazon.aws.route53: |
| 962 |
state: present |
| 963 |
zone: "{{ zone_one }}" |
| 964 |
record: latency-test.{{ zone_one }} |
| 965 |
identifier: latencyhost@www |
| 966 |
type: A |
| 967 |
value: 127.0.0.1 |
| 968 |
ttl: 30 |
| 969 |
routing_region: us-east-1 |
| 970 |
region: "{{ omit }}" |
| 971 |
check_mode: true |
| 972 |
register: create_latency_routing_region_check_mode |
| 973 |
- ansible.builtin.assert: |
| 974 |
that: |
| 975 |
- create_latency_routing_region_check_mode is changed |
| 976 |
- create_latency_routing_region_check_mode is not failed |
| 977 |
- '"route53:ChangeResourceRecordSets" not in create_latency_routing_region_check_mode.resource_actions' |
| 978 |
- '"wait_id" in create_latency_routing_region_check_mode' |
| 979 |
- create_latency_routing_region_check_mode.wait_id is none |
| 980 |
|
| 981 |
- name: Create a record with routing_region for latency-based routing |
| 982 |
amazon.aws.route53: |
| 983 |
state: present |
| 984 |
zone: "{{ zone_one }}" |
| 985 |
record: latency-test.{{ zone_one }} |
| 986 |
identifier: latencyhost@www |
| 987 |
type: A |
| 988 |
value: 127.0.0.1 |
| 989 |
ttl: 30 |
| 990 |
routing_region: us-east-1 |
| 991 |
region: "{{ omit }}" |
| 992 |
register: create_latency_routing_region |
| 993 |
- name: Get Route53 latency record information |
| 994 |
amazon.aws.route53_info: |
| 995 |
type: A |
| 996 |
query: record_sets |
| 997 |
hosted_zone_id: "{{ z1.zone_id }}" |
| 998 |
start_record_name: latency-test.{{ zone_one }} |
| 999 |
max_items: 1 |
| 1000 |
register: latency_result |
| 1001 |
|
| 1002 |
- ansible.builtin.assert: |
| 1003 |
that: |
| 1004 |
- create_latency_routing_region is changed |
| 1005 |
- create_latency_routing_region is not failed |
| 1006 |
- '"route53:ChangeResourceRecordSets" in create_latency_routing_region.resource_actions' |
| 1007 |
- latency_result.resource_record_sets[0].region == "us-east-1" |
| 1008 |
- latency_result.resource_record_sets[0].set_identifier == "latencyhost@www" |
| 1009 |
|
| 1010 |
- name: Create a record with routing_region for latency-based routing (idempotency) |
| 1011 |
amazon.aws.route53: |
| 1012 |
state: present |
| 1013 |
zone: "{{ zone_one }}" |
| 1014 |
record: latency-test.{{ zone_one }} |
| 1015 |
identifier: latencyhost@www |
| 1016 |
type: A |
| 1017 |
value: 127.0.0.1 |
| 1018 |
ttl: 30 |
| 1019 |
routing_region: us-east-1 |
| 1020 |
region: "{{ omit }}" |
| 1021 |
register: create_latency_routing_region_idem |
| 1022 |
- ansible.builtin.assert: |
| 1023 |
that: |
| 1024 |
- create_latency_routing_region_idem is not changed |
| 1025 |
- create_latency_routing_region_idem is not failed |
| 1026 |
- '"route53:ChangeResourceRecordSets" not in create_latency_routing_region_idem.resource_actions' |
| 1027 |
|
| 1028 |
- name: Create a record with routing_region for latency-based routing (idempotency - check_mode) |
| 1029 |
amazon.aws.route53: |
| 1030 |
state: present |
| 1031 |
zone: "{{ zone_one }}" |
| 1032 |
record: latency-test.{{ zone_one }} |
| 1033 |
identifier: latencyhost@www |
| 1034 |
type: A |
| 1035 |
value: 127.0.0.1 |
| 1036 |
ttl: 30 |
| 1037 |
routing_region: us-east-1 |
| 1038 |
region: "{{ omit }}" |
| 1039 |
check_mode: true |
| 1040 |
register: create_latency_routing_region_idem_check |
| 1041 |
|
| 1042 |
- ansible.builtin.assert: |
| 1043 |
that: |
| 1044 |
- create_latency_routing_region_idem_check is not changed |
| 1045 |
- create_latency_routing_region_idem_check is not failed |
| 1046 |
- '"route53:ChangeResourceRecordSets" not in create_latency_routing_region_idem_check.resource_actions' |
| 1047 |
|
| 1048 |
# Test that get returns both routing_region and region (for backward compatibility) |
| 1049 |
- name: Get latency record and verify both region fields are returned |
| 1050 |
amazon.aws.route53: |
| 1051 |
state: get |
| 1052 |
zone: "{{ zone_one }}" |
| 1053 |
record: latency-test.{{ zone_one }} |
| 1054 |
type: A |
| 1055 |
register: get_latency_result |
| 1056 |
- ansible.builtin.assert: |
| 1057 |
that: |
| 1058 |
- get_latency_result.set.routing_region is defined |
| 1059 |
- get_latency_result.set.region is defined |
| 1060 |
- get_latency_result.set.routing_region == "us-east-1" |
| 1061 |
- get_latency_result.set.region == "us-east-1" |
| 1062 |
|
| 1063 |
# ------------------------------------------------------ |
| 1064 |
# Cleanup |
| 1065 |
|
| 1066 |
always: |
| 1067 |
- name: Delete latency-based routing record |
| 1068 |
amazon.aws.route53: |
| 1069 |
state: absent |
| 1070 |
zone: "{{ zone_one }}" |
| 1071 |
record: latency-test.{{ zone_one }} |
| 1072 |
identifier: latencyhost@www |
| 1073 |
type: A |
| 1074 |
value: 127.0.0.1 |
| 1075 |
ttl: 30 |
| 1076 |
routing_region: us-east-1 |
| 1077 |
ignore_errors: true |
| 1078 |
|
| 1079 |
- name: Delete a record with geo_location - continent_code |
| 1080 |
amazon.aws.route53: |
| 1081 |
state: absent |
| 1082 |
zone: "{{ zone_one }}" |
| 1083 |
record: geo-test-1.{{ zone_one }} |
| 1084 |
identifier: geohost1@www |
| 1085 |
type: A |
| 1086 |
value: 127.0.0.1 |
| 1087 |
ttl: 30 |
| 1088 |
geo_location: |
| 1089 |
continent_code: NA |
| 1090 |
ignore_errors: true |
| 1091 |
|
| 1092 |
- name: Delete a record with geo_location - country_code |
| 1093 |
amazon.aws.route53: |
| 1094 |
state: absent |
| 1095 |
zone: "{{ zone_one }}" |
| 1096 |
record: geo-test-2.{{ zone_one }} |
| 1097 |
identifier: geohost2@www |
| 1098 |
type: A |
| 1099 |
value: 127.0.0.1 |
| 1100 |
ttl: 30 |
| 1101 |
geo_location: |
| 1102 |
country_code: US |
| 1103 |
ignore_errors: true |
| 1104 |
|
| 1105 |
- name: Delete a record with geo_location - subdivision_code |
| 1106 |
amazon.aws.route53: |
| 1107 |
state: absent |
| 1108 |
zone: "{{ zone_one }}" |
| 1109 |
record: geo-test-3.{{ zone_one }} |
| 1110 |
identifier: geohost3@www |
| 1111 |
type: A |
| 1112 |
value: 127.0.0.1 |
| 1113 |
ttl: 30 |
| 1114 |
geo_location: |
| 1115 |
country_code: US |
| 1116 |
subdivision_code: TX |
| 1117 |
ignore_errors: true |
| 1118 |
|
| 1119 |
- amazon.aws.route53_info: |
| 1120 |
query: record_sets |
| 1121 |
hosted_zone_id: "{{ z1.zone_id }}" |
| 1122 |
register: z1_records |
| 1123 |
|
| 1124 |
- name: Loop over A/AAAA/CNAME Alias records and delete them |
| 1125 |
amazon.aws.route53: |
| 1126 |
state: absent |
| 1127 |
alias: true |
| 1128 |
alias_hosted_zone_id: "{{ item.alias_target.hosted_zone_id }}" |
| 1129 |
zone: "{{ zone_one }}" |
| 1130 |
record: "{{ item.name }}" |
| 1131 |
type: "{{ item.type }}" |
| 1132 |
value: "{{ item.alias_target.dns_name }}" |
| 1133 |
ignore_errors: true |
| 1134 |
loop: '{{ z1_records.resource_record_sets | selectattr("type", "in", ["A", "AAAA", "CNAME", "CAA"]) | list }}' |
| 1135 |
when: |
| 1136 |
- '"alias_target" in item' |
| 1137 |
|
| 1138 |
- name: Loop over A/AAAA/CNAME records and delete them |
| 1139 |
amazon.aws.route53: |
| 1140 |
state: absent |
| 1141 |
zone: "{{ zone_one }}" |
| 1142 |
record: "{{ item.name }}" |
| 1143 |
type: "{{ item.type }}" |
| 1144 |
value: '{{ item.resource_records | map(attribute="value") | join(",") }}' |
| 1145 |
weight: "{{ item.weight | default(omit) }}" |
| 1146 |
identifier: "{{ item.set_identifier }}" |
| 1147 |
region: "{{ omit }}" |
| 1148 |
ignore_errors: true |
| 1149 |
loop: '{{ z1_records.resource_record_sets | selectattr("type", "in", ["A", "AAAA", "CNAME", "CAA"]) | list }}' |
| 1150 |
when: |
| 1151 |
- '"resource_records" in item' |
| 1152 |
- '"set_identifier" in item' |
| 1153 |
|
| 1154 |
- name: Loop over A/AAAA/CNAME records and delete them |
| 1155 |
amazon.aws.route53: |
| 1156 |
state: absent |
| 1157 |
zone: "{{ zone_one }}" |
| 1158 |
record: "{{ item.name }}" |
| 1159 |
type: "{{ item.type }}" |
| 1160 |
value: '{{ item.resource_records | map(attribute="value") | join(",") }}' |
| 1161 |
ignore_errors: true |
| 1162 |
loop: '{{ z1_records.resource_record_sets | selectattr("type", "in", ["A", "AAAA", "CNAME", "CAA"]) | list }}' |
| 1163 |
when: |
| 1164 |
- '"resource_records" in item' |
| 1165 |
|
| 1166 |
- amazon.aws.route53_info: |
| 1167 |
query: record_sets |
| 1168 |
hosted_zone_id: "{{ z2.zone_id }}" |
| 1169 |
register: z2_records |
| 1170 |
|
| 1171 |
- name: Loop over A/AAAA/CNAME Alias records and delete them |
| 1172 |
amazon.aws.route53: |
| 1173 |
state: absent |
| 1174 |
alias: true |
| 1175 |
alias_hosted_zone_id: "{{ item.alias_target.hosted_zone_id }}" |
| 1176 |
zone: "{{ zone_two }}" |
| 1177 |
record: "{{ item.name }}" |
| 1178 |
type: "{{ item.type }}" |
| 1179 |
value: "{{ item.alias_target.dns_name }}" |
| 1180 |
private_zone: true |
| 1181 |
ignore_errors: true |
| 1182 |
loop: '{{ z2_records.resource_record_sets | selectattr("type", "in", ["A", "AAAA", "CNAME", "CAA"]) | list }}' |
| 1183 |
when: |
| 1184 |
- '"alias_target" in item' |
| 1185 |
|
| 1186 |
- name: Loop over A/AAAA/CNAME records and delete them |
| 1187 |
amazon.aws.route53: |
| 1188 |
state: absent |
| 1189 |
zone: "{{ zone_two }}" |
| 1190 |
record: "{{ item.name }}" |
| 1191 |
type: "{{ item.type }}" |
| 1192 |
value: '{{ item.resource_records | map(attribute="value") | join(",") }}' |
| 1193 |
identifier: "{{ item.set_identifier }}" |
| 1194 |
region: "{{ omit }}" |
| 1195 |
private_zone: true |
| 1196 |
ignore_errors: true |
| 1197 |
loop: '{{ z2_records.resource_record_sets | selectattr("type", "in", ["A", "AAAA", "CNAME", "CAA"]) | list }}' |
| 1198 |
when: |
| 1199 |
- '"resource_records" in item' |
| 1200 |
- '"set_identifier" in item' |
| 1201 |
|
| 1202 |
- name: Loop over A/AAAA/CNAME records and delete them |
| 1203 |
amazon.aws.route53: |
| 1204 |
state: absent |
| 1205 |
zone: "{{ zone_two }}" |
| 1206 |
record: "{{ item.name }}" |
| 1207 |
type: "{{ item.type }}" |
| 1208 |
value: '{{ item.resource_records | map(attribute="value") | join(",") }}' |
| 1209 |
private_zone: true |
| 1210 |
ignore_errors: true |
| 1211 |
loop: '{{ z2_records.resource_record_sets | selectattr("type", "in", ["A", "AAAA", "CNAME", "CAA"]) | list }}' |
| 1212 |
when: |
| 1213 |
- '"resource_records" in item' |
| 1214 |
|
| 1215 |
- name: Delete test zone one {{ zone_one }} |
| 1216 |
amazon.aws.route53_zone: |
| 1217 |
state: absent |
| 1218 |
zone: "{{ zone_one }}" |
| 1219 |
register: delete_one |
| 1220 |
ignore_errors: true |
| 1221 |
retries: 10 |
| 1222 |
until: delete_one is not failed |
| 1223 |
|
| 1224 |
- name: Delete test zone two {{ zone_two }} |
| 1225 |
amazon.aws.route53_zone: |
| 1226 |
state: absent |
| 1227 |
zone: "{{ zone_two }}" |
| 1228 |
register: delete_two |
| 1229 |
ignore_errors: true |
| 1230 |
retries: 10 |
| 1231 |
until: delete_two is not failed |
| 1232 |
|
| 1233 |
- name: Destroy VPC |
| 1234 |
amazon.aws.ec2_vpc_net: |
| 1235 |
cidr_block: 192.0.2.0/24 |
| 1236 |
name: "{{ resource_prefix }}_vpc" |
| 1237 |
state: absent |
| 1238 |
register: remove_vpc |
| 1239 |
retries: 10 |
| 1240 |
delay: 5 |
| 1241 |
until: remove_vpc is success |
| 1242 |
ignore_errors: true |