Ansible 集成

Ansible 是一款计算机客户端系统管理工具。有关详细信息,请访问 https://www.ansible.com

SUSE Multi-Linux Manager 支持管理 Ansible 控制节点。有关详细信息,请参见 administration:ansible-setup-control-node.adoc#at.ansible.overview

The supported version for the Ansible Control Node is Ansible 11.3. It should be obtained from the operating system vendor’s official repositories. For example, on SUSE Linux Enterprise 15 SP6 and SP7, Ansible is available through the Systems Management Module. For Control Nodes running operating systems other than SUSE Linux Enterprise, use Ansible shipped together with that distribution.

Ansible 软件同样适用于 SUSE Multi-Linux Manager 代理及 SUSE Multi-Linux Manager for Retail 分支服务器。

1. 功能概述

SUSE Multi-Linux Manager 可让系统管理员操作其 Ansible 控制节点。支持的功能包括:

  • 清单文件检查

  • 发现剧本

  • 执行剧本

更多信息:

2. 要求和基本配置

To use Ansible features, you need to register the already existing Ansible Control Node to the SUSE Multi-Linux Manager Server. In the Web UI, on the System Details  Properties page of the registered system, you must enable the Ansible Control Node system type of the Add-on System Types list.

Enabling the Ansible Control Node system type ensures that the ansible package is installed on the system by adding it in the highstate and activates the Ansible features under the System Details  Ansible tab.

As the next step, configure the paths to your Ansible playbook directories and inventory files on the System Details  Ansible  Control Node page. As an inventory path, you can use the standard Ansible inventory path /etc/ansible/hosts. As a playbook directory, you can use any directory on the control node, where your playbook files are stored. A playbook directory either contains .yml files or subdirectories with .yml files.

有关如何安装和设置 Ansible 控制节点的信息,请参见 设置 Ansible 控制节点

3. 清单检查

定义清单路径后,您可以使用 SUSE Multi-Linux Manager 检查其中的内容。

过程:从 Web UI 检查清单
  1. 在 SUSE Multi-Linux Manager Web UI 中,导航到系统细节  Ansible  清单

  2. 单击某个清单路径,在控制节点上实时执行清单检查。

4. 剧本发现

定义剧本目录后,可以在系统细节  Ansible  剧本页面上发现剧本。

与清单检查一样,剧本发现操作也是在控制节点上实时运行。

5. 剧本执行

You can schedule a playbook execution from the System Details  Ansible  Playbooks page. After selecting the playbook you wish to execute, you can select the inventory file for the execution from the Inventory Path drop-down menu of the Schedule Playbook Execution dialog. If you do not select any item, the default inventory configured in your Control Node will be used. The drop-down menu is populated with the inventories you defined in your Inventory paths and with inventories that have been locally discovered in your playbook directories. These are displayed as Custom Inventory items in the playbook details. You can also enter an arbitrary inventory path.

You can also pass variables to the playbook execution to override previously defined variables. To pass variables, locate the Playbook Content section and click Edit variables. In the Edit Variables dialog, you can add or edit variables as a list, dictionary, string, or boolean. Alternatively, click Edit YAML to edit the variables directly as YAML. Click Save to apply the variables to the playbook content.

然后,您可以选择剧本执行时间或选择操作链。最终,SUSE Multi-Linux Manager 会在控制节点上将剧本作为操作来执行。可以在操作细节页面上查看操作结果。