76 lines
3.7 KiB
YAML
76 lines
3.7 KiB
YAML
---
|
|
- hosts: localhost
|
|
gather_facts: no
|
|
|
|
vars:
|
|
# var_undefined
|
|
var_zahl: 23
|
|
var_string: "Hallo Teilnehmer!"
|
|
var_liste_leer: []
|
|
var_liste: [Hund, Katze, Maus]
|
|
var_liste_mapping:
|
|
- firstname: Sven
|
|
- firstname: Berta
|
|
- firstname: Klara
|
|
- firstname: "X Æ A-12"
|
|
- firstname: Axel
|
|
var_bool_true: True
|
|
var_bool_false: False
|
|
|
|
tasks:
|
|
- name: 'default-Filter'
|
|
debug:
|
|
msg:
|
|
- "var_undefined|default(42) → {{ var_undefined|default(42) }}"
|
|
- "var_zahl|default(42) → {{ var_zahl|default(42) }}"
|
|
- "var_liste_leer|default(42) → {{ var_liste_leer|default(42) }}"
|
|
- "var_liste_leer|default(42, true) → {{ var_liste_leer|default(42, true) }}"
|
|
|
|
- name: 'String-Filter'
|
|
debug:
|
|
msg:
|
|
- "var_string|lower → {{ var_string|lower }}"
|
|
- "var_string|upper → {{ var_string|upper }}"
|
|
- "var_string|capitalize → {{ var_string|capitalize }}"
|
|
|
|
- name: 'ternary-Filter'
|
|
debug:
|
|
msg:
|
|
- "var_bool_true|ternary('Ja','Nein') → {{ var_bool_true|ternary('Ja','Nein') }}"
|
|
- "var_bool_false|ternary('Ja','Nein') → {{ var_bool_false|ternary('Ja','Nein') }}"
|
|
- "var_string|ternary('Ja','Nein') → {{ var_string|ternary('Ja','Nein') }}"
|
|
|
|
- name: 'list-Filter'
|
|
debug:
|
|
msg:
|
|
- "var_liste|join(', ') → {{ var_liste|join(', ') }}"
|
|
- "var_liste_mapping|join(' sowie ', attribute='firstname') → {{ var_liste_mapping|join(' sowie ', attribute='firstname') }}"
|
|
|
|
- name: 'Datei-Filter'
|
|
debug:
|
|
msg:
|
|
- "'/usr/local/bin/ansible'|basename → {{ '/usr/local/bin/ansible'|basename }}"
|
|
- "'/usr/local/bin/ansible'|dirname → {{ '/usr/local/bin/ansible'|dirname }}"
|
|
- "'/usr/local/bin'|dirname → {{ '/usr/local/bin'|dirname }}"
|
|
- "'/usr/local/bin/.'|dirname → {{ '/usr/local/bin/.'|dirname }}"
|
|
|
|
- name: 'ipaddr-Filter'
|
|
debug:
|
|
msg:
|
|
- "'192.168.128.42/28'|ansible.utils.ipaddr → {{ '192.168.128.42/28'|ansible.utils.ipaddr }}"
|
|
- "'192.168.128.42/28'|ansible.utils.ipv4 → {{ '192.168.128.42/28'|ansible.utils.ipv4 }}"
|
|
- "'192.168.128.42/28'|ansible.utils.ipv6 → {{ '192.168.128.42/28'|ansible.utils.ipv6 }}"
|
|
- "'192.168.128.42/28'|ansible.utils.ipaddr('address') → {{ '192.168.128.42/28'|ansible.utils.ipaddr('address') }}"
|
|
- "'192.168.128.42/28'|ansible.utils.ipaddr('network') → {{ '192.168.128.42/28'|ansible.utils.ipaddr('network') }}"
|
|
- "'192.168.128.42/28'|ansible.utils.ipaddr('size') → {{ '192.168.128.42/28'|ansible.utils.ipaddr('size') }}"
|
|
- "'192.168.128.42/28'|ansible.utils.ipaddr('broadcast') → {{ '192.168.128.42/28'|ansible.utils.ipaddr('broadcast') }}"
|
|
- "'192.168.128.42/28'|ansible.utils.ipaddr('network/prefix') → {{ '192.168.128.42/28'|ansible.utils.ipaddr('network/prefix') }}"
|
|
|
|
- name: 'ipaddr-Filter für eine Range'
|
|
debug:
|
|
msg:
|
|
- "'192.168.128.42/28'|ansible.utils.ipaddr('network/prefix')|ansible.utils.ipaddr(2) → {{ '192.168.128.42/28'|ansible.utils.ipaddr('network/prefix')|ansible.utils.ipaddr(2) }}"
|
|
- "'192.168.128.42/28'|ansible.utils.ipaddr('network/prefix')|ansible.utils.nthhost(-3) → {{ '192.168.128.42/28'|ansible.utils.ipaddr('network/prefix')|ansible.utils.nthhost(-3) }}"
|
|
- "'192.168.128.42/28'|ansible.utils.ipaddr('last_usable') → {{ '192.168.128.42/28'|ansible.utils.ipaddr('last_usable') }}"
|
|
|