-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Netplan support #210
Merged
Merged
Netplan support #210
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0f5590c
netplan: add tasks for managing netplan
kbcz1989 7a4f00b
netplan: add handlers for managing netplan
kbcz1989 6d1d83d
netplan: add default variables
kbcz1989 95c478d
netplan: add template
kbcz1989 5527816
netplan: proper var name, more conditions, linting
kbcz1989 a84886f
netplan: rename netplan template file
kbcz1989 c87beda
netplan: simplify logic
kbcz1989 dd24ad0
netplan: update docs
kbcz1989 1c4d62a
netplan: molecule tests
kbcz1989 592c4fe
netplan: avoid syncconf check if using netplan
kbcz1989 73241b4
netplan: implement changes from commit fa7b0db
kbcz1989 128a41d
Merge branch 'githubixx:master' into netplan-support
kbcz1989 452aa5b
netplan: final changes
kbcz1989 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,89 @@ | ||
--- | ||
# 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" | ||
githubixx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a copy&paste of what's in
defaults/main.yaml
.