aboutsummaryrefslogtreecommitdiffstats
path: root/roles/wireguard/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/wireguard/tasks')
-rw-r--r--roles/wireguard/tasks/configuration.yml4
-rw-r--r--roles/wireguard/tasks/keys.yml2
-rw-r--r--roles/wireguard/tasks/main.yml14
-rw-r--r--roles/wireguard/tasks/service.yml7
4 files changed, 13 insertions, 14 deletions
diff --git a/roles/wireguard/tasks/configuration.yml b/roles/wireguard/tasks/configuration.yml
index efb8008..6925e2a 100644
--- a/roles/wireguard/tasks/configuration.yml
+++ b/roles/wireguard/tasks/configuration.yml
@@ -1,5 +1,5 @@
- name: generate wireguard configuration
- template:
+ ansible.builtin.template:
src: wireguard.conf.j2
dest: "{{ wireguard_local_dir }}/{{ item }}.conf"
mode: 0600
@@ -10,7 +10,7 @@
loop: "{{ groups.all }}"
- name: copy wireguard configuration
- copy:
+ ansible.builtin.copy:
src: "{{ wireguard_local_dir }}/{{ wireguard_local_configuration }}"
dest: "{{ wireguard_dir }}/{{ wireguard_domain_controller }}.conf"
owner: 0
diff --git a/roles/wireguard/tasks/keys.yml b/roles/wireguard/tasks/keys.yml
index 7a89010..128d943 100644
--- a/roles/wireguard/tasks/keys.yml
+++ b/roles/wireguard/tasks/keys.yml
@@ -1,5 +1,5 @@
- name: generate hosts keys
- shell: |
+ ansible.builtin.shell: |
set -o pipefail
ls "{{ wireguard_local_dir }}/{{ item }}.keys" && exit 0
umask 077
diff --git a/roles/wireguard/tasks/main.yml b/roles/wireguard/tasks/main.yml
index d1ff496..d780186 100644
--- a/roles/wireguard/tasks/main.yml
+++ b/roles/wireguard/tasks/main.yml
@@ -1,5 +1,5 @@
- name: create local wireguard directory
- file:
+ ansible.builtin.file:
path: "{{ wireguard_local_dir }}"
state: directory
mode: 0700
@@ -7,7 +7,7 @@
delegate_to: localhost
- name: create wireguard directory
- file:
+ ansible.builtin.file:
path: "{{ wireguard_dir }}"
owner: 0
group: 0
@@ -15,22 +15,22 @@
state: directory
- name: include key generation
- include_tasks: keys.yml
+ ansible.builtin.include_tasks: keys.yml
- name: include configuration generation
- include_tasks: configuration.yml
+ ansible.builtin.include_tasks: configuration.yml
- name: install wireguard on remote host
- package:
+ ansible.builtin.package:
name: wireguard-tools
state: present
- name: include service configuration for hosts
- include_tasks: service.yml
+ ansible.builtin.include_tasks: service.yml
when: inventory_hostname == wireguard_domain_controller
- name: include service configuration for server
- include_tasks: "{{ task }}"
+ ansible.builtin.include_tasks: "{{ task }}"
when: inventory_hostname != wireguard_domain_controller
loop_control:
loop_var: task
diff --git a/roles/wireguard/tasks/service.yml b/roles/wireguard/tasks/service.yml
index 37f3cec..c9e7f60 100644
--- a/roles/wireguard/tasks/service.yml
+++ b/roles/wireguard/tasks/service.yml
@@ -1,16 +1,15 @@
- name: enable wireguard interface for OpenBSD
- lineinfile:
+ ansible.builtin.lineinfile:
path: /etc/rc.local
regexp: "^/usr/local/bin/wg-quick up {{ wireguard_domain_controller }}$"
line: "/usr/local/bin/wg-quick up {{ wireguard_domain_controller }}"
owner: 0
- owner: 0
create: true
mode: 0644
when: ansible_distribution == "OpenBSD"
- name: restart wireguard interface
- raw: |
+ ansible.builtin.raw: |
wg-quick down {{ wireguard_domain_controller }}
sleep {{ 10 | random(start=1) }}
wg-quick up {{ wireguard_domain_controller }}
@@ -18,5 +17,5 @@
register: result
- name: show wireguard output
- debug:
+ ansible.builtin.debug:
var: result
remember that computers suck.