-
Notifications
You must be signed in to change notification settings - Fork 69
/
refresh_route53_dns.yml
84 lines (80 loc) · 2.62 KB
/
refresh_route53_dns.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
- hosts: "{{ HOSTS | default('control[0]') }}"
connection: local
vars:
organization: "Default Organization"
validate_certs: no
tasks:
- name: "Get instance details"
import_role:
name: ec2_node_tools
tasks_from: get_instance_details
- name: route53 tower dns update
become: no
vars:
tower_dns_record_state: present
route53:
state: "{{ tower_dns_record_state }}"
zone: "{{ workshop_dns_zone }}"
record: "{{ student }}.{{ instances.tags.Workshop | lower }}.{{ workshop_dns_zone }}"
type: A
overwrite: yes
value: "{{ instances_details.instances
| selectattr('tags.short_name', 'equalto', 'ansible-1')
| selectattr('tags.Student', 'equalto', student)
| map(attribute='public_ip_address')
| list }}"
wait: yes
when: instances_details is not none
- name: route53 code server dns update
become: no
vars:
code_dns_record_state: present
route53:
state: "{{ code_dns_record_state }}"
zone: "{{ workshop_dns_zone }}"
record: "{{ student }}-code.{{ instances.tags.Workshop | lower }}.{{ workshop_dns_zone }}"
type: A
overwrite: yes
value: "{{ instances_details.instances
| selectattr('tags.short_name', 'equalto', 'ansible-1')
| selectattr('tags.Student', 'equalto', student)
| map(attribute='public_ip_address')
| list }}"
wait: yes
when: instances_details is not none
- name: route53 satellite dns update
become: no
vars:
satellite_dns_record_state: present
route53:
state: "{{ satellite_dns_record_state }}"
zone: "{{ workshop_dns_zone }}"
record: "{{ student }}-sat.{{ instances.tags.Workshop | lower }}.{{ workshop_dns_zone }}"
type: A
overwrite: yes
value: "{{ instances_details.instances
| selectattr('tags.short_name', 'equalto', 'satellite')
| selectattr('tags.Student', 'equalto', student)
| map(attribute='public_ip_address')
| list }}"
wait: yes
when: instances_details is not none
- name: route53 attendance dns update
become: no
vars:
attendance_dns_record_state: present
route53:
state: "{{ attendance_dns_record_state }}"
zone: "{{ workshop_dns_zone }}"
record: "{{ instances.tags.Workshop | lower }}.{{ workshop_dns_zone }}"
type: A
overwrite: yes
value: "{{ instances_details.instances
| selectattr('tags.short_name', 'equalto', 'attendance-host')
| map(attribute='public_ip_address')
| list }}"
wait: yes
when:
- instances_details is not none
- student == 'student1'