Skip to content

Feature: miltiple wireguard profiles#45

Open
vix-4800 wants to merge 4 commits into
mainfrom
feature/miltiple-wireguard-profiles
Open

Feature: miltiple wireguard profiles#45
vix-4800 wants to merge 4 commits into
mainfrom
feature/miltiple-wireguard-profiles

Conversation

@vix-4800

@vix-4800 vix-4800 commented Jun 8, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the network Ansible role’s WireGuard support from a single fixed wg0 configuration to a list of named WireGuard profiles, enabling deployment/import of multiple WireGuard configs and NetworkManager connections from vault data.

Changes:

  • Replaced single WireGuard vault variables with vault_wg_profiles (list of profile objects), while keeping a legacy fallback path.
  • Updated the WireGuard Jinja2 template to render from a selected network_wireguard_profile (supporting string-or-list forms for address/DNS/AllowedIPs).
  • Refactored WireGuard tasks to loop over profiles and configure each one via a dedicated wireguard-profile.yml include.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vault/secrets.yml.example Updates the secrets example to a multi-profile vault_wg_profiles structure.
roles/network/templates/wg0.conf.j2 Renders a WireGuard config from a per-profile object (address/DNS/AllowedIPs normalization).
roles/network/tasks/wireguard.yml Normalizes profiles, validates uniqueness, and loops per profile to configure/import.
roles/network/tasks/wireguard-profile.yml New per-profile tasks to template the config and import it into NetworkManager.
README.md Updates documentation to describe profile-based WireGuard secrets and deployed config paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread vault/secrets.yml.example
Comment on lines +6 to +29
vault_wg_profiles:
- name: wg0
private_key: "CHANGEME"
address:
- "10.0.0.2/32"
- "fd00::2/128"
dns:
- "1.1.1.1"
- "2606:4700:4700::1111"
peer_public_key: "CHANGEME"
preshared_key: "CHANGEME"
persistent_keepalive: 25
endpoint: "vpn-1.example.com:51820"
allowed_ips:
- "0.0.0.0/0"
- "::/0"
- name: wg1
private_key: "CHANGEME"
address: "10.10.0.2/32"
dns: "9.9.9.9"
peer_public_key: "CHANGEME"
preshared_key: ""
persistent_keepalive: 0
endpoint: "vpn-2.example.com:51820"
Comment on lines +23 to +29
'private_key': vault_wg_private_key,
'address': vault_wg_address,
'dns': vault_wg_dns,
'peer_public_key': vault_wg_peer_public_key,
'preshared_key': vault_wg_preshared_key | default(''),
'persistent_keepalive': vault_wg_persistent_keepalive,
'endpoint': vault_wg_endpoint
Comment on lines +53 to +59
- name: Assert WireGuard profile names are unique
ansible.builtin.assert:
that:
- network_wireguard_named_profile_count == network_wireguard_profile_count
- network_wireguard_unique_profile_count == network_wireguard_profile_count
fail_msg: Each WireGuard profile must define a unique name.
changed_when: false
@vix-4800 vix-4800 closed this Jun 26, 2026
@vix-4800 vix-4800 deleted the feature/miltiple-wireguard-profiles branch June 26, 2026 15:54
@vix-4800 vix-4800 restored the feature/miltiple-wireguard-profiles branch June 26, 2026 15:54
@vix-4800 vix-4800 reopened this Jun 26, 2026
@vix-4800 vix-4800 closed this Jun 26, 2026
@vix-4800 vix-4800 reopened this Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants