blob: 7dc2e76fb2f2814db00a2c9327a706676182e72c [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
Michal Zegan835643a2019-05-27 13:52:53 +02008 unsafe_writes: true
Samuli Silvius79bfeda2019-02-12 21:08:26 +02009
Bartek Grzybowski22bb23f2019-02-22 16:10:27 +010010- name: Disable all OS default repositories
11 block:
12 - name: Find repo files names
13 find:
14 paths: /etc/yum.repos.d
15 pattern: '*.repo'
16 register: repo_files
17
18 - name: Get all defined offline repo names
19 set_fact: package_repositories_names="{{ package_repositories | selectattr('name', 'defined') | map(attribute='name') | list }}"
20
21 - name: Backup repo files
22 copy:
Samuli Silviusb3acc412019-03-22 15:37:39 +020023 remote_src: true
Bartek Grzybowski22bb23f2019-02-22 16:10:27 +010024 src: "{{ item.path }}"
25 dest: "{{ item.path }}.disabled"
26 loop: "{{ repo_files.files }}"
27 when: "(item.path | basename | splitext)[0] not in package_repositories_names"
28
29 - name: Remove disabled repo files
30 file:
31 path: "{{ item.path }}"
32 state: absent
33 loop: "{{ repo_files.files }}"
34 when: "(item.path | basename | splitext)[0] not in package_repositories_names"
Bartek Grzybowski22bb23f2019-02-22 16:10:27 +010035
Samuli Silvius79bfeda2019-02-12 21:08:26 +020036- name: Add application offline package repository
37 yum_repository:
Bartek Grzybowski22bb23f2019-02-22 16:10:27 +010038 name: "{{ item.name }}"
39 file: "{{ item.file }}"
40 description: "{{ item.description | default('') }}"
41 baseurl: "{{ item.baseurl | default('') }}"
42 gpgcheck: "{{ item.gpgcheck | default(true) }}"
43 enabled: "{{ item.enabled | default(false) }}"
44 state: "{{ item.state | default('present') }}"
45 loop: "{{ package_repositories }}"