--- - name: Get installed packages list package_facts: manager: "auto" - 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' and 'NetworkManager' in ansible_facts.packages 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 default repositories block: - name: Find repo files names find: paths: "{{ repo_path[ansible_os_family] }}" pattern: "{{ repo_patern[ansible_os_family] }}" 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" - include_tasks: "{{ ansible_os_family }}.yml"