Which filters do you use every day?
BeginnerConceptJinja2, Conditionals and Loops
Answer
"{{ x | default('fallback') }}"
"{{ names | join(',') }}"
"{{ name | upper }} {{ name | lower }} {{ s | trim }}"
"{{ list | length }}"
"{{ data | to_json }}" "{{ data | to_nice_yaml }}"
"{{ path | basename }} {{ path | dirname }}"
"{{ pw | password_hash('sha512') }}"
"{{ value | int }} {{ flag | bool }}"
"{{ secret | b64encode }}"
Run ansible-doc -t filter -l to list them. Anything not built in is available in collections such as ansible.utils and community.general.
More on Jinja2, Conditionals and Loops
What role does Jinja2 play in Ansible?BeginnerWhat are the three Jinja2 delimiters?BeginnerShow a template with a loop and a conditional, and how it is deployed.BeginnerHow do you transform lists and dicts with filters (`map`, `select`, `selectattr`, `unique`, `flatten`)?IntermediateHow does `when` work and which operators can you use?BeginnerHow do you combine several conditions?Beginner