-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathfix_aws_dns.yml
More file actions
54 lines (49 loc) · 1.84 KB
/
Copy pathfix_aws_dns.yml
File metadata and controls
54 lines (49 loc) · 1.84 KB
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
47
48
49
50
51
52
53
54
---
# Refresh Route53 DNS for existing bootstrap VMs (for example after a cold start changes public IPs).
- name: Fix AWS DNS (needed on cold start)
hosts: build_control
connection: local
become: false
gather_facts: false
vars_files:
- vars/aws_vars.yml
- ../vars/bootstrap_vars.yml
- ~/agof_vault.yml
vars:
ec2_provision_instances: false
ec2_wait: false
tasks:
- name: collection final check
block:
- name: run AWS check setup
ansible.builtin.include_role:
name: roles/aws_check_setup
rescue:
- name: Error with setup
ansible.builtin.fail:
msg: >-
fix_aws_dns failed during AWS check_setup. Scroll up for the exact error.
- name: Check for saved AWS state
ansible.builtin.stat:
path: "{{ pattern_state_rootdir }}/{{ ec2_name_prefix }}/aws_state_vars.yml"
register: agof_aws_statevars
- name: Load saved AWS state when present
ansible.builtin.include_vars:
file: "{{ pattern_state_rootdir }}/{{ ec2_name_prefix }}/aws_state_vars.yml"
when: agof_aws_statevars.stat.exists
- name: Assert variables required to refresh DNS are available
ansible.builtin.assert:
that:
- ec2_name_prefix is defined
- ec2_name_prefix | length > 0
- ec2_region is defined
- ec2_region | length > 0
- pattern_dns_zone is defined
- pattern_dns_zone | length > 0
fail_msg: >-
fix_aws_dns needs ec2_name_prefix, ec2_region, and pattern_dns_zone from
~/agof_vault.yml or {{ pattern_state_rootdir }}/{{ ec2_name_prefix }}/aws_state_vars.yml
after a successful AWS init.
- name: Refresh inventory and Route53 DNS for existing bootstrap instances
ansible.builtin.include_role:
name: roles/manage_ec2_instances