Ansible Filters: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=External= * https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html =Internal= * Ansible Concepts =Overview= Ansible file conten...")
 
No edit summary
 
(36 intermediate revisions by the same user not shown)
Line 4: Line 4:
* [[Ansible_Concepts#Filter|Ansible Concepts]]
* [[Ansible_Concepts#Filter|Ansible Concepts]]
=Overview=
=Overview=
Ansible file content can be manipulated with filters.  
Ansible file content can be manipulated with '''filters'''.


<font color=darkgray>TODO: https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#manipulating-strings</font>
=Ansible Filters=
{| class="wikitable" style="text-align: left;"
! Category
! style="text-align:center;" | Filters
|-
| [[Ansible_Concepts#Variables|Variable]]-related filters ||
<span id='default'></span>[[Ansible Filter default|default]]<br>
<span id='mandatory'></span>[[Ansible Filter mandatory|mandatory]]<br>
|-
| [[Ansible_Concepts#Data_Types|Data type management]] filters ||
<span id='type_debug'></span>[[Ansible Filter type_debug|type_debug]]<br>
<span id='dict2items'></span>[[Ansible Filter dict2items|dict2items]]<br>
<span id='items2dict'></span>[[Ansible Filter items2dict|items2dict]]<br>
<span id='casting'></span>[[Ansible Filter Casting|Casting]]
|-
| YAML and JSON Formatting ||
<span id='json_query'></span>[[Ansible Filter json_query|json_query]]<br>
<span id='to_json'></span>[[Ansible Filter to_json|to_json]]<br>
<span id='to_nice_json'></span>[[Ansible Filter to_nice_json|to_nice_json]]<br>
<span id='to_yaml'></span>[[Ansible Filter to_yaml|to_yaml]]<br>
<span id='to_nice_yaml'></span>[[Ansible Filter to_nice_yaml|to_nice_yaml]]<br>
|-
| Regular Expressions ||
<span id='regex_replace'></span>[[Ansible Filter regex_replace|regex_replace]]<br>
<span id='regex_findall'></span>[[Ansible Filter regex_findall|regex_findall]]<br>
<span id='regex_search'></span>[[Ansible Filter to_regex_search|regex_search]]<br>
|-
| Miscellaneous ||
<span id='select'></span>[[Ansible Filter select|select]]<br>
<span id='ternary'></span>[[Ansible Filter ternary|ternary]]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
|-
| Jinja Filters ||
<span id='select'></span>[[Jinja2#upperr|upper]]<br>
<span id='select'></span>[[Jinja2#lower|lower]]<br>
|-
|}

Latest revision as of 21:29, 23 August 2023

External

Internal

Overview

Ansible file content can be manipulated with filters.

Ansible Filters

Category Filters
Variable-related filters

default
mandatory

Data type management filters

type_debug
dict2items
items2dict
Casting

YAML and JSON Formatting

json_query
to_json
to_nice_json
to_yaml
to_nice_yaml

Regular Expressions

regex_replace
regex_findall
regex_search

Miscellaneous

select
ternary
                                                

Jinja Filters

upper
lower