配置管理
您可以使用配置文件和通道管理客户端的配置,而无需手动配置每个客户端。
配置参数编写在脚本中并存储在配置文件中。您可以使用 SUSE Multi-Linux Manager Web UI 直接写入配置文件,也可以上载或关联到其他位置存在的文件。
配置通道用于组织配置文件。您可以为客户端订阅配置通道,并根据需要部署配置文件。
配置文件有版本控制,因此您可以添加配置设置,在您的客户端上对其进行测试,并根据需要将其回滚到之前的修订版。如果您已创建配置通道,还可以在不同的配置文件以及同一配置文件的不同修订版之间进行比较。
Configuration files are provided through Configuration Channels or State Channels.
下表显示了支持的功能,其中:
-
功能受 SUSE 支持
-
功能不受 SUSE 支持
-
功能正在考虑之中,日后可能受支持,也可能不受支持。
| Feature | Status |
|---|---|
Config Channels |
|
State Channels |
|
Deploying Files |
|
Comparing Files |
|
Applying the Highstate |
|
File Import from a Client |
|
Jinja Templating |
1. Create configuration channels
1.1. Configuration channel
To create a new configuration channel:
在 SUSE Multi-Linux Manager Web UI 中,导航到,然后单击 创建配置通道。
键入通道的名称。
键入通道的标签。 This field must contain only letters, numbers, hyphens (
-) and underscores (_).键入用于与其他通道进行区分的通道说明。
单击 创建配置通道 以创建新通道。
1.2. State channel
State channels use Salt states on clients:
在 SUSE Multi-Linux Manager Web UI 中,导航到,然后单击 创建状态通道。
键入通道的名称。
键入通道的标签。 This field must contain only letters, numbers, hyphens (
-) and underscores (_).键入用于与其他通道进行区分的通道说明。
Type the
SLS Contentsfor theinit.slsfile.Click Create Config State Channel to create the new channel.
2. Add configuration files, directories, or symbolic links
如果您已创建配置通道,则可以添加配置文件、目录或符号链接:
在 SUSE Multi-Linux Manager Web UI 中,导航到,单击要向其添加配置文件的配置通道的名称,然后导航到子选项卡。
In the
File Typefield, choose whether you want to create a text file, directory, or symbolic link.In the
Filename/Pathfield, type the absolute path to the location where the file should be deployed.If you are creating a symbolic link, type the target file and path in the
Symbolic Link Target Filename/Pathfield.Type the
User nameandGroup namefor the file in theOwnershipfield, and theFile Permissions Mode.If the client has SELinux enabled, you can configure
SELinux contextsto enable the required file attributes (for example: user, role, and file type).You can use Jinja templating with grains or pillar data instead of legacy macro delimiters.
Enter the configuration file contents in the
File Contentstext box, using the script drop-down box to choose the appropriate scripting language.单击 创建配置文件。
3. Subscribe clients to configuration channels
You can subscribe individual clients to configuration channels by navigating to , selecting the client you want to subscribe, and navigating to the Configuration tab. To subscribe multiple clients to a configuration channel, you can use the system set manager (SSM).
在 SUSE Multi-Linux Manager Web UI 中,导航到,然后选择要使用的客户端。
导航到,然后转到子选项卡,以查看可用配置通道的列表。
OPTIONAL: Click the number in the
Systems currently subscribedcolumn to see which clients are currently subscribed to the configuration channel.选中要订阅的配置通道,然后单击 继续。
使用向上和向下箭头对配置通道排名。 两个配置通道之间的设置发生冲突时,系统会优先使用更靠近列表顶部的通道。
确定通道应用到所选客户端的方式。 单击 订阅为最低优先级 可将新通道添加为比目前订阅的通道都低的优先级。单击 订阅为最高优先级 可将新通道添加为比目前订阅的通道都高的优先级。单击 替换现有订阅 可去除现有通道并将其替换为新通道。
单击 应用订阅。
|
如果新配置通道优先级与现有通道冲突,系统会去除重复的通道并根据新优先级进行替换。如果某个操作要对客户端的配置优先级重新排序,Web UI 会要求您在继续之前先确认更改。 |
4. Compare configuration files
您也可以使用系统集管理器 (SSM) 将客户端上部署的配置文件与存储在 SUSE Multi-Linux Manager 服务器上的配置文件进行比较。
在 SUSE Multi-Linux Manager Web UI 中,导航到,然后选择订阅了要比较的配置文件的客户端。
导航到,然后转到子选项卡,以查看可用配置文件的列表。
OPTIONAL: Click the number in the
Systemscolumn to see which clients are currently subscribed to the configuration file.选中要比较的配置文件,然后单击 安排文件比较。
5. 在客户端上建立 Jinja 模板
Jinja templating is possible on Salt clients. Jinja is only evaluated when content is processed by the Salt engine. Jinja provides variables from pillars or grains. They can be used in files managed by Salt (for example, via file.managed) or Salt states.
|
File configuration channels deliver static files without Jinja processing. State channel files are only applied if referenced in a Salt state. |
有关详细信息,请参见 https://docs.saltproject.io/salt/user-guide/en/latest/topics/jinja.html,该页面包含以下示例:
{% if grains.os_family == 'RedHat' %}
{% set dns_cfg = '/etc/named.conf' %}
{% elif grains.os_family == 'Debian' %}
{% set dns_cfg = '/etc/bind/named.conf' %}
{% else %}
{% set dns_cfg = '/etc/named.conf' %}
{% endif %}
dns_conf:
file.managed:
- name: {{ dns_cfg }}
- source: salt://dns/files/named.conf
- template: jinja