Use Case: How do I deploy minions using
the API in a Linux environment
The goal of this use case is to programmatically install the Salt minion service on a
minion by connecting a Linux VM to your Automation Config environment.
Before you can deploy a minion using the
API in a Linux environment, you must:
- Have a Automation Config environment with RaaS deployed.
- Have a Salt master and Salt minion installed.
- Have a Linux VM deployed.
- Ensure port 22 is not firewalled and available for minion use.
- Verify that the folderetc/salt/cloud.deploy.dcontains a collection of these files.These files should match the OS distribution release as well as the Salt release that your system requires.If you do not see the files, contact support.The xxxx in the filename, for example, salt-xxxx-redhat-8-x86_64-amd64.tar.gz, should match the version of the Salt master. To verify the version of the Salt master, run thesalt-master -Vcommand on the Salt master.
- If your environment is air-gapped, complete these steps:
- Open the RaaS configuration file in/etc/raas/raas.
- Add these lines to the configuration file:minion_deployment: airgap_install: true
- Restart the RaaS service using theservice raas restartcommand.
If you are using a hardened Linux VM, there are some situations where scripts cannot be run from/tmpon the VM.- If you are using Automation Assembler version 8.10.2 or higher: Add theadditionalAuthParamsproperty to the Automation Config resource in your cloud template. For more information, see Add the Automation Config resource to the cloud template.additionalAuthParams: profile: tmp_dir: /var/cache/salt
- If you are using Automation Assembler version 8.10.1 or lower: Modify the/etc/salt/cloud.providers.d/ssc_saltify_provider.conffile with
If this configuration file does not exist, create it and add the setting above.ssc_saltify_provider: driver: saltify tmp_dir: /var/cache/salt
- To identify the FQDN of the Salt master, run thesalt saltmaster grains.get fqdncommand in the Salt master's terminal.
- Ensure that the FQDN is configured for the Salt master by running theping [FQDN]command.
- To open Python, runpython3.
- Make this API call using an SSEAPI client with the correct credentials for your environment:from sseapiclient import APIClient client = APIClient('https://<master-ip>', '<ssc-username>', '<sscpassword>', ssl_validate_cert=False) client.api.minions.deploy_minion( master_id = '<master-id>', host_name_ip = '<prospective minion’s ip>', os = ‘<prospective minion’s os>’, minion_id = '<desired-minion-name-for-prospective-minion>', username = '<ssh-username-for-prospective-minion>', password = '<ssh-password-for-prospective-minion>', )Thedeploy.minionfunction begins running in your Automation Config environment. You can verify that the job is running in theActivitytab of the Automation Config user interface.If you are deploying a minion from Automation Assembler, then this API call is performed by Automation Assembler.
The minion was successfully
deployed and configured from your Linux environment and API call.
Verify that the minion was
deployed successfully by running a
test.ping
command against the
minion using the Run Command
window or by running the \*
test.ping
and \* test.versions
commands in the Salt
master command window.