-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsatellite_prep.yml
158 lines (134 loc) · 5.38 KB
/
satellite_prep.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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
---
- name: Ensure Satellite systems are registered with access to required repositories, the firewall is set up, and the base software is installed
hosts: "{{ hostlist | default('all') }}"
become: true
vars:
satellite_version: "6.16"
tasks:
- name: Block for Satellite 6.8/6.9/6.10/6.11 and RHEL 7 (6.11 not tested)
block:
- name: Ensure system is registered with RHSM and that the proper repos are enabled for RHEL 7
ansible.builtin.include_role:
name: rhportal_reg
vars:
rhportal_reg_rhsm_supplemental_repo_list:
- "rhel-7-server-satellite-{{ satellite_version }}-rpms"
- "rhel-7-server-satellite-maintenance-6-rpms"
- "rhel-server-rhscl-7-rpms"
- "rhel-7-server-ansible-2.9-rpms"
- "rhel-7-server-extras-rpms"
- name: Define incoming firewall ports to open
ansible.builtin.set_fact:
satellite_incoming_firewall_ports:
- "53/udp"
- "53/tcp"
- "67/udp"
- "69/udp"
- "80/tcp"
- "443/tcp"
- "5000/tcp"
- "5647/tcp"
- "8000/tcp"
- "8140/tcp"
- "9090/tcp"
when: ansible_facts.distribution is defined and ansible_facts.distribution == "RedHat" and ansible_facts.distribution_major_version is defined and ansible_facts.distribution_major_version == "7"
- name: Block for Satellite 6.11+ and RHEL 8
block:
- name: Ensure system is registered with RHSM and that the proper repos are enabled for RHEL 8
ansible.builtin.include_role:
name: rhportal_reg
vars:
rhportal_reg_rhsm_supplemental_repo_list:
- "satellite-{{ satellite_version }}-for-rhel-8-x86_64-rpms"
- "satellite-maintenance-{{ satellite_version }}-for-rhel-8-x86_64-rpms"
- name: Enable the Satellite module
ansible.builtin.command:
cmd: "dnf module enable -y satellite:el8"
- name: Define incoming firewall ports to open
ansible.builtin.set_fact:
satellite_incoming_firewall_ports:
- "53/udp"
- "53/tcp"
- "67/udp"
- "69/udp"
- "80/tcp"
- "443/tcp"
- "5647/tcp"
- "8000/tcp"
- "8140/tcp"
- "9090/tcp"
- "1883/tcp"
- name: Ensure RHEL release version is not set
ansible.builtin.command: "subscription-manager release --unset"
when: ansible_facts.distribution is defined and ansible_facts.distribution == "RedHat" and ansible_facts.distribution_major_version is defined and ansible_facts.distribution_major_version == "8"
- name: Block for Satellite 6.16+ and RHEL 9
block:
- name: Ensure system is registered with RHSM and that the proper repos are enabled for RHEL 9
ansible.builtin.include_role:
name: rhportal_reg
vars:
rhportal_reg_rhsm_supplemental_repo_list:
- "satellite-{{ satellite_version }}-for-rhel-9-x86_64-rpms"
- "satellite-maintenance-{{ satellite_version }}-for-rhel-9-x86_64-rpms"
# - name: Enable the Satellite module
# ansible.builtin.command:
# cmd: "dnf module enable -y satellite:el9"
- name: Define incoming firewall ports to open
ansible.builtin.set_fact:
satellite_incoming_firewall_ports:
- "53/udp"
- "53/tcp"
- "67/udp"
- "69/udp"
- "80/tcp"
- "443/tcp"
- "1883/tcp"
- "8000/tcp"
- "8140/tcp"
- "9090/tcp"
- "5910-5930/tcp"
when: ansible_facts.distribution is defined and ansible_facts.distribution == "RedHat" and ansible_facts.distribution_major_version is defined and ansible_facts.distribution_major_version == "9"
- name: Ensure firewalld is installed
ansible.builtin.yum:
name: firewalld
state: installed
- name: Ensure firewalld is enabled and started
ansible.builtin.service:
name: firewalld
enabled: True
state: started
- name: Ensure firewall ports are open
ansible.posix.firewalld:
immediate: True
permanent: True
port: "{{ item }}"
state: enabled
with_items: "{{ satellite_incoming_firewall_ports }}"
- name: Ensure kernel is up-to-date; if so a reboot will occur
ansible.builtin.yum:
name: kernel
state: latest
register: kernel_status
- name: Reboot server if needed
ansible.builtin.reboot:
when: kernel_status.changed
- name: Ensure all packages are updated
ansible.builtin.yum:
name: '*'
state: latest
- name: Ensure Satellite and other software is installed (satellite is the only required package starting with 6.16)
ansible.builtin.yum:
name: "{{ satellite_sw_list }}"
state: latest
vars:
satellite_sw_list:
- satellite
- chrony
- sos
- rhel-system-roles
# - screen
- name: Ensure chronyd is enabled and started (not required for Satellite 6.16)
ansible.builtin.service:
name: chronyd
enabled: True
state: started