Hi,During a recent code review of an ansible playbook, I noticed one dev using variables defined in playbook group_vars/all.yml as constants. This is inline with general coding guideline of replacing magic numbers/literals with constants as per the Clean Code book(https://moderatemisbehaviour.github.io/clean-code-smells-and-heuristics/general/g25-replace-magic-numbers-with-named-constants.html). The only problem I see with this approach is that technically the variables defined in group_vars/all.yml are overridable as per the variable precedence which is against the general coding guideline of using a constant.I wanted to check with the community if ansible provides a way of defining constants.
From preliminary google search, posts on stackoverflow and searching ansible docs suggest that ansible doesn't have the feature of constants.In that case, is there some general convention in ansible similar to python where constants are defined in upper case with words separated by underscores? The ansible tips and tricks doesn't seem to talk about this.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/70d3c2b4-d3be-443d-9ff4-f2c3ea35948dn%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7fB-THNzQCz7ufgoqp-wWJ33Lu4tXmZieY8%3DYXNHj_ANQ%40mail.gmail.com.