githubixx/ansible-role-wireguard

No peers when limiting hosts

sebix opened this issue · 2 comments

sebix commented

No peers are being added to the configuration file if ansible-playbook is used with --limit to only run the script only on a part of the network.
The reason is the usage for ansible_play_hosts:

{% for host in ansible_play_hosts %}

ansible_play_hosts gets limited when using the --limit parameter.

Is there a way to get a correct configuration file when limiting the destination hosts?

I know that ansible_play_hosts is a problem. That happens when you accept a PR and don't oversee the consequences 😉 That's something that should be changed or at least another possibility added that could get around this. But currently I belief that's it not that easy. If you only change a limited set of hosts you most probably still need the facts from the other hosts. I've something in mind but I don't know when I'll have time. But pull requests are welcome of course 😉

This is already covered in #79. So I'll close this one.