首页 > 其他 > 详细

ansible模块debug

时间:2016-02-29 16:40:59      阅读:164      评论:0      收藏:0      [点我收藏+]

示例:

# Example that prints the loopback address and gateway for each host
- debug: msg="System {{ inventory_hostname }} has uuid {{ ansible_product_uuid }}"

- debug: msg="System {{ inventory_hostname }} has gateway {{ ansible_default_ipv4.gateway }}"
  when: ansible_default_ipv4.gateway is defined

- shell: /usr/bin/uptime
  register: result

- debug: var=result

- name: Display all variables/facts known for a host
  debug: var=hostvars[inventory_hostname]

 

说明:

ansible-doc debug

debug是ansible版本的print语句 可以输出变量的内容或者随意的字符串 利于playbook执行阶段的调试

 

Options: (= is mandatory)(= 后面的参数是强制要有的)

- msg
  输出定义好的meassage 如果没有message 默认输出Hello world!

- var
  输出变量的内容 不可与msg选项共用

ansible模块debug

原文:http://www.cnblogs.com/metasequoia/p/5227700.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!