In this blog, I would demonstrate how to automate install VMware Log Insight Agent using SaltStack.
What is VMware Log Insight Agent?
A Log Insight agent collects events from log files and forwards them to a vRealize Log Insight and Log Insight Cloud
What is Saltstack?
SaltStack is built on a powerful event-driven automation engine that provides IT, devops and SRE professionals with a simple, declarative management framework for their entire global infrastructure.
Pre-requisites
Following are the pre-requisites
- Working Setup of Saltstack with Master and Minion
- I have 1 Master and 1 Minion on CentOS, and I will be installing liagent on the minion
- Log Insight Agent saved on Webserver.
- I will be installing LI Agent 8.2
- Log Insight Agent ini file (Optional, If you are going to use the default from the log insight server)
Procedure
The following section includes steps for installing LI Agent using salt stack
Step 1
Create the state file liagent.sls . You can refer to the documentation on How to use/create Salt States
copy-liagent-rpm: cmd.run: - name: sudo curl -k http://webserver/LIAgent/VMware-Log-Insight-Agent-8.2.0-16776561.rpm --output /tmp/VMware-Log-Insight-Agent-8.2.0-16776561.rpminstall-liagent: cmd.run: - name: sudo rpm -i /tmp/VMware-Log-Insight-Agent-8.2.0-16776561.rpmcopy-liagentconfig: cmd.run: - name: sudo curl -k http://webserver/LIAgent/liagent.ini --output /var/lib/loginsight-agent/liagent.inirestart-liagentd: cmd.run: - name: sudo systemctl restart liagentd
Step 2
Test execute of the state file and ensure it succeeds
salt state.sls liagent test
Step 3
Apply the state file to the minion
salt state.sls liagent
If you want to push it to all the minions that you can just use the following
salt \'*\' state.sls liagent
Step 4
Verify liagent on the minion
systemctl status liagentd