-
Notifications
You must be signed in to change notification settings - Fork 0
/
ocplabs-ocp-nodes-post-setup.yaml
92 lines (92 loc) · 3.86 KB
/
ocplabs-ocp-nodes-post-setup.yaml
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
- hosts: localhost
vars:
users:
- name: admin
password: 'redhat2018!'
- name: developer
password: 'redhat2018!'
tasks:
- name: create_htpasswd_users | Create Users via htpasswd
htpasswd:
path: "/etc/origin/master/htpasswd"
create: yes
name: "{{item.name}}"
password: "{{item.password}}"
owner: root
group: root
mode: 0640
state: present
with_items: "{{ users }}"
- hosts: masters
tasks:
- name: setup_dnsmasq_apps | Setup dnsmasq for .apps.* domain
copy:
src: ocplabs-dnsmasq.conf
dest: /etc/dnsmasq.d/ocplabs.conf
owner: root
group: root
mode: 0640
- name: setup_dnsmasq_apps | Stop dnsmasq
systemd:
name: dnsmasq
state: stopped
- name: setup_dnsmasq_apps | Start dnsmasq
systemd:
name: dnsmasq
state: started
- name: setup_firewall_dnsmasq | Setup firewall for DNS-Masq (TCP)
iptables:
chain: INPUT
protocol: tcp
destination_port: 53
jump: ACCEPT
- name: setup_firewall_dnsmasq | Setup firewall for DNS-Masq (UDP)
iptables:
chain: INPUT
protocol: udp
destination_port: 53
jump: ACCEPT
- name: setup_firewall_dnsmasq | Save firewall for DNS-Masq
shell: iptables-save > /etc/sysconfig/iptables
- name: copy_htpasswd | Copy htpasswd
copy:
src: /etc/origin/master/htpasswd
dest: /etc/origin/master/htpasswd
owner: root
group: root
mode: 0640
- name: setup_ocp_admin_roles | Login as system:admin
shell: oc login -u system:admin -n default --config=/etc/origin/master/admin.kubeconfig
- name: setup_ocp_admin_roles | Setup Admin roles for OCP (registry)
shell: oc adm policy add-role-to-user system:registry admin --config=/etc/origin/master/admin.kubeconfig
- name: setup_ocp_admin_roles | Setup Admin roles for OCP (admin for openshift namespace)
shell: oc adm policy add-role-to-user admin admin -n openshift --config=/etc/origin/master/admin.kubeconfig
- name: setup_ocp_admin_roles | Setup Admin roles for OCP (image-builder)
shell: oc adm policy add-role-to-user system:image-builder admin --config=/etc/origin/master/admin.kubeconfig
- name: setup_ocp_admin_roles | Setup Admin roles for OCP (cluster-admin)
shell: oc adm policy add-cluster-role-to-user cluster-admin admin --config=/etc/origin/master/admin.kubeconfig
- name: update_image_streams | Update Image Streams
shell: oc get is -n openshift --no-headers=true | awk '{print $1}' | xargs -I{} oc import-image {} -n openshift --all --insecure=true
register: import_image_result
until: import_image_result.rc == 0
retries: 10
delay: 1
ignore_errors: yes
- name: metrics_viewer | Create service account
shell: oc create sa metrics-deployer -n openshift-infra --insecure-skip-tls-verify=true --config=/etc/origin/master/admin.kubeconfig
- name: metrics_viewer | Add edit role
shell: oc adm policy add-role-to-user edit system:serviceaccount:openshift-infra:metrics-deployer --insecure-skip-tls-verify=true --config=/etc/origin/master/admin.kubeconfig
- name: metrics_viewer | Add cluster role
shell: oc adm policy add-cluster-role-to-user cluster-reader system:serviceaccount:openshift-infra:heapster --insecure-skip-tls-verify=true --config=/etc/origin/master/admin.kubeconfig
- hosts: masters:nodes
tasks:
- name: create_symlink_directory | Create directy for certificate symlink, workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1553838
file:
path: /etc/docker/certs.d/docker-registry.default.svc:5000
state: directory
recurse: yes
- name: create_symlink | Create certificate symlink, workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1553838
file:
src: /etc/origin/node/client-ca.crt
dest: /etc/docker/certs.d/docker-registry.default.svc:5000/node-client-ca.crt
state: link