模組文件

  1. Ansible-doc 可查詢各模組的文件。
    [deyu1@kvm19 10827000]$ ansible-doc -h
    Usage: ansible-doc [-l|-F|-s] [options] [-t <plugin type> ] [plugin]
    
    plugin documentation tool
    
    Options:
      -h, --help            show this help message and exit
      -j, --json            **For internal testing only** Dump json metadata for
                            all plugins.
      -l, --list            List available plugins
      -F, --list_files      Show plugin names and their source files without
                            summaries (implies --list)
      -M MODULE_PATH, --module-path=MODULE_PATH
                            prepend colon-separated path(s) to module library (def
                            ault=~/.ansible/plugins/modules:/usr/share/ansible/plu
                            gins/modules)
      -s, --snippet         Show playbook snippet for specified plugin(s)
      -t TYPE, --type=TYPE  Choose which plugin type (defaults to "module").
                            Available plugin types are : ('become', 'cache',
                            'callback', 'cliconf', 'connection', 'httpapi',
                            'inventory', 'lookup', 'shell', 'module', 'strategy',
                            'vars')
      -v, --verbose         verbose mode (-vvv for more, -vvvv to enable
                            connection debugging)
      --version             show program's version number, config file location,
                            configured module search path, module location,
                            executable location and exit
    
    See man pages for Ansible CLI options or website for tutorials
    https://docs.ansible.com
    
  2. ansible-doc 列出可用的模組
    [deyu1@kvm19 10827000]$ ansible-doc -l
    
  3. ansible-doc 列出可用的模組,過濾 yum,找到有 yum 及 yum_repository 兩個模組。
    [deyu1@kvm19 10827000]$ ansible-doc -l | grep yum
    yum                                                    Manages packages wit...
    yum_repository                                         Add or remove YUM re...