insight-infrastructure / nukikata

Fork of cookiecutter with plugins, loops, and conditionals.
BSD 3-Clause "New" or "Revised" License
9 stars 0 forks source link

Special variables #2

Open robcxyz opened 4 years ago

robcxyz commented 4 years ago

In Ansible, you have special variables that can be called with jinja. For instance you have the "{{role_path}}" special variable that allows users build relative paths constructions like "{{role_path}}/path/to/file". This would be very useful to adopt. Relates to being able to manage the context in nested sets of cookiecutters though there are at least two other solutions to this.

Looks like the new cookiecutter 2.0 being drafted includes private variables. Would be good to adopt that convention to persist objects in the context. Special variables could then be overridden in the context based on inputs.

robcxyz commented 4 years ago

Now that _template and _output_dir have been added to the context, this is not as needed as we can change dir now with the chdir option. Still would be nice to have a list of special variables. In ansible, this is mostly needed for host system information. We deal mostly with the context so this is the most important part.

robcxyz commented 4 years ago

Added special variables to context.