-
Notifications
You must be signed in to change notification settings - Fork 140
Expand file tree
/
Copy pathredhat_9.yml
More file actions
89 lines (79 loc) · 2.5 KB
/
redhat_9.yml
File metadata and controls
89 lines (79 loc) · 2.5 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
# Red Hat 9-specific tasks for base role
- name: Import EPEL GPG key
rpm_key:
key: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-9
state: present
become: yes
register: epel_key_import
retries: 3
delay: 5
until: epel_key_import is success
ignore_errors: "{{ ansible_check_mode }}"
when: not (offline_mode | default(false))
- name: Install EPEL repository
dnf:
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
state: present
become: yes
register: epel_install
retries: 3
delay: 5
until: epel_install is success
ignore_errors: "{{ ansible_check_mode }}"
when: not (offline_mode | default(false))
- name: Skip EPEL installation in offline mode
debug:
msg: "Offline mode enabled - skipping EPEL GPG key and repository installation (should be pre-installed from offline packages)"
when: offline_mode | default(false)
- name: Install dnf-plugins-core
dnf:
name: dnf-plugins-core
state: present
become: yes
when: not (offline_mode | default(false))
- name: Check available repositories
command: dnf repolist --all
register: available_repos
changed_when: false
become: yes
- name: Enable CRB repository (Rocky/AlmaLinux)
command: dnf config-manager --set-enabled crb
become: yes
changed_when: true
when:
- "'crb' in available_repos.stdout"
- not (offline_mode | default(false))
ignore_errors: true
- name: Enable PowerTools repository (CentOS)
command: dnf config-manager --set-enabled powertools
become: yes
changed_when: true
when:
- "'powertools' in available_repos.stdout"
- not (offline_mode | default(false))
ignore_errors: true
- name: Enable CodeReady Builder for RHEL (if registered)
command: subscription-manager repos --enable codeready-builder-for-rhel-9-x86_64-rpms
become: yes
changed_when: true
when:
- "'codeready-builder' in available_repos.stdout"
- ansible_distribution == "RedHat"
- not (offline_mode | default(false))
ignore_errors: true
- name: Install Red Hat 9-specific packages
dnf:
name: "{{ redhat_9_packages }}"
state: present
become: yes
register: dnf_install_rh9
retries: 60
delay: 10
until: dnf_install_rh9 is success
ignore_errors: "{{ ansible_check_mode }}"
when: not (offline_mode | default(false))
- name: Skip Red Hat 9-specific packages installation in offline mode
debug:
msg: "Offline mode enabled - skipping Red Hat 9-specific packages installation (should be pre-installed)"
when: offline_mode | default(false)