review: block, var name, shell pipe
This commit is contained in:
parent
cdec7e34c6
commit
1894bf07dd
|
@ -107,11 +107,16 @@
|
|||
tags:
|
||||
- wg-config
|
||||
|
||||
- block:
|
||||
- name: Create private key for unmanaged hosts
|
||||
shell: "wg genkey | tee {{ wireguard_remote_directory }}/{{ item.host }}-privatekey"
|
||||
shell: |
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
wg genkey | tee {{ wireguard_remote_directory }}/{{ item.host }}-privatekey
|
||||
exit 0
|
||||
args:
|
||||
creates: "{{ wireguard_remote_directory }}/{{ item.host }}-privatekey"
|
||||
register: uh_privkey
|
||||
register: uh_private_key
|
||||
with_items: "{{ wireguard_unmanaged_hosts | default([]) }}"
|
||||
|
||||
- name: Validate permissions of unmanaged hosts' private keys
|
||||
|
@ -122,7 +127,7 @@
|
|||
|
||||
- name: Recover existing private key for unmanaged hosts
|
||||
shell: "cat {{ wireguard_remote_directory }}/{{ item.host }}-privatekey"
|
||||
register: uh_privkey
|
||||
register: uh_private_key
|
||||
changed_when: false
|
||||
with_items: "{{ wireguard_unmanaged_hosts | default([]) }}"
|
||||
|
||||
|
@ -138,6 +143,7 @@
|
|||
register: uh_pubkey
|
||||
changed_when: false
|
||||
with_items: "{{ wireguard_unmanaged_hosts | default([]) }}"
|
||||
when: wireguard_unmanaged_hosts is defined and wireguard_unmanaged_hosts
|
||||
|
||||
- name: Generate WireGuard configuration file
|
||||
template:
|
||||
|
@ -158,7 +164,7 @@
|
|||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
with_items: "{{ uh_privkey.results }}"
|
||||
with_items: "{{ uh_private_key.results }}"
|
||||
|
||||
- name: Check if reload-module-on-update is set
|
||||
stat:
|
||||
|
|
Reference in a new issue