blob: 599e105201f081f4dba5828f1bf8129bb6074969 [file] [log] [blame]
Samuli Silvius79bfeda2019-02-12 21:08:26 +02001---
2- name: Setup resolv.conf for node to find package repository by name from infra
3 lineinfile:
4 line: "nameserver {{ hostvars[groups.infrastructure[0]].cluster_ip }}"
5 path: /etc/resolv.conf
6 state: present
7 insertbefore: BOF
Samuli Silvius79bfeda2019-02-12 21:08:26 +02008
Bartek Grzybowski22bb23f2019-02-22 16:10:27 +01009- name: Disable all OS default repositories
10 block:
11 - name: Find repo files names
12 find:
13 paths: /etc/yum.repos.d
14 pattern: '*.repo'
15 register: repo_files
16
17 - name: Get all defined offline repo names
18 set_fact: package_repositories_names="{{ package_repositories | selectattr('name', 'defined') | map(attribute='name') | list }}"
19
20 - name: Backup repo files
21 copy:
Samuli Silviusb3acc412019-03-22 15:37:39 +020022 remote_src: true
Bartek Grzybowski22bb23f2019-02-22 16:10:27 +010023 src: "{{ item.path }}"
24 dest: "{{ item.path }}.disabled"
25 loop: "{{ repo_files.files }}"
26 when: "(item.path | basename | splitext)[0] not in package_repositories_names"
27
28 - name: Remove disabled repo files
29 file:
30 path: "{{ item.path }}"
31 state: absent
32 loop: "{{ repo_files.files }}"
33 when: "(item.path | basename | splitext)[0] not in package_repositories_names"
Bartek Grzybowski22bb23f2019-02-22 16:10:27 +010034
Samuli Silvius79bfeda2019-02-12 21:08:26 +020035- name: Add application offline package repository
36 yum_repository:
Bartek Grzybowski22bb23f2019-02-22 16:10:27 +010037 name: "{{ item.name }}"
38 file: "{{ item.file }}"
39 description: "{{ item.description | default('') }}"
40 baseurl: "{{ item.baseurl | default('') }}"
41 gpgcheck: "{{ item.gpgcheck | default(true) }}"
42 enabled: "{{ item.enabled | default(false) }}"
43 state: "{{ item.state | default('present') }}"
44 loop: "{{ package_repositories }}"