Ansible 1.4.1:ansible-doc 命令常见用法

1.4.1:ansible-doc 命令常见用法

1.4.1.1:列出所有可用模块

选项:

-l, --list
          List available plugins

示例:

因为没有使用-t指定插件类别,这里列出的是默认类别的可用插件数量,而默认的插件类别是module,所以列出的就是所有可用模块。

[root@ansible ~]# ansible-doc -l

在这里插入图片描述

查看当前的模块数量:

[root@ansible ~]# ansible-doc -l | wc -l
3387
1.4.1.2:查看指定插件的使用帮助

用法:ansible-doc MOD_NAME

示例:

[root@ansible ~]# ansible-doc shell

在这里插入图片描述

1.4.1.3:查看指定插件支持的参数

选项:

-s, --snippet
          Show playbook snippet for specified plugin(s)

示例:

[root@ansible ~]# ansible-doc -s shell
- name: Execute shell commands on targets
  shell:
      chdir:                 # Change into this directory before running the command.
      cmd:                   # The command to run followed by optional arguments.
      creates:               # A filename, when it already exists, this step will *not* be run.
      executable:            # Change the shell used to execute the command. This expects an absolute path to the executable.
      free_form:             # The shell module takes a free form command to run, as a string. There is no actual parameter named 'free form'. See the examples on how to use this module.
      removes:               # A filename, when it does not exist, this step will *not* be run.
      stdin:                 # Set the stdin of the command directly to the specified value.
      stdin_add_newline:     # Whether to append a newline to stdin data.
      warn:                  # Whether to enable task warnings.
1.4.1.4:查看指定类型的插件(默认类型为module)

选项:

-t 'TYPE', --type 'TYPE'
          Choose  which plugin type (defaults to "module"). Available plugin types are : ('become', 'cache', 'callback', 'cliconf', 'connection', 'httpapi', 'inventory', 'lookup', 'net‐
          conf', 'shell', 'module', 'strategy', 'vars')

-l, --list
          List available plugins

示例,查看 connection 类型的插件有哪些:

[root@ansible ~]# ansible-doc -t connection -l

在这里插入图片描述

这里可以看出,在Ansible的概念中,Plugin包含Module,Module只是Plugin的一个类别。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值