Use Case: How do I deploy minions using the API in a Windows environment
The goal of this use case is to programmatically install the Salt minion service on a minion by connecting a Windows VM to your
Automation Config
environment.Before you can deploy a minion using the API in a Windows environment you must:
- Have aAutomation Configenvironment with RaaS deployed.
- Have a Salt master and Salt minion installed.
- Have a Windows VM deployed.
Going forward,
Automation Config
is no longer included in the Aria Automation suite of products. The new name of this product is VMware Tanzu Salt and this product is available as part of the VMware Tanzu Platform suite of products. See Using and Managing Tanzu Salt for more information.- Verify that the folderetc/salt/cloud.deploy.don the Salt master contains these files.If you do not see the files, contact support.The xxxx in the filename, for example,salt-xxxx-windows--x86.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
- In the Salt master's terminal, install the following libraries by running thepip3 install pypsexec smbprotocolandpip3 install impacket --ignore-installedcommands.This step is not required when using LCM to install theAutomation Configappliance that includes the Salt Master. However, this step is necessary when manually installing the Salt Master.
- To identify the FQDN of the Salt master, run thesalt saltmaster grains.get fqdncommand in the Salt master's terminal.
- On your Windows machine, verify that theC: \Windows\System32\drivers\etc\hostsfile is configured with the Salt master's IP and FQDN.
- Open PowerShell on the Windows machine and run the following command to open the required ports:PortCommands445New-NetFirewallRule -Name "SMB445" - DisplayName "SMB445" -Protocol TCP - LocalPort 445Enable-Psremoting
- In the Salt master's terminal, use this command to open ports 4505 and 4506 on the Salt master:PortCommands4505-4506netsh advfirewall firewall add rule name="Salt" dir=in action=allow protocol=TCP localport=4505-4506See UnderstandingAutomation Configfor more information about the Salt communication model.
- Ensure that the FQDN is configured for the Salt master by running theping [FQDN]command on your Windows machine.
- Make this API call using an SSEAPI client with the correct credentials for your environment.If you integratedAutomation ConfigwithVMware Aria Automation, theVMware Aria Automationservice makes this API call for you when you deploy minions using a cloud template.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 yourAutomation Configenvironment. You can verify that the job is running in theActivitytab of theAutomation Configuser interface or by running thepython3command, followed byclient.api.minions.get_minion_deployments().
The minion was successfully deployed and configured from your Windows 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.