Summary:
I have nested dict like in example and i want to loop over it. For every "item" i want to have nested keys and value f.e.
Input
python:
lint:
where: 'here'
Output:
python.lint.where: 'here'
Why i need it:
I'm creating role for managing visual studio code via ansible. I want to install it, create settings.json (this questions is for this case), install/remove plugins. Configuration should be created from variables like: list of extensions, dictionary of settings, repo path etc. With this role i can create one file configuration for my developing environment which can i set via 'one-click'.
Have dict configuration.yml:
## vscode config
code_config:
python:
pythonPath: '/usr/bin/python'
linting:
enabled: "true"
pep8Enabled: "true"
ignorePath:
- '.code'
- '.vscode'
And sample playbook
- hosts: localhost
vars_files: 'configuration.yml'
tasks:
- name: Hello
template:
src: file.j2
dest: /etc/file.conf
file.j2
{
{% for key,value in code_config %}
{{ key }}: {{ value }},
{% endfor %}
}
Want to have output like:
{
python.pythonPath: '/usr/bin/python',
python.linting.enabled: 'true',
python.linting.pep8Enabled: 'true',
}