Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
MemberIT committed Dec 25, 2018
1 parent 09683a0 commit dc35877
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
8 changes: 4 additions & 4 deletions tasks/configure_network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
stat:
path: "/etc/wireguard/privatekey_{{ item }}"
register: privatekey_{{ item }}
when: wireguard_manage_services
when: wireguard_manage_keys

- name: Generate wireguard keys {{ item }}
shell: "umask 077; wg genkey | tee /etc/wireguard/privatekey_{{ item }} | wg pubkey > /etc/wireguard/publickey_{{ item }}"
when:
- not privatekey_{{ item }}.stat.exists
- wireguard_manage_services
- wireguard_manage_keys

- name: Read private key {{ item }}
slurp:
src: "/etc/wireguard/privatekey_{{ item }}"
register: private_{{ item }}
when: wireguard_manage_services
when: wireguard_manage_keys

- name: Read public key {{ item }}
slurp:
src: "/etc/wireguard/publickey_{{ item }}"
register: public_{{ item }}
when: wireguard_manage_services
when: wireguard_manage_keys

- name: Configure {{ item }}
template:
Expand Down
48 changes: 26 additions & 22 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,34 @@
- wg0
- wg1

wireguard_wg0_interface:
address: 10.0.0.1/24
private_key: 12345
listen_port: 12345
wireguard_interface:
wg0:
address: 10.0.0.1/24
private_key: 12345
listen_port: 12345

wireguard_wg0_peers:
peer-0-0:
public_key: 0-12345-pub
allowed_ips: 10.0.0.10/24
peer-0-1:
public_key: 0-23456-pub
allowed_ips: 10.0.0.11/24
wireguard_peers:
wg0:
peer-0-0:
public_key: 0-12345-pub
allowed_ips: 10.0.0.10/24
peer-0-1:
public_key: 0-23456-pub
allowed_ips: 10.0.0.11/24

wireguard_wg1_interface:
address: 10.0.1.1/24
private_key: 23456
listen_port: 23456
wireguard_interface:
wg1:
address: 10.0.1.1/24
private_key: 23456
listen_port: 23456

wireguard_wg1_peers:
peer-1-0:
public_key: 1-12345-pub
allowed_ips: 10.0.1.10/24
peer-1-1:
public_key: 1-23456-pub
allowed_ips: 10.0.1.11/24
wireguard_peers:
wg1:
peer-1-0:
public_key: 1-12345-pub
allowed_ips: 10.0.1.10/24
peer-1-1:
public_key: 1-23456-pub
allowed_ips: 10.0.1.11/24
roles:
- role_under_test

0 comments on commit dc35877

Please sign in to comment.