-
Notifications
You must be signed in to change notification settings - Fork 0
/
process-repo.yml
35 lines (31 loc) · 1.83 KB
/
process-repo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
- name: Extract and refactor [{{ rhel_repo }}]
shell: "{{ item }}"
args:
warn: no
with_items:
- sed -n "/\[{{ rhel_repo }}\]/,/^$/p" '{{ cert_tmp.path }}/redhat.repo' | awk 'NF' > {{ cert_tmp.path }}/{{ rhel_repo }}.repo
- sed -i "s|/etc/pki/entitlement|{{ config_path }}/certs/{{ rhel_server.value.release }}|g" {{ cert_tmp.path }}/{{ rhel_repo }}.repo
- sed -i "s|/etc/rhsm/ca|{{ config_path }}/certs/{{ rhel_server.value.release }}|g" {{ cert_tmp.path }}/{{ rhel_repo }}.repo
- sed -i "s|enabled = 1|enabled = 0|g" {{ cert_tmp.path }}/{{ rhel_repo }}.repo
- sed -i '/^ui_repoid_vars/d' {{ cert_tmp.path }}/{{ rhel_repo }}.repo
- sed -i 's|$basearch|x86_64|g' {{ cert_tmp.path }}/{{ rhel_repo }}.repo
- sed -i "s|\$releasever|{{ rhel_server.value.release }}|g" {{ cert_tmp.path }}/{{ rhel_repo }}.repo
delegate_to: localhost
- name: Copy the {{ rhel_repo }}.repo to the {{ config_path }}/repos.d directory
copy:
src: '{{ cert_tmp.path }}/{{ rhel_repo }}.repo'
dest: '{{ config_path }}/repos.d/{{ rhel_repo }}.repo'
mode: '0600'
become: yes
- name: Syncronize the [{{ rhel_repo }}] repository for RHEL7
shell: reposync -c {{ config_path }}/yum.conf -q -n --repo {{ rhel_repo }} -p {{ repo_base }}/{{ rhel_server.value.release }}
become: yes
when: rhel_server.value.version | int == 7
- name: Syncronize the [{{ rhel_repo }}] repository for RHEL8
shell: reposync -c {{ config_path }}/yum.conf -q -n --download-metadata --repo {{ rhel_repo }} -p {{ repo_base }}/{{ rhel_server.value.release }}
become: yes
when: rhel_server.value.version | int == 8 or rhel_server.value.version | int == 9
- name: Update the [{{ rhel_repo }}] repository metadata for RHEL7
shell: createrepo {{ repo_base }}/{{ rhel_server.value.release }}/{{ rhel_repo }}
become: yes
when: rhel_server.value.version | int == 7