This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
pre-install.yml
180 lines (155 loc) · 5.84 KB
/
pre-install.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
- name: Configure known hosts
hosts: all
tasks:
# TODO: Don't update host keys: https://juriansluiman.nl/article/151/managing-ssh-known-hosts-with-ansible
- known_hosts:
name: "{{ inventory_hostname }}"
key: "{{ lookup('pipe', 'ssh-keyscan -T 10 {{inventory_hostname }}') }}"
delegate_to: localhost
gather_facts: false
- name: Prepare hosts for OpenShift installation
hosts: all
vars:
use_dnsmasq: "{{openshift_use_dnsmasq is undefined or (openshift_use_dnsmasq | bool)}}"
openshift_version: "{{ openshift_pkg_version | default(openshift_image_tag) | default(openshift_release) | regex_replace('^[-v]', '') }}"
openshift_major: "{{ openshift_version.split('.')[0] }}"
openshift_minor: "{{ openshift_version.split('.')[1] }}"
ocp_repos:
- rhel-7-server-rpms
- rhel-7-server-extras-rpms
- rhel-7-server-optional-rpms
- rhel-7-fast-datapath-rpms
- "rhel-7-server-ose-{{openshift_major}}.{{openshift_minor}}-rpms"
# - name: bootstrap epel-release install
# copy: src=ansible-bootstrap-epel.repo
# dest=/etc/yum.repos.d/
# owner=root group=root mode=0644
# when: configure_epel
# - name: epel-release install
# yum: name=epel-release
# enablerepo=ansible-bootstrap-epel
# state=present
# when: configure_epel
# - name: epel repository disable
# ini_file: dest=/etc/yum.repos.d/epel.repo
# section=epel
# option=enable
# value=0
# when: configure_epel
tasks:
- name: Enable Ansible ssh pipelining
ini_file:
path: /etc/ansible/ansible.cfg
section: ssh_connection
option: pipelining
value: True
delegate_to: localhost
run_once: true
- name: Enable repos on control host
rhsm_repo:
repos: "{{ ocp_repos }}"
state: present
when: ansible_distribution == "RedHat"
delegate_to: localhost
run_once: true
- name: Enable repos on OpenShift hosts
rhsm_repo:
repos: "{{ ocp_repos }}"
state: present
when: ansible_distribution == "RedHat"
# - name: Install Ansible module dependencies
# yum: name={{item}} state=present enablerepo={{epel_repo_id}}
# with_items:
# - jq
# - yum-utils
# - name: Set RHEL repos priority
# rhsm_repo_prio: name={{item}} priority=1
# with_items: "{{ openshift_rhsm_repos }}"
# when: ansible_distribution == "RedHat"
# - name: Enable OpenShift Enterprise repos
# rhsm_repo: name={{item}} enable=1
# with_items:
# - rhel-7-server-ose-{{openshift_major}}.{{openshift_minor}}-rpms
# when:
# (deployment_type == "enterprise" or deployment_type == "openshift-enterprise")
# and (openshift_rhsm_repos is defined and openshift_rhsm_repos)
# - name: Disable old OpenShift Enterprise repos
# rhsm_repo: name="rhel-7-server-ose-{{openshift_major}}.{{item}}-rpms" enable=0
# with_sequence: start={{ openshift_minor | int - 1 }} end=0 stride=-1
# when:
# (deployment_type == "enterprise" or deployment_type == "openshift-enterprise")
# and (openshift_rhsm_repos is defined and openshift_rhsm_repos)
# - name: Set OpenShift Enterprise repo priority
# rhsm_repo_prio: name={{item}} priority=1
# with_items:
# - rhel-7-server-ose-{{openshift_major}}.{{openshift_minor}}-rpms
# when:
# (deployment_type == "enterprise" or deployment_type == "openshift-enterprise")
# and (openshift_rhsm_repos is defined and openshift_rhsm_repos)
# - name: Enable OpenShift Origin repos
# copy: src=maxamillion-origin-next-epel-7
# dest=/etc/yum.repos.d/
# owner=root group=root mode=0644
# when: ansible_distribution != "RedHat"
- name: Install prerequisites on control host
yum:
name: "{{item}}"
state: present
with_items:
- atomic-openshift-utils
when: ansible_distribution == "RedHat"
delegate_to: localhost
run_once: true
- name: Install prerequisites on OpenShift hosts
yum:
name: "{{item}}"
state: present
with_items:
- wget
- git
- net-tools
- bind-utils
- bridge-utils
- bash-completion
- kexec-tools
- sos
- psacct
# - name: Disable NetworkManager service
# service: name=NetworkManager state=stopped enabled=false
# when: not use_dnsmasq
# - name: Enable NetworkManager service
# service: name=NetworkManager state=started enabled=true
# when: use_dnsmasq
# - name: Enable network service
# service: name=network state=started enabled=true
# when: not use_dnsmasq
# - name: Extra iptables configuration
# iptables_raw:
# name: openshift_extra
# keep_unmanaged: yes
# rules: "{{ appuio_extra_iptables }}"
# when: appuio_extra_iptables is defined
# - command: rpm -q docker
# ignore_errors: yes
# failed_when: no
# register: docker_installed
# - docker_image:
# name: "{{openshift_component_prefix}}-{{item}}:v{{openshift_version}}"
# #ignore_errors: yes
# with_items:
# - deployer
# - docker-builder
# - docker-registry
# - haproxy-router
# - keepalived-ipfailover
# - sti-builder
# - pod
# when: docker_installed.rc == 0
# - name: Prepare masters for OpenShift installation
# hosts: masters
# tasks:
# - name: Install redistributable OpenShift Clients
# yum: name={{openshift_package_name}}-clients-redistributable state=latest
# - name: Checkout web console style repo
# git: accept_hostkey=true dest=/var/lib/puppet-openshift3/style repo={{master_style_repo_url}} version={{master_style_repo_ref|default(omit)}} key_file={{master_style_repo_ssh_key|default(omit)}}
# when: master_style_repo_url|default("") != ""