Replies: 3 comments 1 reply
-
handful of thoughts: b) What you're asking for sounds a lot like how ansible handles it's concept of templates and data (https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html#examples), where vars are stored in a folder, then the template renders the vars into the specified file c) if you want to do this in copier, you might try storing your source dictionary as default answers in the copier.yaml, then the templates can render out -> although, you may have to do the looping yourself. {% for key, value in answers.env.dev.items() %}
{{key}}={{ value }}
{% endfor %} |
Beta Was this translation helpful? Give feedback.
-
If I'm understanding what you're after, this almost looks like a direct mapping of a dictionary to a directory tree structure with a config file in each destination. I'm not sure how the Copier/Cookiecutter part is supposed to make things easier; it's just adding another layer of indirection. Put the config in your config of choice, YAML, TOML, JSON, and Just iterate through the top level dict, create the directory structure, and squirt out the config file indicated for that key. And, as @mshafer-NI said, this looks very much like Ansible. |
Beta Was this translation helpful? Give feedback.
-
The design for this feature request already landed in #1271, but still nobody had time to implement it. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm trying to find a tool...any tool....to accomplish the following task - which seems fairly normal in my world.
I wish to have a template repo that I can use as a source to create destination with a post-templatised result based on inputs.
Input
Source:
my-src-repo/env/template/config.file
contents:
Destination:
my-src-repo/env/dev/config.file
my-src-repo/env/nonprod/config.file
my-src-repo/env/prod/config.file
I can make cookiecutter and copier make the directories but can't find anyway to then iterate through inputs to match them to the correct variable name.
Beta Was this translation helpful? Give feedback.
All reactions