blob: e2a5fd464cc1703f55b4e5249476532c2cdcf2d0 [file] [log] [blame]
---
- name: Disable DNS management in Network Manager
ini_file:
path: /etc/NetworkManager/NetworkManager.conf
state: present
no_extra_spaces: true
section: main
option: dns
value: none
owner: root
group: root
mode: 0644
backup: false
when: ansible_os_family == 'RedHat'
notify:
- Restart NetworkManager
- name: Setup resolv.conf for node to find package repository by name from infra
lineinfile:
line: "nameserver {{ hostvars[groups.infrastructure[0]].cluster_ip }}"
path: /etc/resolv.conf
state: present
insertbefore: BOF
unsafe_writes: true
- name: Disable all OS default repositories
block:
- name: Find repo files names
find:
paths: /etc/yum.repos.d
pattern: '*.repo'
register: repo_files
- name: Get all defined offline repo names
set_fact: package_repositories_names="{{ package_repositories | selectattr('name', 'defined') | map(attribute='name') | list }}"
- name: Backup repo files
copy:
remote_src: true
src: "{{ item.path }}"
dest: "{{ item.path }}.disabled"
loop: "{{ repo_files.files }}"
when: "(item.path | basename | splitext)[0] not in package_repositories_names"
- name: Remove disabled repo files
file:
path: "{{ item.path }}"
state: absent
loop: "{{ repo_files.files }}"
when: "(item.path | basename | splitext)[0] not in package_repositories_names"
- name: Add application offline package repository
yum_repository:
name: "{{ item.name }}"
file: "{{ item.file }}"
description: "{{ item.description | default('') }}"
baseurl: "{{ item.baseurl | default('') }}"
gpgcheck: "{{ item.gpgcheck | default(true) }}"
enabled: "{{ item.enabled | default(false) }}"
state: "{{ item.state | default('present') }}"
loop: "{{ package_repositories }}"