-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
SECRET_KEY - autogeneration broken #66
Comments
I did some debugging and the secret key is properly generated and slurped, but |
Looks like there's an upstream Ansible issue opened about this, and it seems to be a stale/forgotten issue: ansible/ansible#32713 After some testing it looks like the |
Looks like there's an upstream Ansible issue opened about this, and it
seems to be a stale/forgotten issue: ansible/ansible#32713
<ansible/ansible#32713>
After some testing it looks like the |netbox_config| variable on the
|include_role| task takes precedence over facts. If I remove it from
the |include_role| task/move it to the playbook vars, the role
completes fine. It also works fine if I use an |import_role| task and
keep the |netbox_config| var on the task like you have. I think this
might be intended behaviour for Ansible (|set_fact| documentation also
states: "Per the standard Ansible variable precedence rules, many
other types of variables have a higher priority, so this value may be
overridden."), so I'm closing this as wontfix.
Thanks so much Musee for swift reaction. Intriguing and non-intuitive
behavior by ansible if you asked me.
…--
BR
Matthias Tafelmeier
|
As more people are starting to use the Would you be open to an implementation that did the same for What do you think @lae ? |
I had a go at fixing this so that the way of using the role that @cherusk posted here also works. Not many changes are needed, so I think I'll open a PR soon and discuss this there. |
This works around the problem in lae#66 that if you use the (increasingly more common) include_role pattern variables you set externally could appear immutable to the role logic. Thus, using set_fact with a combine() to add SECRET_KEY to netbox_config will not work as expected. Introducing a new 'private' (and thus mutable) variable in load_variables works around the problem and allows the include_role pattern to work.
Use 'private' variable for netbox_config (#66)
From reading the source, intended behaviour is, if SECRET_KEY is not in netbox_config parameter, it will be generated. But
Is ailing with:
Fancied the feature, but have no time to cure myself. Should be light one though.
The text was updated successfully, but these errors were encountered: