Convert arch standalones to proper subtask syntax.

This commit is contained in:
jowj 2020-01-02 18:16:10 -06:00
parent 482e74378b
commit 4afe109ef0
2 changed files with 46 additions and 50 deletions

View File

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

View File

@ -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
- name: (local) ensure /etc/wireguard/ exists
file:
path: /etc/wireguard/
state: directory
delegate_to: localhost
tasks: - name: (local) Generate keys
- name: (local) install wg (i use) arch (btw) shell: |
pacman: printf "[Interface]\nPrivateKey = " > /etc/wireguard/wg0.conf
update_cache: yes wg genkey | tee -a /etc/wireguard/wg0.conf | wg pubkey > /etc/wireguard/publickey
name: wireguard-tools, wireguard-arch vars:
state: present umask: "077"
delegate_to: localhost delegate_to: localhost
become: yes
- name: (local) ensure /etc/wireguard/ exists
file: - name: (local) register publickey for later use
path: /etc/wireguard/ shell: cat /etc/wireguard/publickey
state: directory register: client_publickey
delegate_to: localhost delegate_to: localhost
become: yes
- name: (local) Generate keys
shell: |
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