fix linter errors

This commit is contained in:
Sergey Malyuk
2025-12-12 14:17:20 +03:00
parent 5ac15313d8
commit db55cb16eb
20 changed files with 257 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
---
- name: "Install Wireguard system-wide"
ansible.builtin.apt:
name: wireguard
state: present
update_cache: true
cache_valid_time: 3600
- name: "Ensure no dashes in the interface name"
when: "'-' in iface_name"
ansible.builtin.fail:
msg: "The interface name must not contain dashes, got: '{{ iface_name }}'"
- name: "Create a Spoke configuration file"
no_log: "{{ wg_spoke_hide_secrets }}"
notify: "Run the Wireguard service"
ansible.builtin.blockinfile:
path: "/etc/wireguard/{{ iface_name }}.conf"
create: true
owner: root
group: root
mode: "0600"
state: present
block: |
[Interface] # Local settings for this node
Address = {{ spoke_ipv4_vpn }}/32
ListenPort = {{ spoke_port }}
PrivateKey = {{ spoke_pkey }}
{% if dns_server is defined and domain is defined %}
PostUp = resolvectl dns %i {{ dns_server }}; resolvectl domain %i {{ domain }}
{% endif %}
[Peer] # Settings for the Hub peer
PublicKey = {{ hub_pubkey }}
{% if spoke_psk is defined %}
PresharedKey = {{ spoke_psk }}
{% endif %}
AllowedIPs = {{ subnet }}/{{ netmask }}
Endpoint = {{ hub_ipv4_wan }}:{{ hub_port }}
PersistentKeepalive = 20

View File

@@ -0,0 +1,11 @@
---
# SRC https://www.procustodibus.com/blog/2021/03/wireguard-logs/
- name: "Add wireguard module"
community.general.modprobe:
name: wireguard
state: present
- name: "Turn on Wireguard dyndbg logging into kernel message buffer"
changed_when: false
ansible.builtin.shell:
cmd: echo module wireguard +p > /sys/kernel/debug/dynamic_debug/control

View File

@@ -0,0 +1,9 @@
---
- name: "Include Wireguard deployment tasks"
ansible.builtin.include_tasks:
file: "tasks/deploy.yml"
- name: "Include Wireguard logging configuration tasks"
when: wg_spoke_logging is true
ansible.builtin.include_tasks:
file: "tasks/logging.yml"