tripleo-quickstart-extras/playbooks/baremetal-full-freeipa.yml
Marios Andreou 56f0af5b7e Add mirror_info.sh creation for supplemental node repo setup
As discussed in related-bug the supplemental node used in the IPA
jobs is not using the mirror_info.sh so not using mirrors in the
repos created by repo-setup. This adds a slurp to grab the mirrors
config from the undercloud before repo-setup on supplemental.
Test and results at [1].

[1] https://review.rdoproject.org/r/c/testproject/+/40286/1#message-f825e6369163ad1f5aa98eb7c6c67b2798d5788b
Related-Bug: 1964457
Change-Id: I7b3c6f0a3b9fa7114670656df7b39cef8047fd85
2022-03-15 14:34:14 +00:00

126 lines
3.2 KiB
YAML

---
- name: Run inventory to add supplemental node
hosts: undercloud
gather_facts: false
tags:
- freeipa-setup
tasks:
- include_role:
name: tripleo-inventory
vars:
inventory: extra_node
- name: Add supplemental IP to /etc/hosts
lineinfile:
line: "{{ supplemental_node_ip }} {{ freeipa_server_hostname }}"
path: /etc/hosts
become: true
- name: set the freeipa_internal_ip
set_fact:
freeipa_internal_ip: "{{ supplemental_node_ip }}"
cacheable: true
- name: Deploy the FreeIPA server
hosts: supplemental
gather_facts: true
tags:
- freeipa-setup
tasks:
- name: Create /etc/ci directory for supplemental
become: true
file:
path: /etc/ci
state: directory
owner: root
group: root
mode: 0755
- name: Slurp the contents of mirror_info.sh from undercloud
become: true
slurp:
src: '/etc/ci/mirror_info.sh'
register: mirror_info_sh
delegate_to: undercloud
- name: Write mirror_info.sh contents to file on supplemental
become: true
copy:
dest: '/etc/ci/mirror_info.sh'
content: |
{{ mirror_info_sh['content'] | b64decode }}
- include_role:
name: repo-setup
vars:
repo_setup_dir: /home/{{ supplemental_user|default('centos') }}
- name: Set eth2 public IP address
shell: |
ip a add dev eth2 {{ supplemental_node_ip }}/24;
ip l set eth2 up;
ip link set dev eth2 mtu 1450;
ping 10.0.0.1 -c 4 -q;
become: true
changed_when: false
- include_role:
name: freeipa-setup
- name: Use supplemental node as DNS server
hosts: undercloud
gather_facts: false
tags:
- freeipa-setup
tasks:
- name: ensure that DHCP doesn't overwrite DNS settings (CentOS/RHEL >= 8)
become: true
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version is version(8, '>=')
block:
- name: set 'dns=none' in NetworkManager config file
ini_file:
path: /etc/NetworkManager/NetworkManager.conf
state: present
no_extra_spaces: true
section: main
option: dns
value: none
backup: true
- name: reload NetworkManager service
service:
name: NetworkManager
state: reloaded
- name: remove any existing entries from the resolv.conf file
become: true
lineinfile:
path: /etc/resolv.conf
regexp: "^nameserver "
state: absent
- name: set IPA server domain search
become: true
lineinfile:
path: /etc/resolv.conf
insertafter: '^search'
line: "search ooo.test"
state: present
- name: set IPA server as primary DNS provider
become: true
lineinfile:
path: /etc/resolv.conf
insertafter: '^search'
line: "nameserver {{ freeipa_internal_ip }}"
state: present
- name: print content of 'resolv.conf' after modifications
become: true
debug:
msg: "Content of resolv.conf: {{ lookup('file', '/etc/resolv.conf') }}"