---
- hosts: all
gather_facts: False
vars:
list: [1,2,3,4,5]
one: "1"
str1: "string"
tasks:
- name: print str
debug:
msg: echo {{str1}}
- name: run commands
shell: df -h
register: info
- name: pprintf info
debug: msg="{{info.stdout|pprint}}"
- name: info
debug: msg="{{info}}"
- name: debug conditionals filter
debug: msg="the run commands statue is changed"
when: info is changed
- name: debug int caplitalize filter
debug: msg="the int value {{one|int}} the lower value is {{str1|capitalize}}"
- name: debug default filter
debug: msg="the variable value is {{ansible|default('ansible is not define')}}"
- name: debug list max and min filter
debug: msg="the list max value is {{list|max}} and list min value is {{list|min}}"
- name: debug random filter
debug: msg="the list random value is {{list|random}} {{1000|random(1,10)}}"
- name: debug replayce
debug: msg="the replace value is {{str1|replace('string','STRING')}}"
- name: debug regex_replace
debug: msg="the regex_replace value is {{str1|regex_replace('.*tr(.*)$','666')}}"