Skip to content
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

Problem: Unable to assign a Wireguard instance to peer #150

Open
3isenHeiM opened this issue Jan 29, 2025 · 3 comments
Open

Problem: Unable to assign a Wireguard instance to peer #150

3isenHeiM opened this issue Jan 29, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@3isenHeiM
Copy link

Modules

ansibleguy.opnsense.wireguard_peer

Version

ansibleguy.opnsense 1.2.12

Ansible Version

ansible [core 2.14.18]

OPNSense Version

OPNsense 24.7.12_2-amd64

OPNSense-Plugin Version

Issue

The module does not allow to assign the current peer to a Wireguard instance.

There should be an instance parameter of this module to allow to create a peer and associate it to an instance.

Config Ansible

Config OPNSense

Debug Output

Profiling Output

@ansibleguy ansibleguy changed the title Problem: Unabel to assign a Wireguard instance to a Wireguard peer Problem: Unable to assign a Wireguard instance to a Wireguard peer Feb 7, 2025
@ansibleguy
Copy link
Owner

I was not able to reproduce the issue.
The tests seem to work as expected:

Please review the examples and provide the Ansible-Tasks & -Config if the issue still is present.

@ansibleguy ansibleguy added the support Environmental problems and so on label Feb 7, 2025
@ansibleguy ansibleguy changed the title Problem: Unable to assign a Wireguard instance to a Wireguard peer Problem: Unable to assign a Wireguard instance to peer Feb 7, 2025
@3isenHeiM
Copy link
Author

Currently, the process to create a Wireguard peer and server is done like this:

  1. Create the peer
  2. Create the server and assign the peer to it (using the peers field).

However I feel this is not the optimal way to do it...

IMHO, the wireguard sever and peer creation should be done this way:

  1. Create the wireguard Server
  2. Create a wireguard peer and assign it to a server

But currently, there isn't any field in wireguard_peer to associate a peer to an instance, at its creation.

My proposition would be to create a wireguard peer (after the wireguard server creation) with something like this:

    - name: Adding peer
      ansibleguy.opnsense.wireguard_peer:
        name: 'test1'
        endpoint: 'wg.template.ansibleguy.net'
        allowed_ips: ['10.200.0.1/32']
        public_key: 'gTuhGXA28/qRSLPnH3szr2+A4l3C4tKlUsOORV63+SE='
        server: 'test1'

@ansibleguy
Copy link
Owner

ansibleguy commented Feb 15, 2025

You are right.
This should cover that functionality: wireguard_peer tests - linking to servers/instances

Feel free to test the new implementation on the latest version and report back if you find an issue with it: ansible-galaxy collection install git+https://github.com/ansibleguy/collection_opnsense.git

@ansibleguy ansibleguy added enhancement New feature or request and removed support Environmental problems and so on triage labels Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants