2018-03-28 15:42:12 +00:00
|
|
|
{% set counter = {'dns': 6,'ip': 1,} %}{% macro increment(dct, key, inc=1)%}{% if dct.update({key: dct[key] + inc}) %} {% endif %}{% endmacro %}[req]
|
2015-12-11 10:32:13 +00:00
|
|
|
req_extensions = v3_req
|
|
|
|
distinguished_name = req_distinguished_name
|
|
|
|
[req_distinguished_name]
|
|
|
|
[ v3_req ]
|
|
|
|
basicConstraints = CA:FALSE
|
|
|
|
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
|
|
|
subjectAltName = @alt_names
|
|
|
|
[alt_names]
|
|
|
|
DNS.1 = kubernetes
|
|
|
|
DNS.2 = kubernetes.default
|
2016-04-01 10:40:01 +00:00
|
|
|
DNS.3 = kubernetes.default.svc
|
|
|
|
DNS.4 = kubernetes.default.svc.{{ dns_domain }}
|
2016-09-28 11:05:08 +00:00
|
|
|
DNS.5 = localhost
|
2016-09-26 17:14:19 +00:00
|
|
|
{% for host in groups['kube-master'] %}
|
2018-03-28 15:42:12 +00:00
|
|
|
DNS.{{ counter["dns"] }} = {{ host }}{{ increment(counter, 'dns') }}
|
2016-09-26 17:14:19 +00:00
|
|
|
{% endfor %}
|
2018-03-28 15:42:12 +00:00
|
|
|
{% if apiserver_loadbalancer_domain_name is defined %}
|
|
|
|
DNS.{{ counter["dns"] }} = {{ apiserver_loadbalancer_domain_name }}{{ increment(counter, 'dns') }}
|
2015-12-15 15:51:55 +00:00
|
|
|
{% endif %}
|
2015-12-11 10:32:13 +00:00
|
|
|
{% for host in groups['kube-master'] %}
|
2018-03-28 15:42:12 +00:00
|
|
|
{% if hostvars[host]['access_ip'] is defined %}
|
|
|
|
IP.{{ counter["ip"] }} = {{ hostvars[host]['access_ip'] }}{{ increment(counter, 'ip') }}
|
|
|
|
{% endif %}
|
|
|
|
IP.{{ counter["ip"] }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}{{ increment(counter, 'ip') }}
|
2015-12-11 10:32:13 +00:00
|
|
|
{% endfor %}
|
2018-03-28 15:42:12 +00:00
|
|
|
{% if kube_apiserver_ip is defined %}
|
|
|
|
IP.{{ counter["ip"] }} = {{ kube_apiserver_ip }}{{ increment(counter, 'ip') }}
|
|
|
|
{% endif %}
|
2018-03-28 18:28:02 +00:00
|
|
|
{% if loadbalancer_apiserver is defined and loadbalancer_apiserver.address is defined %}
|
2018-03-28 15:42:12 +00:00
|
|
|
IP.{{ counter["ip"] }} = {{ loadbalancer_apiserver.address }}{{ increment(counter, 'ip') }}
|
2018-01-30 16:33:00 +00:00
|
|
|
{% endif %}
|
2017-10-17 10:06:07 +00:00
|
|
|
{% if supplementary_addresses_in_ssl_keys is defined %}
|
|
|
|
{% for addr in supplementary_addresses_in_ssl_keys %}
|
2017-11-16 14:38:49 +00:00
|
|
|
{% if addr | ipaddr %}
|
2018-03-28 15:42:12 +00:00
|
|
|
IP.{{ counter["ip"] }} = {{ addr }}{{ increment(counter, 'ip') }}
|
2017-11-16 14:38:49 +00:00
|
|
|
{% else %}
|
2018-03-28 15:42:12 +00:00
|
|
|
DNS.{{ counter["dns"] }} = {{ addr }}{{ increment(counter, 'dns') }}
|
2017-11-16 14:38:49 +00:00
|
|
|
{% endif %}
|
2017-10-17 10:06:07 +00:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2018-03-28 15:42:12 +00:00
|
|
|
IP.{{ counter["ip"] }} = 127.0.0.1
|