|
25 | 25 | --ca-pass {{ elastic_ca_pass }}
|
26 | 26 | --name {{ ansible_hostname }}
|
27 | 27 | --ip {{ ansible_default_ipv4.address }}
|
28 |
| - --dns {{ ansible_hostname }},{{ ansible_fqdn }} |
29 |
| - --pass "{{ logstash_tls_key_passphrase }}" |
30 |
| - --out {{ elastic_ca_dir }}/{{ ansible_hostname }}.p12 |
| 28 | + --dns {{ ansible_hostname }},{{ ansible_fqdn }},{{ inventory_hostname }} |
| 29 | + --pass {{ logstash_tls_key_passphrase }} |
| 30 | + --out {{ elastic_ca_dir }}/{{ ansible_hostname }}-ls.p12 |
31 | 31 | delegate_to: "{{ elasticsearch_ca }}"
|
32 | 32 | args:
|
33 |
| - creates: "{{ elastic_ca_dir }}/{{ ansible_hostname }}.p12" |
| 33 | + creates: "{{ elastic_ca_dir }}/{{ ansible_hostname }}-ls.p12" |
34 | 34 | tags:
|
35 | 35 | - certificates
|
36 | 36 |
|
37 | 37 | - name: Fetch certificate from ca host to master
|
38 | 38 | fetch:
|
39 |
| - src: "{{ elastic_ca_dir }}/{{ ansible_hostname }}.p12" |
40 |
| - dest: "/tmp/{{ ansible_hostname }}.p12" |
| 39 | + src: "{{ elastic_ca_dir }}/{{ ansible_hostname }}-ls.p12" |
| 40 | + dest: "/tmp/{{ ansible_hostname }}-ls.p12" |
41 | 41 | flat: yes
|
42 | 42 | delegate_to: "{{ elasticsearch_ca }}"
|
43 | 43 | tags:
|
|
55 | 55 |
|
56 | 56 | - name: Copy the certificate to actual node
|
57 | 57 | copy:
|
58 |
| - src: "/tmp/{{ ansible_hostname }}.p12" |
| 58 | + src: "/tmp/{{ ansible_hostname }}-ls.p12" |
59 | 59 | dest: "{{ logstash_certs_dir }}/keystore.pfx"
|
60 | 60 | owner: root
|
61 | 61 | group: logstash
|
|
72 | 72 | --ca-pass {{ elastic_ca_pass }}
|
73 | 73 | --name {{ ansible_hostname }}
|
74 | 74 | --ip {{ ansible_default_ipv4.address }}
|
75 |
| - --dns {{ ansible_hostname }},{{ ansible_fqdn }} |
| 75 | + --dns {{ ansible_hostname }},{{ ansible_fqdn }},{{ inventory_hostname }} |
76 | 76 | --pass {{ logstash_tls_key_passphrase }}
|
77 | 77 | --pem
|
78 |
| - --out {{ elastic_ca_dir }}/{{ ansible_hostname }}.zip |
| 78 | + --out {{ elastic_ca_dir }}/{{ ansible_hostname }}-ls.zip |
79 | 79 | delegate_to: "{{ elasticsearch_ca }}"
|
80 | 80 | args:
|
81 |
| - creates: "{{ elastic_ca_dir }}/{{ ansible_hostname }}.zip" |
| 81 | + creates: "{{ elastic_ca_dir }}/{{ ansible_hostname }}-ls.zip" |
82 | 82 |
|
83 | 83 | - name: Fetch certificate from ca host to master
|
84 | 84 | fetch:
|
85 |
| - src: "{{ elastic_ca_dir }}/{{ ansible_hostname }}.zip" |
86 |
| - dest: "/tmp/{{ ansible_hostname }}.zip" |
| 85 | + src: "{{ elastic_ca_dir }}/{{ ansible_hostname }}-ls.zip" |
| 86 | + dest: "/tmp/{{ ansible_hostname }}-ls.zip" |
87 | 87 | flat: yes
|
88 | 88 | delegate_to: "{{ elasticsearch_ca }}"
|
89 | 89 | tags:
|
90 | 90 | - certificates
|
91 | 91 |
|
92 | 92 | - name: Copy the certificate to actual node
|
93 | 93 | unarchive:
|
94 |
| - src: "/tmp/{{ ansible_hostname }}.zip" |
| 94 | + src: "/tmp/{{ ansible_hostname }}-ls.zip" |
95 | 95 | dest: "{{ logstash_certs_dir }}/"
|
96 | 96 | owner: root
|
97 | 97 | group: logstash
|
|
135 | 135 | -passout pass:{{ logstash_tls_key_passphrase }}
|
136 | 136 | args:
|
137 | 137 | creates: "{{ logstash_certs_dir }}/{{ inventory_hostname }}-pkcs8.key"
|
| 138 | + when: logstash_beats_tls_encryptkey | bool |
| 139 | + |
| 140 | +- name: Create unencrypted Logstash compatible key |
| 141 | + command: > |
| 142 | + openssl pkcs8 |
| 143 | + -in {{ logstash_certs_dir }}/{{ inventory_hostname }}.key |
| 144 | + -topk8 |
| 145 | + -passin pass:{{ logstash_tls_key_passphrase }} |
| 146 | + -out {{ logstash_certs_dir }}/{{ inventory_hostname }}-pkcs8.key |
| 147 | + -nocrypt |
| 148 | + args: |
| 149 | + creates: "{{ logstash_certs_dir }}/{{ inventory_hostname }}-pkcs8.key" |
| 150 | + when: not logstash_beats_tls_encryptkey | bool |
138 | 151 |
|
139 | 152 | - name: Set permissions on Logstash key
|
140 | 153 | file:
|
|
0 commit comments