判断字符串的一些tests

lower:判断包含字母的字符串中的字母是否为纯小写,字符串中的字母全部为小写则返回真

upper:判断包含字母的字符串中的字母是否为纯大写,字符串中的字母全部为大写则返回真。

ansible 判断register ansible判断运算符_ansible 判断register


ansible 判断register ansible判断运算符_字符串_02

判断整除的一些tests

even:判断数值是否为偶数,是偶数则返回真

odd:判断数值是否为奇数,是奇数则返回真

divisibleby:判断是否可以整除指定的数值,如果除以指定的值以后余数为0,则返回真。

ansible 判断register ansible判断运算符_字符串_03


ansible 判断register ansible判断运算符_字符串_04

其他的一些test
version:可以用于对比两个版本号的大小,或者与指定的版本号进行对比,使用语法为version(“版本号”,“比较操作符”)当使用version时,支持多种风格的比较操作符,version支持的比较操作符如下:
大于:>,gt
大于等于:>=,ge
小于:<,lt
小于等于:<=,le
等于:==,=,eq
不等于:!=,<>,ne

ansible 判断register ansible判断运算符_版本号_05


ansible 判断register ansible判断运算符_ansible 判断register_06

subset:判断一个list是不是另一个list的子集,是另一个list的子集时返回真

superset:判断一个list是不是另一个list的父集,是另一个list的父集时返回真

ansible 判断register ansible判断运算符_操作符_07


ansible 判断register ansible判断运算符_版本号_08


ansible 判断register ansible判断运算符_操作符_09


ansible 判断register ansible判断运算符_ansible 判断register_10


ansible 判断register ansible判断运算符_操作符_11


ansible 判断register ansible判断运算符_字符串_12


ansible 判断register ansible判断运算符_版本号_13


ansible 判断register ansible判断运算符_ansible 判断register_14


ansible 判断register ansible判断运算符_字符串_15


ansible 判断register ansible判断运算符_ansible 判断register_16


ansible 判断register ansible判断运算符_操作符_17


ansible 判断register ansible判断运算符_操作符_18


ansible 判断register ansible判断运算符_ansible 判断register_19


ansible 判断register ansible判断运算符_版本号_20


顺利执行block,则不会执行rescue

ansible 判断register ansible判断运算符_字符串_21


ansible 判断register ansible判断运算符_字符串_22

ansible 判断register ansible判断运算符_ansible 判断register_23


ansible 判断register ansible判断运算符_ansible 判断register_24


ansible 判断register ansible判断运算符_字符串_25


ansible 判断register ansible判断运算符_ansible 判断register_26