ansible-role-wireguard/molecule/kvm-single-server/verify.yml
Robert Wimmer 3821005839
v10.0.0 ()
* remove support for Fedora 35 / add support for Fedora 36

* remove Fedora 34 + add Fedora 36 to Molecule test

* fix Jinja2 spacing

* fix Jinja2 spacing

* improve the task key order to: name, when, tags, block

* handlers/main.yml: names should start with an uppercase letter

* tasks/main.yml: names should start with an uppercase letter

* add .yamllint

* add Github release action to push new release to Ansible Galaxy

* add Molecule setup for openSUSE 15.4

* molecule/kvm-single-server: add verify.yml / enable verifier

* update CHANGELOG
2022-09-27 23:09:14 +02:00

33 lines
916 B
YAML

---
# 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"