Skip to content

Commit 4b3b52d

Browse files
committed
feat: Migrate subnet DNS name server to ipa provisioning Item
1 parent f06b047 commit 4b3b52d

2 files changed

Lines changed: 40 additions & 40 deletions

File tree

playbooks/default-stack-provisioning/default-stack-provisioning.yml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -178,44 +178,6 @@
178178
- name: Provision IPA Server
179179
import_playbook: "../ipa-server-provisioning/ipa-server-provisioning.yml"
180180

181-
- name: Update OpenStack subnet DNS nameservers for IPA compatibility
182-
hosts: localhost
183-
connection: local
184-
gather_facts: false
185-
186-
tasks:
187-
- name: Gather information about user-specified OpenStack network
188-
openstack.cloud.networks_info:
189-
name: "{{ private_network_name }}"
190-
register: networks_info
191-
192-
- name: Get ID of user-defined network
193-
ansible.builtin.set_fact:
194-
network_id: "{{ networks_info.networks[0].id }}"
195-
196-
- name: Gather information about subnets within user-defined OpenStack network
197-
openstack.cloud.subnets_info:
198-
filters:
199-
network_id: "{{ network_id }}"
200-
register: subnets_info
201-
202-
- name: Get name, ID, CIDR and DNS nameservers of subnet (choose first)
203-
ansible.builtin.set_fact:
204-
subnet_name: "{{ subnets_info.subnets[0].name }}"
205-
subnet_cidr: "{{ subnets_info.subnets[0].cidr }}"
206-
subnet_dns_nameservers: "{{ subnets_info.subnets[0].dns_nameservers | default([]) }}"
207-
208-
- name: Point DNS nameservers in OpenStack subnet to new IPA server
209-
openstack.cloud.subnet:
210-
network: "{{ private_network_name }}"
211-
name: "{{ subnet_name }}"
212-
cidr: "{{ subnet_cidr }}"
213-
dns_nameservers:
214-
- "{{ hostvars['localhost']['remote_host_internal_ip_fact'] }}"
215-
state: present
216-
register: subnet_result
217-
no_log: true
218-
219181
- name: Provision SSH Bastion
220182
import_playbook: "../ssh-bastion-provisioning/ssh-bastion-provisioning.yml"
221183

playbooks/ipa-server-provisioning/ipa-server-provisioning.yml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
ansible_host: "{{ remote_host_public_ip_fact }}"
249249
ansible_user: "cloud-user"
250250
ansible_ssh_private_key_file: "{{ hostvars['localhost']['private_keypair_path_fact'] }}"
251-
ansible_ssh_common_args: "-o StrictHostKeyChecking=accept-new"
251+
ansible_ssh_common_args: "-o StrictHostKeyChecking=no"
252252

253253
- name: Install IPA server
254254
hosts: ipa_server
@@ -270,13 +270,51 @@
270270
os_network_name: "{{ hostvars['localhost']['ewc_ansible_role_ipa_server']['os_network_name_fact'] }}"
271271
os_security_group_name: "{{ hostvars['localhost']['ewc_ansible_role_ipa_server']['os_security_group_name_fact'] }}"
272272

273+
- name: Update OpenStack subnet DNS nameservers for IPA compatibility
274+
hosts: localhost
275+
connection: local
276+
gather_facts: false
277+
278+
tasks:
279+
- name: Gather information about user-specified OpenStack network
280+
openstack.cloud.networks_info:
281+
name: "{{ private_network_name }}"
282+
register: networks_info
283+
284+
- name: Get ID of user-defined network
285+
ansible.builtin.set_fact:
286+
network_id: "{{ networks_info.networks[0].id }}"
287+
288+
- name: Gather information about subnets within user-defined OpenStack network
289+
openstack.cloud.subnets_info:
290+
filters:
291+
network_id: "{{ network_id }}"
292+
register: subnets_info
293+
294+
- name: Get name, ID, CIDR and DNS nameservers of subnet (choose first)
295+
ansible.builtin.set_fact:
296+
subnet_name: "{{ subnets_info.subnets[0].name }}"
297+
subnet_cidr: "{{ subnets_info.subnets[0].cidr }}"
298+
subnet_dns_nameservers: "{{ subnets_info.subnets[0].dns_nameservers | default([]) }}"
299+
300+
- name: Point DNS nameservers in OpenStack subnet to new IPA server
301+
openstack.cloud.subnet:
302+
network: "{{ private_network_name }}"
303+
name: "{{ subnet_name }}"
304+
cidr: "{{ subnet_cidr }}"
305+
dns_nameservers:
306+
- "{{ hostvars['localhost']['remote_host_internal_ip_fact'] }}"
307+
state: present
308+
register: subnet_result
309+
no_log: true
310+
273311
- name: Cleanup and summarize execution after post-provisioning
274312
hosts: localhost
275313
connection: local
276314
gather_facts: false
277315

278316
tasks:
279-
- name: Update intance's Terraform definition file
317+
- name: Update instance's Terraform definition file
280318
ansible.builtin.lineinfile:
281319
path: "{{ hostvars['localhost']['tf_project_path_fact'] }}/main.tf"
282320
search_string: 'instance_has_fip'

0 commit comments

Comments
 (0)