-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* netplan: add tasks for managing netplan * netplan: add handlers for managing netplan * netplan: add default variables * netplan: add template * netplan: proper var name, more conditions, linting * netplan: rename netplan template file * netplan: simplify logic * netplan: update docs * netplan: molecule tests * netplan: avoid syncconf check if using netplan * netplan: implement changes from commit fa7b0db * netplan: final changes
- Loading branch information
Showing
10 changed files
with
337 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
# Copyright (C) 2020-2023 Robert Wimmer | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
- name: Setup WireGuard | ||
hosts: all | ||
remote_user: vagrant | ||
become: true | ||
gather_facts: true | ||
tasks: | ||
- name: Include WireGuard role | ||
ansible.builtin.include_role: | ||
name: githubixx.ansible_role_wireguard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
# Copyright (C) 2020-2023 Robert Wimmer | ||
# Copyright (C) 2020 Pierre Ozoux | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
dependency: | ||
name: galaxy | ||
|
||
driver: | ||
name: vagrant | ||
provider: | ||
name: libvirt | ||
type: libvirt | ||
|
||
platforms: | ||
- name: test-wg-ubuntu2004 | ||
box: alvistack/ubuntu-20.04 | ||
memory: 1536 | ||
cpus: 2 | ||
interfaces: | ||
- auto_config: true | ||
network_name: private_network | ||
type: static | ||
ip: 172.16.10.10 | ||
groups: | ||
- vpn | ||
- ubuntu | ||
- name: test-wg-ubuntu2204 | ||
box: alvistack/ubuntu-22.04 | ||
memory: 1536 | ||
cpus: 2 | ||
interfaces: | ||
- auto_config: true | ||
network_name: private_network | ||
type: static | ||
ip: 172.16.10.20 | ||
groups: | ||
- vpn | ||
- ubuntu | ||
- name: test-wg-ubuntu2404 | ||
box: alvistack/ubuntu-24.04 | ||
memory: 1536 | ||
cpus: 2 | ||
interfaces: | ||
- auto_config: true | ||
network_name: private_network | ||
type: static | ||
ip: 172.16.10.30 | ||
groups: | ||
- vpn | ||
- ubuntu | ||
|
||
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: "172.16.10.10" | ||
test-wg-ubuntu2204: | ||
wireguard_address: "10.10.10.20/24" | ||
wireguard_port: 51820 | ||
wireguard_persistent_keepalive: "30" | ||
wireguard_endpoint: "172.16.10.20" | ||
wireguard_conf_backup: true | ||
test-wg-ubuntu2404: | ||
wireguard_address: "10.10.10.30/24" | ||
wireguard_port: 51820 | ||
wireguard_persistent_keepalive: "30" | ||
wireguard_endpoint: "172.16.10.30" | ||
wireguard_ubuntu_use_netplan: true | ||
wireguard_conf_filename: "70-wg0.yaml" | ||
wireguard_interface_restart: true | ||
|
||
scenario: | ||
name: netplan | ||
test_sequence: | ||
- prepare | ||
- converge | ||
|
||
verifier: | ||
name: ansible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
# Copyright (C) 2024 Robert Wimmer | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
- name: Prepare Ubuntu hosts | ||
hosts: ubuntu | ||
remote_user: vagrant | ||
become: true | ||
gather_facts: true | ||
tasks: | ||
- name: Update APT package cache | ||
ansible.builtin.apt: | ||
update_cache: true | ||
cache_valid_time: 3600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
# Copyright (C) 2023 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.