Install wireguard server
This commit is contained in:
parent
db941391ca
commit
730246e67f
4 changed files with 67 additions and 28 deletions
3
ansible/roles/gateway/files/limit-unstable.conf
Normal file
3
ansible/roles/gateway/files/limit-unstable.conf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Package: *
|
||||||
|
Pin: release a=unstable
|
||||||
|
Pin-Priority: 90
|
29
ansible/roles/gateway/tasks/haproxy.yml
Normal file
29
ansible/roles/gateway/tasks/haproxy.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
- name: Install Haproxy
|
||||||
|
apt:
|
||||||
|
name: haproxy
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
|
||||||
|
- name: Import vault
|
||||||
|
include_vars:
|
||||||
|
file: vault.yml
|
||||||
|
|
||||||
|
- name: Define context
|
||||||
|
set_fact:
|
||||||
|
upstream: 10.23.0.2
|
||||||
|
|
||||||
|
- name: Haproxy config
|
||||||
|
template:
|
||||||
|
src: files/haproxy.cfg
|
||||||
|
dest: /etc/haproxy/haproxy.cfg
|
||||||
|
validate: /usr/sbin/haproxy -c -- %s
|
||||||
|
backup: yes
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
register: haproxy_config
|
||||||
|
|
||||||
|
- name: Restart Haproxy
|
||||||
|
service:
|
||||||
|
name: haproxy
|
||||||
|
state: reloaded
|
||||||
|
when: haproxy_config.changed
|
|
@ -1,29 +1,5 @@
|
||||||
- name: Install Haproxy
|
- name: Configure HAproxy
|
||||||
apt:
|
include: haproxy.yml
|
||||||
name: haproxy
|
|
||||||
become: true
|
|
||||||
become_user: root
|
|
||||||
|
|
||||||
- name: Import vault
|
- name: Configure wireguard
|
||||||
include_vars:
|
include: wireguard.yml
|
||||||
file: vault.yml
|
|
||||||
|
|
||||||
- name: Define context
|
|
||||||
set_fact:
|
|
||||||
upstream: 10.23.0.2
|
|
||||||
|
|
||||||
- name: Haproxy config
|
|
||||||
template:
|
|
||||||
src: files/haproxy.cfg
|
|
||||||
dest: /etc/haproxy/haproxy.cfg
|
|
||||||
validate: /usr/sbin/haproxy -c -- %s
|
|
||||||
backup: yes
|
|
||||||
become: true
|
|
||||||
become_user: root
|
|
||||||
register: haproxy_config
|
|
||||||
|
|
||||||
- name: Restart Haproxy
|
|
||||||
service:
|
|
||||||
name: haproxy
|
|
||||||
state: reloaded
|
|
||||||
when: haproxy_config.changed
|
|
||||||
|
|
31
ansible/roles/gateway/tasks/wireguard.yml
Normal file
31
ansible/roles/gateway/tasks/wireguard.yml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
- name: Add unstable apt repo
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/apt/sources.list.d/unstable.list
|
||||||
|
state: present
|
||||||
|
line: 'deb http://deb.debian.org/debian/ unstable main'
|
||||||
|
register: install_unstable_apt
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
|
||||||
|
- name: Limit unstable apt repo
|
||||||
|
copy:
|
||||||
|
src: limit-unstable.conf
|
||||||
|
dest: /etc/apt/preferences.d/limit-unstable
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
register: limit_unstable_apt
|
||||||
|
|
||||||
|
- name: Update apt repos
|
||||||
|
apt:
|
||||||
|
update_cache: true
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
when: install_unstable_apt.changed or limit_unstable_apt.changed
|
||||||
|
|
||||||
|
- name: Install Wireguard
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- wireguard
|
||||||
|
- wireguard-tools
|
||||||
|
become: true
|
||||||
|
become_user: root
|
Loading…
Reference in a new issue