Add playbooks/wg0_conf.yml
This commit is contained in:
18
playbooks/wg0_conf.yml
Normal file
18
playbooks/wg0_conf.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
- name: configure wireguard
|
||||||
|
hosts: wireguard
|
||||||
|
become: true
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: install wireguard configuration file
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../configs/wg0
|
||||||
|
dest: /etc/wireguard/wg0.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0600
|
||||||
|
|
||||||
|
- name: enter server private key into configuration file
|
||||||
|
shell: sed -i "4c PrivateKey = $(cat /etc/wireguard/server.private.key)" /etc/wireguard/wg0.conf
|
||||||
|
|
||||||
|
- name: enter client public key into configuration file
|
||||||
|
shell: sed -i "14c PublicKey = $(cat /etc/wireguard/client.public.key)" /etc/wireguard/wg0.conf
|
||||||
Reference in New Issue
Block a user