-
Notifications
You must be signed in to change notification settings - Fork 12
/
setup-idm.yml
185 lines (160 loc) · 4.22 KB
/
setup-idm.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
---
- import_playbook: ensure-vm-state.yml
vars:
memory_mb: 4096
num_cpus: 2
state: poweredon
net_name: RH-seg-2991
net_type: static
ip: "{{ ipaserver_master_ip }}"
netmask: 255.255.255.0
gateway: "{{ ipaserver_gw }}"
name: "{{ ipaserver_master_name }}"
domain: "{{ ipaserver_domain }}"
dns_servers:
- "{{ dns_forwarder1_ip }}"
- "{{ dns_forwarder2_ip }}"
tags: server
- import_playbook: ensure-vm-state.yml
vars:
memory_mb: 4096
num_cpus: 2
state: poweredon
net_name: RH-seg-2991
net_type: static
ip: "{{ ipaserver_replica_ip }}"
netmask: 255.255.255.0
gateway: "{{ ipaserver_gw }}"
name: "{{ ipaserver_replica_name }}"
domain: "{{ ipaserver_domain }}"
dns_servers:
- "{{ dns_forwarder1_ip }}"
- "{{ dns_forwarder2_ip }}"
tags: replica
- import_playbook: prepare-rhel.yml
vars:
install_pkgs_list:
- tmux
- vim
- insights-client
tags: prep
- name: setup stuff at IdMs
hosts:
- ipaservers
- ipareplicas
tasks:
- name: set yum module
command:
cmd: yum module enable -y idm:DL1
warn: false
tags: yum
- name: sync new yum stream
command:
cmd: yum distro-sync -y
warn: false
tags: yum
- name: check ipv6 is enabled
replace:
path: /etc/default/grub
regexp: 'ipv6.disable=1'
register: ipv6
- name: re-generate grub
command: grub2-mkconfig -o /boot/grub2/grub.cfg
when: ipv6 is changed
- name: re-generate initramd
command: dracut -f
when: ipv6 is changed
- name: create hosts entry for ipv6
lineinfile:
path: /etc/hosts
regexp: '^::1.*'
line: >-
::1 localhost localhost.localdomain
localhost6 localhost6.localdomain6
- name: create hosts entry for idm master
lineinfile:
path: /etc/hosts
regexp: ".*{{ ipaserver_master_name }}.*"
line: >-
{{ ipaserver_master_ip }}
{{ ipaserver_master_name }}.{{ ipaserver_domain }}
{{ ipaserver_master_name }}
- name: create hosts entry for idm replica
lineinfile:
path: /etc/hosts
regexp: ".*{{ ipaserver_replica_name }}.*"
line: >-
{{ ipaserver_replica_ip }}
{{ ipaserver_replica_name }}.{{ ipaserver_domain }}
{{ ipaserver_replica_name }}
- name: reboot to get ipv6
reboot:
reboot_timeout: 120
when: ipv6 is changed
- name: setup IdM server
hosts:
- ipaservers
tasks:
- name: ensure fqdn hostname
hostname:
name: "{{ ipaserver_master_name }}.{{ ipaserver_domain }}"
use: systemd
- name: apply freeipa role
include_role:
name: freeipa.ansible_freeipa.ipaserver
vars:
state: present
- name: permit IdM traffic
ansible.posix.firewalld:
service: "{{ item }}"
permanent: true
state: enabled
loop:
- freeipa-ldap
- freeipa-ldaps
- dns
tags: firewall
tags: server
- name: setup IdM replica
hosts: ipareplicas
tasks:
- name: ensure fqdn hostname
hostname:
name: "{{ ipaserver_replica_name }}.{{ ipaserver_domain }}"
use: systemd
- name: apply freeipa role
include_role:
name: freeipa.ansible_freeipa.ipareplica
vars:
state: present
- name: permit IdM traffic
ansible.posix.firewalld:
service: "{{ item }}"
permanent: true
state: enabled
loop:
- freeipa-ldap
- freeipa-ldaps
- dns
tags: firewall
tags: replica
- name: setup IdM DNS configs
hosts:
- ipaservers
tasks:
- name: setup dns zone
freeipa.ansible_freeipa.ipadnszone:
ipaadmin_password: "{{ ipaadmin_password }}"
name: "{{ ipaserver_domain }}"
allow_sync_ptr: true
dynamic_update: true
state: present
- name: setup reverse zone
freeipa.ansible_freeipa.ipadnszone:
ipaadmin_password: "{{ ipaadmin_password }}"
name: "{{ item }}"
allow_sync_ptr: true
dynamic_update: true
state: present
loop: "{{ dns_reverse_zones }}"
tags: dns