-
Notifications
You must be signed in to change notification settings - Fork 5
/
ocp-preinstall-311.yml
117 lines (103 loc) · 2.76 KB
/
ocp-preinstall-311.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
# Author: John Call
# Description: Use this on new hosts to subscribe them, enable repos, install rpms, and setup docker storage
# Updated: May 5th, 2019 for OCP/CNS 3.11
# https://access.redhat.com/documentation/en-us/openshift_container_platform/3.11/html-single/installing_clusters/index
---
- hosts: all
become: true
vars:
repos:
repo_list:
- rhel-7-server-rpms
- rhel-7-server-extras-rpms
- rhel-7-server-ose-3.11-rpms
- rhel-7-server-ansible-2.6-rpms
rpm_list:
- wget
- git
- net-tools
- bind-utils
- yum-utils
- iptables-services
- bridge-utils
- bash-completion
- kexec-tools
- sos
- psacct
- openshift-ansible
- docker-1.13.1
- glusterfs-fuse
vars_prompt:
- name: "rhsm_username"
prompt: "Enter RHN/RHSM Username"
default: jcallrht
private: no
- name: "rhsm_password"
prompt: "Enter RHN/RHSM Password"
private: yes
- name: "poolid"
prompt: "Enter Red Hat Pool ID"
default: 8a85f99c65c8c91b01661b7432765239
private: no
tasks:
- block:
- name: Register with Red Hat
redhat_subscription:
state: present
username: "{{ rhsm_username }}"
password: "{{ rhsm_password }}"
autosubscribe: false
async: 300
poll: 10
- name: Attach Pool
command: subscription-manager attach --pool={{ poolid }}
async: 300
poll: 10
tags: [rhsm]
# end block
- block:
- set_fact:
repos: "{{ repo_list | join(' --enable=') }}"
- debug:
var: repos
- name: Enable repos for RHEL7
command: subscription-manager repos --disable="*" --enable={{ repos }}
tags: [repos]
#end block
- block:
- name: Upgrade everything 'yum -y upgrade'
command: yum -y upgrade
args:
warn: false
- name: Reboot after upgrades
reboot:
- name: Install required RPMs
yum:
name: "{{ rpm_list }}"
state: latest
tags: [rpms]
#end block
### Assumes HDD layout (vda for /, sda for docker, and sdb for OCS) from IAD lab
- block:
- name: "Extend /dev/vda1"
command: growpart /dev/vda 1
- name: "Grow /dev/vda1"
command: xfs_growfs /
- name: "Setup docker-storage-setup"
copy:
content: |
STORAGE_DRIVER=devicemapper
#STORAGE_DRIVER=overlay2
DEVS=/dev/sda
VG=docker_vg
CONTAINER_THINPOOL=docker_pool
dest: /etc/sysconfig/docker-storage-setup
- name: "Run docker-storage-setup"
command: docker-storage-setup
- name: "Start and enable docker"
systemd:
unit: docker.service
state: restarted
enabled: yes
tags: [ docker ]
# end block