diff --git a/playbooks/wg0_conf.yml b/playbooks/wg0_conf.yml new file mode 100644 index 0000000..d3fd055 --- /dev/null +++ b/playbooks/wg0_conf.yml @@ -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 \ No newline at end of file