From 100a06be9b01b8a50dc89e4cf8f5e6a9aa1a0f5a Mon Sep 17 00:00:00 2001 From: Opnxng Date: Sat, 11 Nov 2023 04:31:12 +0800 Subject: [PATCH] Added installation step --- README.md | 21 ++++++--------------- tasks/main.yml | 13 +++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3a06ce9..2b7fbc8 100644 --- a/README.md +++ b/README.md @@ -22,31 +22,22 @@ The role uses the `wg-quick` control which is also exposed via a Systemd service ``` all: hosts: - your-host-1: - pipelining: true - ansible_ssh_user: root + host1: ansible_host: 172.0.0.1 - ansible_ssh_port: 22 - wireguard_ip: 10.1.0.1 - your-host-2: - pipelining: true - ansible_ssh_user: root + host2: ansible_host: 172.0.0.2 - ansible_ssh_port: 22 - wireguard_ip: 10.2.0.1 - your-host-3: - pipelining: true - ansible_ssh_user: root + host3: ansible_host: 172.0.0.3 - ansible_ssh_port: 22 - wireguard_ip: 10.3.0.1 vars: + pipelining: true + ansible_ssh_port: 22 + ansible_ssh_user: root ansible_become_method: su wireguard_mask_bits: 24 wireguard_port: 51871 diff --git a/tasks/main.yml b/tasks/main.yml index 5396356..773ab47 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,3 +1,16 @@ +- name: Get kernel release + command: 'uname -r' + register: uname_r_result + no_log: true + +- name: Install packages + apt: + name: + - wireguard + - linux-headers-{{ uname_r_result.stdout }} + state: latest + install_recommends: false + - name: Generate Wireguard keypair shell: wg genkey | tee /etc/wireguard/privatekey | wg pubkey | tee /etc/wireguard/publickey args: