2018-11-15 05:58:17 +08:00
|
|
|
{% set counter = {'dns': 6,'ip': 1,} %}{% macro increment(dct, key, inc=1)%}{% if dct.update({key: dct[key] + inc}) %} {% endif %}{% endmacro %}[req]
|
2018-11-13 23:10:59 +08: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]
|
2018-11-15 05:58:17 +08:00
|
|
|
DNS.1 = kubernetes
|
|
|
|
DNS.2 = kubernetes.default
|
|
|
|
DNS.3 = kubernetes.default.svc
|
|
|
|
DNS.4 = kubernetes.default.svc.{{ dns_domain }}
|
|
|
|
DNS.5 = localhost
|
2018-11-13 23:10:59 +08:00
|
|
|
DNS.{{ counter["dns"] }} = {{ inventory_hostname }}{{ increment(counter, 'dns') }}
|
|
|
|
{% if hostvars[inventory_hostname]['access_ip'] is defined %}
|
|
|
|
IP.{{ counter["ip"] }} = {{ hostvars[inventory_hostname]['access_ip'] }}{{ increment(counter, 'ip') }}
|
|
|
|
{% endif %}
|
|
|
|
IP.{{ counter["ip"] }} = {{ hostvars[inventory_hostname]['ip'] | default(hostvars[inventory_hostname]['ansible_default_ipv4']['address']) }}{{ increment(counter, 'ip') }}
|
|
|
|
IP.{{ counter["ip"] }} = 127.0.0.1
|