2022-09-09 16:29:22 +08:00
|
|
|
---
|
|
|
|
- name: Gen_certs | Set cert names per node
|
|
|
|
set_fact:
|
|
|
|
my_etcd_node_certs: [ 'ca.pem',
|
|
|
|
'node-{{ inventory_hostname }}.pem',
|
|
|
|
'node-{{ inventory_hostname }}-key.pem']
|
|
|
|
tags:
|
|
|
|
- facts
|
|
|
|
|
|
|
|
- name: "Check_certs | Set 'sync_certs' to true on nodes"
|
|
|
|
set_fact:
|
|
|
|
sync_certs: true
|
|
|
|
with_items:
|
|
|
|
- "{{ my_etcd_node_certs }}"
|
|
|
|
|
|
|
|
- name: Gen_certs | Gather node certs
|
2023-10-19 11:04:29 +08:00
|
|
|
vars:
|
|
|
|
ansible_ssh_retries: 10
|
2023-07-05 11:36:54 +08:00
|
|
|
shell: "set -o pipefail && tar cfz - -C {{ etcd_cert_dir }} {{ my_etcd_node_certs | join(' ') }} | base64 --wrap=0"
|
2022-09-09 16:29:22 +08:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2023-07-05 11:36:54 +08:00
|
|
|
no_log: "{{ not (unsafe_show_logs | bool) }}"
|
2022-09-09 16:29:22 +08:00
|
|
|
register: etcd_node_certs
|
2024-08-28 13:30:56 +08:00
|
|
|
check_mode: false
|
2022-09-09 16:29:22 +08:00
|
|
|
delegate_to: "{{ groups['etcd'][0] }}"
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: Gen_certs | Copy certs on nodes
|
2023-07-05 11:36:54 +08:00
|
|
|
shell: "set -o pipefail && base64 -d <<< '{{ etcd_node_certs.stdout | quote }}' | tar xz -C {{ etcd_cert_dir }}"
|
2022-09-09 16:29:22 +08:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2023-07-05 11:36:54 +08:00
|
|
|
no_log: "{{ not (unsafe_show_logs | bool) }}"
|
2022-09-09 16:29:22 +08:00
|
|
|
changed_when: false
|