ansible-role-wireguard icon indicating copy to clipboard operation
ansible-role-wireguard copied to clipboard

Implementation of pre shared keys per peer

Open daanh432 opened this issue 2 years ago • 3 comments

With a quick search a found this PR #58 that was having a static preshared key for all peers. Preferably your peers all have unique preshared keys, so this is what is implemented in this pull request.

This is a draft implementation of preshared keys per peer.

Newly added peers / hosts in your inventory will automatically be set up with Preshared Keys. Existing peers won't be updated.

I would love to write some automated tests for this. I'm not quite familiar with molecule just yet. So that's a work in progress.

daanh432 avatar Jan 31 '23 13:01 daanh432

@daanh432 Are you still working on this? Otherwise I think it'd make sense to close it for now.

githubixx avatar Jun 13 '23 19:06 githubixx

I have been running the pre shared keys patch for a while now but sadly I did not have the time yet to look into Molecule and writing automated tests. The earliest moment I might have some spare time to look into it would be in July.

daanh432 avatar Jun 17 '23 18:06 daanh432

Thanks for working on this! This is one of the blockers preventing me from using this role.

In a test setup with preexisting config, when I run the role (with only a few of the endpoints defined), I get the following error:

fatal: [vanir]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: list object has no element 5. list object has no element 5\n\nThe error appears to be in '/home/unit193/.ansible/roles/githubixx.ansible_role_wireguard/tasks/main.yml': line 175, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Set pre shared key fact\n ^ here\n"}

So it would seem having hosts in the target system's config with PSKs that are not yet in ansible config causes this to bail?

Unit193 avatar Jul 15 '23 06:07 Unit193