From 51cbca51b55918c9b498954f59b678256eaaa04a Mon Sep 17 00:00:00 2001 From: Robert Wimmer <2039811+githubixx@users.noreply.github.com> Date: Mon, 28 Sep 2020 23:47:01 +0200 Subject: [PATCH] added initial molecule infrastructure (#83) * add .gitignore file * add molecule --- .gitignore | 1 + molecule/kvm/converge.yml | 18 +++++ molecule/kvm/molecule.yml | 157 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+) create mode 100644 .gitignore create mode 100644 molecule/kvm/converge.yml create mode 100644 molecule/kvm/molecule.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8098291 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +molecule/kvm/.vagrant diff --git a/molecule/kvm/converge.yml b/molecule/kvm/converge.yml new file mode 100644 index 0000000..9aad225 --- /dev/null +++ b/molecule/kvm/converge.yml @@ -0,0 +1,18 @@ +--- +- hosts: all + remote_user: vagrant + become: true + gather_facts: true + tasks: + - name: Init pacman + raw: | + pacman-key --init + pacman-key --populate archlinux + changed_when: false + ignore_errors: true + when: ansible_distribution|lower == 'archlinux' + + - name: Include WireGuard role + include_role: + name: githubixx.ansible_role_wireguard + diff --git a/molecule/kvm/molecule.yml b/molecule/kvm/molecule.yml new file mode 100644 index 0000000..80c3162 --- /dev/null +++ b/molecule/kvm/molecule.yml @@ -0,0 +1,157 @@ +--- +dependency: + name: galaxy + +driver: + name: vagrant + provider: + name: libvirt + type: libvirt + options: + memory: 192 + cpus: 2 + +platforms: + - name: test-wg-ubuntu2004 + box: generic/ubuntu2004 + interfaces: + - auto_config: true + network_name: private_network + type: static + ip: 192.168.10.10 + groups: + - vpn + - name: test-wg-ubuntu1804 + box: generic/ubuntu1804 + interfaces: + - auto_config: true + network_name: private_network + type: static + ip: 192.168.10.20 + groups: + - vpn + - name: test-wg-debian10 + box: generic/debian10 + interfaces: + - auto_config: true + network_name: private_network + type: static + ip: 192.168.10.30 + groups: + - vpn + - name: test-wg-fedora31 + box: generic/fedora31 + interfaces: + - auto_config: true + network_name: private_network + type: static + ip: 192.168.10.40 + groups: + - vpn + - name: test-wg-fedora32 + box: generic/fedora32 + interfaces: + - auto_config: true + network_name: private_network + type: static + ip: 192.168.10.50 + groups: + - vpn + - name: test-wg-centos8 + box: generic/centos8 + interfaces: + - auto_config: true + network_name: private_network + type: static + ip: 192.168.10.60 + groups: + - vpn + - name: test-wg-centos7 + box: generic/centos7 + interfaces: + - auto_config: true + network_name: private_network + type: static + ip: 192.168.10.70 + groups: + - vpn + - name: test-wg-arch + box: archlinux/archlinux + interfaces: + - auto_config: true + network_name: private_network + type: static + ip: 192.168.10.80 + groups: + - vpn + +provisioner: + name: ansible + connection_options: + ansible_ssh_user: vagrant + ansible_become: true + log: true + lint: + name: ansible-lint + inventory: + host_vars: + test-wg-ubuntu2004: + wireguard_address: "10.10.10.10/24" + wireguard_port: 51820 + wireguard_persistent_keepalive: "30" + wireguard_endpoint: "192.168.10.10" + test-wg-ubuntu1804: + wireguard_address: "10.10.10.20/24" + wireguard_port: 51820 + wireguard_persistent_keepalive: "30" + wireguard_endpoint: "192.168.10.20" + test-wg-debian10: + wireguard_address: "10.10.10.30/24" + wireguard_port: 51820 + wireguard_persistent_keepalive: "30" + wireguard_endpoint: "192.168.10.30" + ansible_python_interpreter: "/usr/bin/python" + test-wg-fedora31: + wireguard_address: "10.10.10.40/24" + wireguard_port: 51820 + wireguard_persistent_keepalive: "30" + wireguard_endpoint: "192.168.10.40" + test-wg-fedora32: + wireguard_address: "10.10.10.50/24" + wireguard_port: 51820 + wireguard_persistent_keepalive: "30" + wireguard_endpoint: "192.168.50.40" + test-wg-centos8: + wireguard_address: "10.10.10.60/24" + wireguard_port: 51820 + wireguard_persistent_keepalive: "30" + wireguard_endpoint: "192.168.10.60" + test-wg-centos7: + wireguard_address: "10.10.10.70/24" + wireguard_port: 51820 + wireguard_persistent_keepalive: "30" + wireguard_endpoint: "192.168.10.70" + test-wg-arch: + wireguard_address: "10.10.10.80/24" + wireguard_port: 51820 + wireguard_persistent_keepalive: "30" + wireguard_endpoint: "192.168.10.80" + ansible_python_interpreter: "/usr/bin/python" + +scenario: + name: kvm + test_sequence: + - prepare + - converge + +verifier: + name: testinfra + directory: tests + options: + # Add a -v so you see the individual test names, + # particularly useful with parameterized tests + v: true + sudo: true + lint: + name: flake8 +