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

Added ability to optionally configure NAT source address #168

Merged
merged 6 commits into from
Dec 22, 2024

Conversation

coofercat
Copy link
Contributor

A very simple change to optionally be able to configure in the NAT source address. This becomes important if your server has multiple network devices and the network(s) you want them to be able to access aren't on the default interface.

In my case, my openvpn server has a public address on the default interface (ens3) and a private network on the secondary (ens4). Since I want to provide access to the private network, I need to be able to NAT to the address on the ens4 interface. This can be configured in easily, perhaps in a group_vars/vpn_servers.yml:

openvpn_lan_source_ip: "{{ ansible_ens4.ipv4.address }}"

Please note: the default behaviour is the original one (ie. use the ansible_default_ipv4 address).

Copy link
Owner

@kyl191 kyl191 left a comment

Choose a reason for hiding this comment

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

Yes, but could you add openvpn_lan_source_ip to defaults/main/openvpn.yml instead, with the default of ansible_default_ipv4.address?

Avoids putting magic in the task itself :)

@coofercat
Copy link
Contributor Author

Very good point - and better style than my (rather hurried) change. Updated as requested.

@kyl191 kyl191 merged commit 10bf046 into kyl191:master Dec 22, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants