官网
调试模块主要是输出变量
- var 直接打印一个指定变量的值
- msg 打印一段可以格式化的字符串
## -e 传变量
ansible webservers -m debug -a "var=role" -e "role=web"
[root@ceph1 ~]# ansible webservers -m debug -a "var=role" -e "role=web"
ceph3 | SUCCESS => {
"role": "web"
}
ansible webservers -m debug -a "msg='role is {{role}}'" -e "role=web"
[root@ceph1 ~]# ansible webservers -m debug -a "msg='role is {{role}}'" -e "role=web"
ceph3 | SUCCESS => {
"msg": "role is web"
}