-
Notifications
You must be signed in to change notification settings - Fork 24
/
activate-private-lb.yaml
65 lines (62 loc) · 2.1 KB
/
activate-private-lb.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
- hosts: masters
become: yes
vars_files:
- vars.yaml
tasks:
- name: Configure master client for local API
lineinfile:
path: "{{ item }}"
regexp: " server: https://.+"
line: " server: https://{{ ansible_hostname }}"
state: present
backup: yes
with_items:
- /root/.kube/config
- /home/{{ admin_user }}/.kube/config
- /etc/origin/master/admin.kubeconfig
- name: Configure master node for local API
lineinfile:
path: /etc/origin/node/system:node:{{ ansible_hostname }}.kubeconfig
regexp: " server: https://[^:]+:{{ openshift_master_api_port }}"
line: " server: https://{{ ansible_hostname }}:{{ openshift_master_api_port }}"
state: present
backup: yes
notify: Restart atomic-openshift-node
handlers:
- name: Restart atomic-openshift-node
service:
name: atomic-openshift-node
state: restarted
- hosts: nodes:!masters
become: yes
vars_files:
- vars.yaml
tasks:
- name: Configure non-master node for API load balancer
lineinfile:
path: /etc/origin/node/system:node:{{ ansible_hostname }}.kubeconfig
regexp: " server: https://[^:]+:{{ openshift_master_api_port }}"
line: " server: https://{{ master_lb_private_dns }}:{{ openshift_master_api_port }}"
state: present
backup: yes
notify: Restart atomic-openshift-node
handlers:
- name: Restart atomic-openshift-node
service:
name: atomic-openshift-node
state: restarted
- hosts: localhost
become: yes
vars_files:
- vars.yaml
tasks:
- name: Configure local client for API load balancer
lineinfile:
path: "{{ item }}"
regexp: " server: https://[^:]+:{{ hostvars[groups['masters'][0]]['openshift_master_api_port'] }}"
line: " server: https://{{ master_lb_private_dns }}:{{ hostvars[groups['masters'][0]]['openshift_master_api_port'] }}"
state: present
backup: yes
with_items:
- /root/.kube/config
- /home/{{ admin_user }}/.kube/config