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

add by host custom allowed ips

Open vincentDcmps opened this issue 2 years ago • 4 comments

hello I have apply change to customize allowed_ips in function of host.

vincentDcmps avatar Sep 13 '22 16:09 vincentDcmps

Hello! I'm not so sure for what this change might be needed TBH :wink: You can set wireguard_allowed_ips per host already and if you want host routes you can assign a value of 10.0.0.2/32,192.168.1.41/32 e.g.

githubixx avatar Sep 27 '22 20:09 githubixx

in my case I have three device with a central device

with my modification by example on gerard and oscar:

wireguard_byhost_allowed_ips:
  merlin: 10.0.0.6,192.168.1.41
flowchart LR
  A[oscar] <--> B[merlin]
  C[gerard] <--> B 
  

so I don't want that a and communicate directly by wireguard themself because they are on same lan

if I set wireguard_allowed_ips like you say I will have more something like that

flowchart LR
  A[oscar] <--> B[merlin]
  C[gerard] <--> B 
  A <--> C

vincentDcmps avatar Oct 09 '22 08:10 vincentDcmps

I somehow still don't get this PR :wink: Personally it seems wrong to me to have a "global" variable where you define a dictionary where the hostname is the key while you have the Ansible's host repository on the other side. So if you have something specific that only applies to one host why not use host variables? :confused:

I guess this Molecule test comes more or less close to your use case: https://github.com/githubixx/ansible-role-wireguard/tree/master/molecule/kvm-single-server Can you maybe use that one as a template and adjust it accordingly so that it matches your use case? You don't need to execute it as you most probably don't have Vagrant and KVM. But it'd give me an idea.

githubixx avatar Jun 13 '23 20:06 githubixx

@vincentDcmps I'm a little late to the party, but thanks for filing this PR. It's exactly what I needed! :)

Unit193 avatar Apr 02 '24 01:04 Unit193