示例:

# 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的更多相关文章

  1. ansible模块

    ansible模块: 模块(Modules),类似于 "任务插件"("task plugins")或"库插件"("library ...

  2. ansible笔记(3):ansible模块的基本使用

    ansible笔记():ansible模块的基本使用 在前文的基础上,我们已经知道,当我们使用ansible完成实际任务时,需要依靠ansible的各个模块,比如,我们想要去ping某主机,则需要使用 ...

  3. 第4天:Ansible模块

    Ansible对远程服务器的实际操作实际是通过模块完成的,其工作原理如下: 1)将模块拷贝到远程服务器 2)执行模块定义的操做,完成对服务器的修改 3)在远程服务器中删除模块 需要说明的是,Ansib ...

  4. ansible模块command、shell、raw、script

    简介 环境: ansible端: ip:192.168.100.129 hostname:node1.lansgg.com client端: ip:192.168.100.131 hostname:v ...

  5. win10的pycharm中安装ansible模块过程

    前面的安装报错信息 ansible模块安装报错:Could not install packages due to an OSError: [Errno 2] No such file or dire ...

  6. ansible 模块 分享

    A a10_server 管理A10 Networks AX / SoftAX / Thunder / vThunder设备 a10_service_group 管理A10网络设备的服务组 a10_v ...

  7. ansible模块介绍之ios_command

    一.模块简介 ios_command此模块将任意命令发送到ios节点并返回设备读取的结果 此模块不支持在配置模式下使用,即只支持在用户模式>和特权模式#下使用 官方文档地址:https://do ...

  8. ansible模块介绍之ios_facts

    一.模块简介 收集运行IOS系统的(此处指思科的ios)的远端设备信息 二.模块参数 auth_pass #特权密码,如果参数authorize=no,则不会检索此密码,如果任务task不指定,则默认 ...

  9. ansible模块解析及使用

    模块一:setup(收集远程主机信息) [root@zabbix30 /]# ansible test -m setup 模块二:ping(测试主机是否在线) [root@zabbix30 /]# a ...

随机推荐

  1. "org.jboss.netty.internal.LoggerConfigurator".DESCRIBED is already registered 的解决办法

    今天在jboss 6.2 EAP上部署一个项目时,报以下错误: org.jboss.msc.service.DuplicateServiceException: Service jboss.pojo. ...

  2. Java应用程序项目的打包与发行(run.bat形式)

    参考: http://www.iteye.com/topic/57312 背景: 以前一直都是在eclipse上面创建应用程序,每次要要运行的时候都要打开eclipse, 直到有个同事叫我帮忙写一个应 ...

  3. who命令的总结

    who命令能做什么 who命令用来查看谁登录了系统(show who is logged on ): 每一行代表一个巳经登录的用户,第1列是用户名,第2列是终端名,第3列是登录时间. 通过whatis ...

  4. C#基础之IEnumerable

    1.IEnumerable的作用 在使用Linq查询数据时经常以IEnumerable<T>来作为数据查询返回对象,在使用foreach进行遍历时需要该对象实现IEnumerable接口, ...

  5. .NET MVC AjaxHelper

    我们首先必须开启 非入侵式 Ajax:导入Jquery和unobtrusiveAjax文件 已经默认开启客户端验证 和 非侵入式js <add key="ClientValidatio ...

  6. 虚拟机开机提示Operating System not found解决办法

    为了更好体验windows更多操作系统,有些用户会在VMware虚拟机中安装XP.win7或win8等等系统,有用户反映在虚拟机中安装XP开机后提示"Operating System not ...

  7. Bash on Windows 抢鲜测试 -- 介绍及安装

    前言 微软在上周的Windows BUILD大会上宣布,WIN10将引入原生Bash,并将很快在技术预览版中推出. 如此一来,windows的命令行工具就不再只有cmd和powershell了,我们可 ...

  8. EditPlus怎样自动换行

    如果只是使用快捷键Ctrl+Shift+W或者使用文档→自动换行,的话,关闭软件之后再次打开时就会重新出现不能自动换行的问题. 中文版的是:文档→固定值设置(文档 菜单的最后一个),会打开一个“工具→ ...

  9. ASP.NET利用WINRar实现在线解压缩文件

    一.肯定是服务器必须装了winrar这个软件了. 二.创建Helper类,如下: using System; using System.Collections.Generic; using Syste ...

  10. 分布式学习材料Distributed System Prerequisite List

    接下的内容按几个大类来列:1. 文件系统a. GFS – The Google File Systemb. HDFS1) The Hadoop Distributed File System2) Th ...