Guillaume Coré
2019-03-14 93b54a7d54ac873901442040be14052454cc161f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
- environment:
    AWS_PROFILE: "{{ account_profile }}"
  block:
    - name: Create the public zone
      route53_zone:
        zone: "{{ account_name }}{{subdomain_base}}."
      register: _route53zone
      retries: 5
      delay: "{{ 60|random(start=3, step=1) }}"
      until: _route53zone is succeeded
 
    - set_fact:
        account_hosted_zone_id: "{{ _route53zone.zone_id }}"
 
    - name: Grab facts about the zone
      route53_facts:
        query: hosted_zone
        hosted_zone_method: details
        hosted_zone_id: "{{ _route53zone.zone_id }}"
      register: _route53facts
      retries: 5
      delay: "{{ 60|random(start=3, step=1) }}"
      until: _route53facts is succeeded
 
    - name: Save NS records
      set_fact:
        ns_records: "{{ _route53facts.DelegationSet.NameServers }}"
 
    - name: Generate commands to del NS records to IPA
      copy:
        content: |-
          ipa dnsrecord-del opentlc.com. {{ account_name }}
        dest: "{{ output_dir }}/ipa_del_{{ account_name }}.sh"
 
    - name: Add HostedZoneId to the report
      lineinfile:
        path: "{{ output_dir }}/{{ account_name }}_report.txt"
        line: "HostedZoneId: {{ _route53zone.zone_id }}"
        regexp: '^HostedZoneId: '
 
    - name: Add Zone name to the report
      lineinfile:
        path: "{{ output_dir }}/{{ account_name }}_report.txt"
        line: "subdomain_base_suffix: .{{ account_name }}{{subdomain_base}}"
        regexp: '^subdomain_base_suffix: '