openshift-container-platfor.../activate-private-lb.31x.yaml

66 строки
2.0 KiB
YAML

- 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