Change restart handling / add very basic unit test (#156)
* move register if config/private key handling out of wg subcommands block * allow user to specify WireGuard interface restart behavior * update README * numeric values in meta/main.yml should be strings * update Copyright * fix indentation in tasks/setup-debian.yml * update Copyright * update Copyright * truthy values should be lowercase * add namespace key again to meta/main.yml * add molecule/kvm/verify.yml with a very basic unit testmaster
parent
434fe955ca
commit
4e5adac691
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2018-2020 Robert Wimmer
|
# Copyright (C) 2018-2022 Robert Wimmer
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
molecule/kvm/.vagrant
|
molecule/kvm/.vagrant
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
# Copyright (C) 2022 Robert Wimmer
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
- name: Verify setup
|
||||||
|
hosts: all
|
||||||
|
vars:
|
||||||
|
hosts_count: "{{ groups['vpn'] | length }}"
|
||||||
|
tasks:
|
||||||
|
- name: Count WireGuard interfaces
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
set -o errexit
|
||||||
|
set -o pipefail
|
||||||
|
set -o nounset
|
||||||
|
wg | grep "peer: " | wc -l
|
||||||
|
exit 0
|
||||||
|
args:
|
||||||
|
executable: "/bin/bash"
|
||||||
|
register: wireguard__interfaces_count
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Print WireGuard interface count
|
||||||
|
ansible.builtin.debug:
|
||||||
|
var: wireguard__interfaces_count.stdout
|
||||||
|
|
||||||
|
- name: Print hosts count in vpn group
|
||||||
|
ansible.builtin.debug:
|
||||||
|
var: hosts_count
|
||||||
|
|
||||||
|
- name: There should be as much WireGuard interfaces as hosts in vpn group minus one
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- "hosts_count|int -1 == wireguard__interfaces_count.stdout|int"
|
Loading…
Reference in New Issue