From b81bfc5a294b5bd437a09bced94a670928a822b9 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Mon, 18 Mar 2024 17:04:18 -0400 Subject: [PATCH] add hatecomputers role! --- deploy-hatecomputers.yml | 4 ++++ inventory | 3 +++ roles/hatecomputers/files/.gitignore | 1 + roles/hatecomputers/tasks/main.yml | 33 ++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 deploy-hatecomputers.yml create mode 100644 roles/hatecomputers/files/.gitignore create mode 100644 roles/hatecomputers/tasks/main.yml diff --git a/deploy-hatecomputers.yml b/deploy-hatecomputers.yml new file mode 100644 index 0000000..a011104 --- /dev/null +++ b/deploy-hatecomputers.yml @@ -0,0 +1,4 @@ +- name: hatecomputers setup + hosts: hatecomputers + roles: + - hatecomputers diff --git a/inventory b/inventory index 450c150..83bff92 100644 --- a/inventory +++ b/inventory @@ -64,3 +64,6 @@ europa ansible_user=root ansible_connection=ssh [drone] europa ansible_user=root ansible_connection=ssh + +[hatecomputers] +levi ansible_user=root ansible_connection=ssh diff --git a/roles/hatecomputers/files/.gitignore b/roles/hatecomputers/files/.gitignore new file mode 100644 index 0000000..5571ff7 --- /dev/null +++ b/roles/hatecomputers/files/.gitignore @@ -0,0 +1 @@ +wireguard.cfg diff --git a/roles/hatecomputers/tasks/main.yml b/roles/hatecomputers/tasks/main.yml new file mode 100644 index 0000000..7eac0f4 --- /dev/null +++ b/roles/hatecomputers/tasks/main.yml @@ -0,0 +1,33 @@ +- name: install wireguard + apt: + name: + - wireguard + state: latest + +- name: copy config + ansible.builtin.copy: + src: ../files/wireguard.cfg + dest: /etc/wireguard/hatecomputers.conf + owner: root + group: root + mode: 0600 + +- name: enable and persist ip forwarding + sysctl: + name: net.ipv4.ip_forward + value: "1" + state: present + sysctl_set: yes + reload: yes + +- name: start wireguard and enable on boot + systemd: + name: wg-quick@hatecomputers + enabled: yes + state: started + +- name: allow wireguard endpoint ufw + ufw: + rule: allow + port: '51820' + proto: 'udp'