-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrhel-prep.yml
66 lines (63 loc) · 1.83 KB
/
rhel-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
---
- hosts: all
tasks:
- name: Setting Up RHSM
redhat_subscription:
username: "{{ rhsm_username }}"
password: "{{ rhsm_password }}"
auto_attach: yes
force_register: no
tags: register_rhel
when: enable_rhsm|bool == True
#####
##### RHSM registration works only when its enabled during workflow process
#####
- name: Disabling all repos
rhsm_repository:
state: disabled
name: "*"
tags: register_rhel
when: enable_rhsm|bool == True
- name: Setting up repos
rhsm_repository:
state: present
name: "{{ item }}"
when:
- ansible_distribution == "RedHat"
- ansible_distribution_major_version == "8"
- enable_rhsm|bool == True
with_items:
- rhel-8-for-x86_64-baseos-rpms
- rhel-8-for-x86_64-appstream-rpms
tags: register_rhel8
- name: Setting up Repos for RHEL7
rhsm_repository:
state: present
name: "{{ item }}"
when:
- ansible_distribution == "RedHat"
- ansible_distribution_major_version == "7"
- enable_rhsm|bool == True
with_items:
- rhel-7-server-rpms
- rhel-7-server-optional-rpms
- rhel-7-server-extras-rpms
- rhel-7-server-supplementary-rpms
tags: register_rhel7
- name: Upgrading package to the latest versions
dnf:
state: latest
name: "*"
when:
- ansible_distribution == "RedHat"
- ansible_distribution_major_version == "8"
- enable_rhsm|bool == True
##### Installing some packages for testing purposes
- name: Installing packages for basework
package:
state: present
name: "{{ item }}"
with_items:
- tmux
- mc
when: install_test_pkg|bool == True