Skip to content

Commit

Permalink
wireguard: Correctif divers
Browse files Browse the repository at this point in the history
- ajout génération clés wireguard
- activation NAT sur serveur
- activation service systemd wireguard sur serveur aussi
  • Loading branch information
jocelynj committed Aug 24, 2024
1 parent 8c7e8c0 commit 03a7972
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion roles/wireguard/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
pkg:
- wireguard

- name: Generate the client keys

Check failure on line 6 in roles/wireguard/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint

deprecated-local-action

Do not use 'local_action', use 'delegate_to: localhost'.

Check failure on line 6 in roles/wireguard/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint

risky-shell-pipe

Shells that use pipes should set the pipefail option.
local_action:
module: shell
_raw_params: "wg genkey | tee credentials/wireguard/{{ inventory_hostname }}.private.key | wg pubkey > credentials/wireguard/{{ inventory_hostname }}.public.key"
creates: "credentials/wireguard/{{ inventory_hostname }}.private.key"
become: no

- name: Get client IP

Check failure on line 13 in roles/wireguard/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint

deprecated-local-action

Do not use 'local_action', use 'delegate_to: localhost'.
local_action:
module: copy
content: "{{ wireguard_address }}\n"
dest: "credentials/wireguard/{{ inventory_hostname }}.address"
become: no

- name: Enable NAT on server

Check failure on line 20 in roles/wireguard/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint

fqcn[action]

Use FQCN for module actions, such `ansible.posix.sysctl`.
sysctl:
name: net.ipv4.ip_forward
value: '1'
sysctl_set: true
state: present
when: wireguard_config is defined and wireguard_config == "server"

- name: configure wireguard
template:
dest="/etc/wireguard/wg0.conf"
Expand Down Expand Up @@ -35,4 +57,3 @@
enabled: true
masked: false
state: started
when: wireguard_config is not defined or wireguard_config == "client"

0 comments on commit 03a7972

Please sign in to comment.