|
42 | 42 | {{ .binary_dir }}/pki/front-proxy.crt |
43 | 43 |
|
44 | 44 | - name: Cert | Generate the etcd certificate file |
| 45 | + loop: "{{ .groups.etcd | toJson }}" |
| 46 | + when: .item | empty | not |
45 | 47 | gen_cert: |
46 | 48 | root_key: >- |
47 | 49 | {{ .binary_dir }}/pki/root.key |
|
50 | 52 | cn: etcd |
51 | 53 | sans: >- |
52 | 54 | {{- $ips := list -}} |
53 | | - {{- range .groups.etcd | default list -}} |
54 | | - {{- $internalIPv4 := index $.hostvars . "internal_ipv4" | default "" -}} |
55 | | - {{- $internalIPv6 := index $.hostvars . "internal_ipv6" | default "" -}} |
56 | | - {{- if $internalIPv4 | empty | not -}} |
57 | | - {{- $ips = append $ips $internalIPv4 -}} |
58 | | - {{- end -}} |
59 | | - {{- if $internalIPv6 | empty | not -}} |
60 | | - {{- $ips = append $ips $internalIPv6 -}} |
61 | | - {{- end -}} |
| 55 | + {{- $hostname := index .hostvars .item "hostname" | default "" -}} |
| 56 | + {{- if .native.set_hostname -}} |
| 57 | + {{- $hostname = .item -}} |
| 58 | + {{- end -}} |
| 59 | + {{- if $hostname | empty | not -}} |
| 60 | + {{- $ips = append $ips $hostname -}} |
| 61 | + {{- end -}} |
| 62 | + {{- $internalIPv4 := index .hostvars .item "internal_ipv4" | default "" -}} |
| 63 | + {{- if $internalIPv4 | empty | not -}} |
| 64 | + {{- $ips = append $ips $internalIPv4 -}} |
| 65 | + {{- end -}} |
| 66 | + {{- $internalIPv6 := index .hostvars .item "internal_ipv6" | default "" -}} |
| 67 | + {{- if $internalIPv6 | empty | not -}} |
| 68 | + {{- $ips = append $ips $internalIPv6 -}} |
62 | 69 | {{- end -}} |
63 | 70 | {{ $ips | toJson }} |
64 | 71 | date: "{{ .certs.etcd.date }}" |
65 | 72 | policy: "{{ .certs.etcd.gen_cert_policy }}" |
66 | 73 | out_key: >- |
67 | | - {{ .binary_dir }}/pki/etcd.key |
| 74 | + {{ .binary_dir }}/pki/etcd-{{ .item }}.key |
68 | 75 | out_cert: >- |
69 | | - {{ .binary_dir }}/pki/etcd.crt |
| 76 | + {{ .binary_dir }}/pki/etcd-{{ .item }}.crt |
| 77 | +
|
| 78 | +- name: Cert | Generate the etcd client certificate file |
70 | 79 | when: .groups.etcd | default list | empty | not |
| 80 | + gen_cert: |
| 81 | + root_key: >- |
| 82 | + {{ .binary_dir }}/pki/root.key |
| 83 | + root_cert: >- |
| 84 | + {{ .binary_dir }}/pki/root.crt |
| 85 | + cn: etcd |
| 86 | + date: "{{ .certs.etcd.date }}" |
| 87 | + policy: "{{ .certs.etcd.gen_cert_policy }}" |
| 88 | + out_key: >- |
| 89 | + {{ .binary_dir }}/pki/etcd-client.key |
| 90 | + out_cert: >- |
| 91 | + {{ .binary_dir }}/pki/etcd-client.crt |
71 | 92 |
|
72 | 93 | - name: Cert | Generate the image registry certificate file |
73 | 94 | tags: ["image_registry"] |
|
0 commit comments