第 4 章 查阅带有自动化内容导航器的清单

作为内容创建者,您可以使用 Automation 内容浏览 Ansible 清单并以交互方式签入到组和主机。

4.1. 检查 Automation 内容导航器中的清单

您可以以交互模式通过自动化内容导航器用户界面查看 Ansible 清单,并将 delve 放入组和主机中以了解更多详细信息。

先决条件

  • 有效的清单文件或清单插件。

流程

  1. 启动自动化内容导航器.

    $ ansible-navigator

    可选:从命令行键入 ansible-navigator inventory -i simple_inventory.yml 来查看清单。

  2. 检查清单。

     :inventory -i simple_inventory.yml
    
       TITLE            DESCRIPTION
    0│Browse groups    Explore each inventory group and group members members
    1│Browse hosts     Explore the inventory with a list of all hosts
  3. 键入 0 以浏览组。

      NAME               TAXONOMY                      TYPE
    0│general            all                           group
    1│nodes              all                           group
    2│ungrouped          all                           group

    TAXONOMY 字段详细说明所选组或节点所属组的层次结构。

  4. 键入与您要转至的组对应的数字。

      NAME              TAXONOMY                        TYPE
    0│node-0            all▸nodes                       host
    1│node-1            all▸nodes                       host
    2│node-2            all▸nodes                       host
  5. 输入与您要提取的主机对应的数字,或者如果大于 9,键入 :<number>

    [node-1]
    0│---
    1│ansible_host: node-1.example.com
    2│inventory_hostname: node-1

验证

  • 检查清单输出。

      TITLE            DESCRIPTION
    0│Browse groups   Explore each inventory group and group members members
    1│Browse hosts    Explore the inventory with a list of all hosts