在命令行上注册客户端

1. 简介

在大多数情况下,使用默认的引导方法即可正确注册 Salt 客户端。

不过,您可以使用 Salt 手动将客户端注册到 SUSE Multi-Linux Manager 服务器,方法是编辑客户端上的 Salt 受控端文件,并提供服务器的完全限定域名 (FQDN)。

使用此方法需满足以下要求:

  • 使用服务器的入站端口 4505 和 4506。

  • 除了确保这些端口是开放的之外,不需要在 SUSE Multi-Linux Manager 服务器上进行任何配置。

  • requires that you have installed the venv-salt-minion (Salt bundle) or the salt-minion package on the Salt client before registration. Both use configuration files in different locations and filenames remain the same. The systemd service filename is different.

Bootstrapping this way will only work if you use the salt-minion being part of the client tools channels or of an official SUSE distributions.

2. Salt 捆绑包配置

Salt Bundle (venv-salt-minion)
  • /etc/venv-salt-minion/

  • /etc/venv-salt-minion/minion

  • /etc/venv-salt-minion/minion.d/NAME.conf

  • systemd service file: venv-salt-minion.service

有关 Salt 捆绑包的详细信息,请参见 Salt 捆绑包

过程:使用 Salt 捆绑包配置文件注册客户端
  1. On the Salt client, open the minion configuration file. The configuration file is either located at:

    Listing 1. 配置文件
    /etc/venv-salt-minion/minion

    或:

    Listing 2. 配置文件
    /etc/venv-salt-minion/minion.d/NAME.conf
  2. 在文件中添加或编辑 SUSE Multi-Linux Manager 服务器或代理的 FQDN 以及激活密钥(如果有)。另外请添加以下其他配置参数。

    Listing 3. 配置参数
    master: SERVER.EXAMPLE.COM
    
    grains:
      susemanager:
        activation_key: "<Activation_Key_Name>"
    
    server_id_use_crc: adler32
    enable_legacy_startup_events: False
    enable_fqdns_grains: False
  3. Restart the venv-salt-minion service:

    systemctl restart venv-salt-minion
  4. On the SUSE Multi-Linux Manager Server, accept the new client key; replace <client> with the name of your client:

    salt-key -a '<客户端>'

3. 客户端配置

Client (salt-minion)
  • /etc/salt/

  • /etc/salt/minion

  • /etc/salt/minion.d/NAME.conf

  • systemd service file: salt-minion.service

过程:使用 Salt 受控端配置文件注册客户端
  1. On the Salt client, open the minion configuration file. The configuration file is either located at:

    /etc/salt/minion

    或:

    /etc/salt/minion.d/NAME.conf
  2. 在文件中添加或编辑 SUSE Multi-Linux Manager 服务器或代理的 FQDN 以及激活密钥(如果有)。另请添加下列其他配置参数。

    master: SERVER.EXAMPLE.COM
    
    grains:
      susemanager:
        activation_key: "<Activation_Key_Name>"
    
    server_id_use_crc: adler32
    enable_legacy_startup_events: False
    enable_fqdns_grains: False
  3. Restart the salt-minion service:

    systemctl restart salt-minion
  4. On the SUSE Multi-Linux Manager Server, accept the new client key; replace <client> with the name of your client:

    salt-key -a '<客户端>'

有关 Salt 受控端配置文件的详细信息,请参见 配置 Salt 受控端