This commit is contained in:
haroldwongms 2018-11-09 07:59:53 -07:00
Родитель e5d99eb50f
Коммит 26e312901b
1 изменённых файлов: 65 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,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/node.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/node.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