模組文件

  1. Ansible-doc 可查詢各模組的文件, -h 選項查輔助說明。
    ceuser@deyu:~/ansible_pb$ ansible-doc -h
    usage: ansible-doc [-h] [--version] [-v] [-M MODULE_PATH]
                       [--playbook-dir BASEDIR]
    ..............省略...............
    
    options:
      --metadata-dump       **For internal use only** Dump json metadata for all
                            entries, ignores other options.
    ..............省略...............
      --version             show program's version number, config file location,
                            configured module search path, module location,
                            executable location and exit
    ..............省略...............
      -h, --help            show this help message and exit
      -j, --json            Change output into json format.
      -l, --list            List available plugins. A supplied argument will be
                            used for filtering, can be a namespace or full
                            collection name.
    ..............省略...............
    See man pages for Ansible CLI options or website for tutorials
    https://docs.ansible.com
    
  2. ansible-doc 列出可用的模組
    ceuser@deyu:~/ansible_pb$ ansible-doc -l
    
  3. ansible-doc 列出可用的模組,過濾 yum,找到有 yum 及 yum_repository 兩個模組。
    ceuser@deyu:~/ansible_pb$ ansible-doc -l | grep yum
    ansible.builtin.yum                    Manages packages with the `yum' pack...
    ansible.builtin.yum_repository         Add or remove YUM repositories