Salt Bundle

1. Salt Bundle이란 무엇입니까?

Salt 번들은 Salt Minion, Python 3, 필수 Python 모듈 및 라이브러리가 포함된 단일 바이너리 패키지입니다.

Salt 번들은 Python 3과 Salt가 실행되기 위한 모든 요구사항과 함께 제공됩니다. 따라서 Salt 번들은 클라이언트에 설치된 Python 버전을 시스템 소프트웨어로 사용하지 않습니다. 해당 Salt 버전에 대한 요구사항을 충족하지 않는 클라이언트에도 Salt 번들을 설치할 수 있습니다.

SUSE Multi-Linux Manager Salt Master가 아닌 Salt Master에 연결된 Salt Minion을 실행하는 시스템에서도 Salt 번들을 사용할 수 있습니다.

2. Salt Bundle을 Minion으로 클라이언트 등록

Salt Bundle을 사용한 등록 방법이 권장 등록 방법입니다. 이 섹션에서는 현재 구현의 장점과 제한 사항에 대해 설명합니다.

The Salt Bundle is provided as the venv-salt-minion package that consists of Salt, Python 3, and the Python modules Salt depends on.

Web UI를 사용한 부트스트래핑도 Salt Bundle을 사용하므로 Web UI를 사용한 부트스트래핑은 Python에 종속되지 않습니다. Salt Bundle을 사용하면 더 이상 클라이언트가 Python 인터프리터나 모듈을 제공할 필요가 없습니다.

If you bootstrap new clients, registration with the Salt Bundle is the default method. You can switch existing clients to the Salt Bundle method. If you switch, the salt-minion package and its dependencies will stay installed.

2.1. Salt Minion과 함께 Salt 번들 사용

The Salt Bundle can be used with the Salt Minion managed by the Salt Master other than SUSE Multi-Linux Manager Server at the same time. If the Salt Bundle is installed on a client SUSE Multi-Linux Manager Server will manage the configuration files of the Salt Bundle, the configuration files of salt-minion will not be managed in this case. For more information, see Salt Bundle configuration.

  • To bootstrap a client with the Salt Minion managed by the Salt Master other than SUSE Multi-Linux Manager Server it is recommended to use mgr-bootstrap --force-bundle when generating the bootstrap script, or to set FORCE_VENV_SALT_MINION to 1 in the bootstrap script.

  • For bootstrapping with Web UI mgr_force_venv_salt_minion set to true pillar can be specified globally. For more information, see Salt States and Pillars.

2.2. Salt 미니언에서 Salt 번들로 전환

The Salt state util.mgr_switch_to_venv_minion is available to switch from salt-minion to venv-salt-minion. It is recommended to switch to venv-salt-minion in two steps to avoid trouble with shifting processes:

Procedure: Switching with util.mgr_switch_to_venv_minion state to venv-salt-minion
  1. Apply util.mgr_switch_to_venv_minion with no pillar specified first. This will result in the switch to venv-salt-minion with copying configuration files etc. It will not clean up the original salt-minion configurations and its packages.

    salt <minion_id> state.apply util.mgr_switch_to_venv_minion

    Apply util.mgr_switch_to_venv_minion with mgr_purge_non_venv_salt set to True to remove salt-minion and with mgr_purge_non_venv_salt_files set to True to remove all the files related to salt-minion. This second step ensures the first step was processed, and then removes the old configuration files and the now obsolete salt-minion package.

    salt <minion_id> state.apply util.mgr_switch_to_venv_minion pillar='{"mgr_purge_non_venv_salt_files": True, "mgr_purge_non_venv_salt": True}'

2.3. 추가 유의 사항

  • In case of running the second step only and the first step, state apply process could fail as it requires stopping the salt-minion which is used to execute the command on the client side.

  • It is also possible to avoid installing the Salt Bundle and keep using salt-minion instead. In this case, specify one of these options:

    • Execute mgr-bootstrap with --no-bundle option.

    • Set AVOID_VENV_SALT_MINION to 1 in the generated bootstrap script.

    • For bootstrap state set the mgr_avoid_venv_salt_minion pillar to True in /srv/pillar/salt_bundle_config.sls.

3. Salt 번들을 사용한 SSH Push

Salt 번들은 클라이언트로 SSH Push 작업을 수행할 때도 사용됩니다.

A shell script deploys the Salt Bundle onto the target system without installing venv-salt-minion before any Salt command is executed. Because the Salt Bundle contains the whole Salt code base, no salt-thin is deployed. SSH Push (including bootstrapping using the Web UI) uses the Python 3 interpreter within the bundle. The target system does not need to have any other Python interpreter installed.

번들과 함께 배포된 Python 3은 클라이언트에서 SSH Push 세션을 처리하는 데 사용되므로 SSH Push(Web UI를 사용한 부트스트랩 포함)는 시스템에 설치된 Python에 종속되지 않습니다.

Using salt-thin can be enabled as a fallback method, but it requires Python 3 to be installed on the client. This method is not recommended nor supported and exists for development purposes only. Set web.ssh_use_salt_thin to true in the /etc/rhn/rhn.conf configuration file.

  • 부트스트랩 리포지토리는 Web UI를 사용하여 클라이언트를 부트스트랩하기 전에 생성해야 합니다. SSH Push는 감지된 대상 운영 체제를 기반으로 부트스트랩 리포지토리에서 가져온 Salt 번들을 사용합니다. 자세한 내용은 client-configuration:bootstrap-repository.adoc#_prepare_to_create_a_bootstrap_repository에서 확인할 수 있습니다.

  • SSH Push is using /var/tmp to deploy Salt Bundle to and execute Salt commands on the client with the bundled Python. Therefore you must not mount /var/tmp with the noexec option. It is not possible to bootstrap the clients, which have /var/tmp mounted with noexec option, with the Web UI because the bootstrap process is using SSH Push to reach a client.

4. Extend Salt Bundle With Python Packages using pip

The Salt Bundle includes pip to make it possible to extend the functionality of the bundled Salt Minion with extra Python packages.

By default, salt <minion_id> pip.install <package-name> installs the Python package specified by <package_name> into /var/lib/venv-salt-minion/local.

If needed, the path /var/lib/venv-salt-minion/local can be overridden by setting the VENV_PIP_TARGET environment variable for the venv-salt-minion.service. It is recommended to use a systemd drop-in configuration file for the service. It could be done with the configuration file /etc/systemd/system/venv-salt-minion.service.d/10-pip-destination.conf:

[Service]
Environment=VENV_PIP_TARGET=/new/path/local/venv-salt-minion/pip

The Python packages installed through pip are not changing on updating the Salt Bundle. To ensure that such packages are available and functional after an update, it is recommended to install them with a Salt state that is applied after Salt Bundle updates.