-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathactivate-internal-lb.yml
71 lines (66 loc) · 2.6 KB
/
activate-internal-lb.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
- hosts: masters
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
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_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
tasks:
- name: Configure local client for API load balancer
lineinfile:
path: /home/{{ admin_user }}/.kube/config
regexp: " server: https://[^:]+:{{ hostvars[groups['masters'][0]]['openshift_master_api_port'] }}"
line: " server: https://{{ hostvars[groups['masters'][0]]['master_lb_dns'] }}:{{ hostvars[groups['masters'][0]]['openshift_master_api_port'] }}"
state: present
backup: yes
# The bastion is not part of the Ansible inventory file.
- name: Add bastion host
add_host:
name: bastion
groups: bastions
ansible_user: "{{ admin_user }}"
ansible_become: True
- name: Configure bastion client for API load balancer
lineinfile:
path: /home/{{ admin_user }}/.kube/config
regexp: " server: https://[^:]+:{{ hostvars[groups['masters'][0]]['openshift_master_api_port'] }}"
line: " server: https://{{ hostvars[groups['masters'][0]]['master_lb_dns'] }}:{{ hostvars[groups['masters'][0]]['openshift_master_api_port'] }}"
state: present
backup: yes
delegate_to: bastion