ansible模块setup/debug

こ雲淡風輕ζ 提交于 2020-09-29 11:48:10

setup 输出gathering facts信息

filter 指定过滤的信息名称,支持正则匹配
fact_path 指定fact后缀文件的路径

示例:
ansible jack -m setup -a 'filter="ansible_memory_mb"'
ansible jack -m setup -a 'filter="mb"'
ansible jack -m setup -a 'fact_path=/data/test.fact'


debug 输出调试信息

msg 自定义的信息或者ansible的系统变量
var 自定义的变量

示例:
[root@jack7-1 work]# cat debug.yml


  • hosts: PC
    remote_user: root
    tasks:
    • name: debug demo
      debug:
      msg: "remote host memory :{{ansible_memory_mb}}"



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!