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

Use ansible_port if defined. If not, fallback to port 22 #22

Closed
nununo opened this issue Jul 20, 2020 · 2 comments
Closed

Use ansible_port if defined. If not, fallback to port 22 #22

nununo opened this issue Jul 20, 2020 · 2 comments

Comments

@nununo
Copy link

nununo commented Jul 20, 2020

Hello,

Currently port 22 is hard coded:

ufw_rules: [{ port: 22, rule: allow }]

Whenever the host port is not 22... this variable must be redefined.
I suggest making it more flexible by changing the rule to:

ufw_rules: [{ port: '{% if ansible_port is defined %}{{ ansible_port }}{% else %}22{% endif %}', rule: allow }]

I'm not sure the jinja2 syntax is correct but the idea is there.

If this is considered a good idea I can implement it a issue a PR.

Thanks!

@franklinkim
Copy link
Member

Hi,

thanks for the note!
The role actually expects you to override/define your own ufw_rules.
I kinda just added this one in case you forget to set it and lock yourself out.

Maybe I just should remove it and disable ufw if it's empty...

@nununo
Copy link
Author

nununo commented Jul 21, 2020

Ah, understood. Makes sense. That's a good option. Closing this then. Thanks!

@nununo nununo closed this as completed Jul 21, 2020
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

No branches or pull requests

2 participants