|
248 | 248 | ansible_host: "{{ remote_host_public_ip_fact }}" |
249 | 249 | ansible_user: "cloud-user" |
250 | 250 | 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" |
252 | 252 |
|
253 | 253 | - name: Install IPA server |
254 | 254 | hosts: ipa_server |
|
270 | 270 | os_network_name: "{{ hostvars['localhost']['ewc_ansible_role_ipa_server']['os_network_name_fact'] }}" |
271 | 271 | os_security_group_name: "{{ hostvars['localhost']['ewc_ansible_role_ipa_server']['os_security_group_name_fact'] }}" |
272 | 272 |
|
| 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 | + |
273 | 311 | - name: Cleanup and summarize execution after post-provisioning |
274 | 312 | hosts: localhost |
275 | 313 | connection: local |
276 | 314 | gather_facts: false |
277 | 315 |
|
278 | 316 | tasks: |
279 | | - - name: Update intance's Terraform definition file |
| 317 | + - name: Update instance's Terraform definition file |
280 | 318 | ansible.builtin.lineinfile: |
281 | 319 | path: "{{ hostvars['localhost']['tf_project_path_fact'] }}/main.tf" |
282 | 320 | search_string: 'instance_has_fip' |
|
0 commit comments