manage undefined vars for loadbalancing
This commit is contained in:
parent
43afd42f59
commit
c91a3183d3
3 changed files with 4 additions and 2 deletions
|
@ -14,7 +14,7 @@
|
||||||
regexp: ".*{{ apiserver_loadbalancer_domain_name }}$"
|
regexp: ".*{{ apiserver_loadbalancer_domain_name }}$"
|
||||||
line: "{{ loadbalancer_apiserver.address }} lb-apiserver.kubernetes.local"
|
line: "{{ loadbalancer_apiserver.address }} lb-apiserver.kubernetes.local"
|
||||||
state: present
|
state: present
|
||||||
when: loadbalancer_apiserver is defined
|
when: loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined
|
||||||
|
|
||||||
- name: clean hosts file
|
- name: clean hosts file
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
|
|
@ -15,7 +15,7 @@ spec:
|
||||||
{% if inventory_hostname in groups['kube-master'] %}
|
{% if inventory_hostname in groups['kube-master'] %}
|
||||||
- --master=http://127.0.0.1:8080
|
- --master=http://127.0.0.1:8080
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if loadbalancer_apiserver.address is defined | default('') %}
|
{% if loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined %}
|
||||||
- --master=https://{{ apiserver_loadbalancer_domain_name }}:{{ loadbalancer_apiserver.port }}
|
- --master=https://{{ apiserver_loadbalancer_domain_name }}:{{ loadbalancer_apiserver.port }}
|
||||||
{% else %}
|
{% else %}
|
||||||
- --master=https://{{ groups['kube-master'][0] }}:{{ kube_apiserver_port }}
|
- --master=https://{{ groups['kube-master'][0] }}:{{ kube_apiserver_port }}
|
||||||
|
|
|
@ -10,7 +10,9 @@ subjectAltName = @alt_names
|
||||||
DNS.1 = kubernetes
|
DNS.1 = kubernetes
|
||||||
DNS.2 = kubernetes.default
|
DNS.2 = kubernetes.default
|
||||||
DNS.3 = kubernetes.default.svc.{{ dns_domain }}
|
DNS.3 = kubernetes.default.svc.{{ dns_domain }}
|
||||||
|
{% if loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined %}
|
||||||
DNS.4 = {{ apiserver_loadbalancer_domain_name }}
|
DNS.4 = {{ apiserver_loadbalancer_domain_name }}
|
||||||
|
{% endif %}
|
||||||
{% for host in groups['kube-master'] %}
|
{% for host in groups['kube-master'] %}
|
||||||
IP.{{ loop.index }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
|
IP.{{ loop.index }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue