tasks:
– shell:/usr/bin/foo
register: result
ignore_errors: True
– debug: msg “it failed”
when: result|failed
– debug: msg=”it changed”
when: result|changed
– debug: msg=”it succeeded”
when: result|sucess
– debug: msg=”it was skipped”
when: result|skipped
更多需要参考:http://jinja.pocoo.org/docs/dev/templates/#builtin-filters
其实就是一种函数的调用
:最小值
{{ list1 | min }}
:最大值
{{ [3, 4, 2] | max }}
:去重复
{{ list1 | unique }}
:合并
{{ list1 | union(list2) }}
…
好吧,参考官网吧,一般能用到的官网搜一下,什么match,ip神马的
http://docs.ansible.com/playbooks_filters.html#id13
欢迎转载,转载请注明出处:http://www.503error.com/
Latest posts by Zhiming Zhang (see all)
- aws eks node 自动化扩展工具 Karpenter - 8月 10, 2022
- ReplicationController and ReplicaSet in Kubernetes - 12月 20, 2021
- public key fingerprint - 5月 27, 2021