add tag, and cleanup
This commit is contained in:
parent
8616e8dcf1
commit
9c0f2ff86f
|
@ -14,7 +14,6 @@
|
|||
- wireguard-tools
|
||||
tags:
|
||||
- wg-install
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Enable WireGuard kernel module
|
||||
modprobe:
|
||||
|
@ -42,21 +41,22 @@
|
|||
- name: Generate WireGuard private key
|
||||
shell: "wg genkey"
|
||||
register: wg_private_key_result
|
||||
when: not config_file_stat.stat.exists
|
||||
tags:
|
||||
- wg-generate-keys
|
||||
- skip_ansible_lint
|
||||
when: not config_file_stat.stat.exists
|
||||
|
||||
- name: Read WireGuard config file
|
||||
slurp:
|
||||
src: "{{ wireguard_remote_directory }}/{{ wireguard_interface }}.conf"
|
||||
register: wg_config
|
||||
tags:
|
||||
- wg-config
|
||||
|
||||
- name: Set private key fact
|
||||
set_fact:
|
||||
private_key: "{{ wg_config['content'] | b64decode | regex_findall('PrivateKey = (.*)') | first }}"
|
||||
tags:
|
||||
wg-config
|
||||
- wg-config
|
||||
|
||||
- name: Derive WireGuard public key
|
||||
shell: "echo '{{ private_key }}' | wg pubkey"
|
||||
|
@ -69,7 +69,7 @@
|
|||
set_fact:
|
||||
public_key: "{{ wg_public_key_result.stdout }}"
|
||||
tags:
|
||||
wg-config
|
||||
- wg-config
|
||||
|
||||
- name: Create WireGuard configuration directory
|
||||
file:
|
||||
|
@ -95,12 +95,16 @@
|
|||
stat:
|
||||
path: "{{ wireguard_remote_directory }}/.reload-module-on-update"
|
||||
register: reload_module_on_update
|
||||
tags:
|
||||
- wg-config
|
||||
|
||||
- name: Set WireGuard reload-module-on-update
|
||||
file:
|
||||
dest: "{{ wireguard_remote_directory }}/.reload-module-on-update"
|
||||
state: touch
|
||||
when: not reload_module_on_update.stat.exists
|
||||
tags:
|
||||
- wg-config
|
||||
|
||||
- name: Start and enable WireGuard service
|
||||
service:
|
||||
|
@ -114,3 +118,5 @@
|
|||
state: absent
|
||||
delegate_to: localhost
|
||||
run_once: true
|
||||
tags:
|
||||
- wg-config
|
||||
|
|
Reference in a new issue