Convert arch standalones to proper subtask syntax.

master
jowj 5 years ago
parent 482e74378b
commit 4afe109ef0

@ -1,22 +1,19 @@
- hosts: vpn - name: (local) fill out the rest of the wg0.conf file
remote_user: josiah blockinfile:
gather_facts: false path: /etc/wireguard/wg0.conf
become: yes block: |
Address = 10.200.219.2/32, fd86:ea04:1115::2/128
tasks: DNS = 1.1.1.1
- name: (local) fill out the rest of the wg0.conf file
blockinfile:
path: /etc/wireguard/wg0.conf
block: |
Address = 10.200.219.2/32, fd86:ea04:1115::2/128
DNS = 1.1.1.1
[Peer] [Peer]
PublicKey = {{ server_publickey.stdout }} PublicKey = {{ server_publickey.stdout }}
Endpoint = vpn.awful.club:51820 Endpoint = vpn.awful.club:51820
AllowedIPs = 0.0.0.0/0 AllowedIPs = 0.0.0.0/0
delegate_to: localhost delegate_to: localhost
become: yes
- name: (local) bring wg up on local - name: (local) bring wg up on local
shell: wg-quick up wg0 shell: wg-quick up wg0
delegate_to: localhost delegate_to: localhost
become: yes
ignore_errors: True

@ -3,35 +3,34 @@
# this is useful for running plays /from/ an arch machine that will join the wg net. # this is useful for running plays /from/ an arch machine that will join the wg net.
# install wg, generate keys, files on local machine # install wg, generate keys, files on local machine
- hosts: vpn - name: (local) install wg (i use) arch (btw)
remote_user: josiah pacman:
gather_facts: false update_cache: yes
name: wireguard-tools, wireguard-arch, wireguard-dkms
state: present
delegate_to: localhost
become: yes become: yes
# ansible has a hard time parsing the pacman files
# ignore errors once you verify shit is installed / patched.
ignore_errors: True
tasks: - name: (local) ensure /etc/wireguard/ exists
- name: (local) install wg (i use) arch (btw) file:
pacman: path: /etc/wireguard/
update_cache: yes state: directory
name: wireguard-tools, wireguard-arch delegate_to: localhost
state: present
delegate_to: localhost
- name: (local) ensure /etc/wireguard/ exists - name: (local) Generate keys
file: shell: |
path: /etc/wireguard/ printf "[Interface]\nPrivateKey = " > /etc/wireguard/wg0.conf
state: directory wg genkey | tee -a /etc/wireguard/wg0.conf | wg pubkey > /etc/wireguard/publickey
delegate_to: localhost vars:
umask: "077"
- name: (local) Generate keys delegate_to: localhost
shell: | become: yes
printf "[Interface]\nPrivateKey = " > /etc/wireguard/wg0.conf
wg genkey | tee -a /etc/wireguard/wg0.conf | wg pubkey > /etc/wireguard/publickey
vars:
umask: "077"
delegate_to: localhost
- name: (local) register publickey for later use
shell: cat /etc/wireguard/publickey
register: arch_publickey
delegate_to: localhost
- name: (local) register publickey for later use
shell: cat /etc/wireguard/publickey
register: client_publickey
delegate_to: localhost
become: yes

Loading…
Cancel
Save