Example usage of splunk ansible project.
Playbooks use a named account deployer
for ansible ansible tasks on inventory hosts, either update this named account or ensure the user exists on all target machines
- These examples assume CentOS images exist
- The example infrastructure assumes the the local domain
lab.local
(e.g. splk-sh1.lab.local) - The
splunk-ansible
build and maintained by Splunk assumes that hostname in inventory and the result ofhostname
on the Linux host are identical. Some plays and tasks will not execute if those mismatch.
- Download latest version of Splunk to
/tmp/splunk.rpm
- Place the license file in
/tmp/splunk.lic
- Clone repo
git clone https://github.com/ps-sec-analytics/splunk-engagement-ansible.git
- Change directory to
cd splunk-engagement-ansible
- Pull the splunk-ansible submodule
git submodule update --init --recursive
- Change directory to ansible-deployment folder
cd ansible
- Use or update one of the existing inventory files in
inventory
directory - Use or update one of the existing playbooks in the
playbooks
. Examples of standalone, deploymentserver only, and advanced configuration are provided. - Run the playbook and inventory of your choice, for example
ansible-playbook -vv -i example-inventory/splunk-standalone.yml playbooks/install-standalone.yml
- To update run
git pull
and to pull an updated splunk-ansible submodulegit submodule update --recursive --remote
In scenarios where ansible testing is taking place or where it cannot be installed via pacakge manager (e.g. yum), it is possible to run a portable ansible installation. The following steps outline the requirements for setting this up:
- Clone the ansible repo
git clone --single-branch --branch 'stable-2.9' https://github.com/ansible/ansible.git
- Change director to ansible directory
cd ansible
- Install required python modules
pip3 install -r requirements.txt
- Setup ansible environment
source ./hacking/env-setup
Hosts
- splk-util1.lab.local (ansible host)
- splk-sh1.lab.local (host to be used for Splunk Standalone instance)
The following scenarios have example inventory and playbooks associated with them:
Hosts
- splk-util1.lab.local (ansible host)
- splk-sh1.lab.local (Splunk Search Head)
- splk-idx1.lab.local (Splunk Indexer)
- splk-dp1.lab.local (Splunk Deployment Server & Splunk License Master)
- splunkuf1.lab.local (Splunk Universal Forwarder)
Ansible Install Command
ansible-playbook -vv -i example-inventory/splunk-distributed.yml playbooks/install-distributed.yml
Hosts
- splk-util1.lab.local (ansible host)
- splk-sh1.lab.local (Splunk Search Head)
- splk-cm1.lab.local (Splunk Indexer Cluster Master)
- splk-idx1.lab.local (Splunk Indexer Cluster Node)
- splk-idx2.lab.local (Splunk Indexer Cluster Node)
- splk-dp1.lab.local (Splunk Deployment Server & Splunk License Master)
- splunkuf1.lab.local (Splunk Universal Forwarder)
Ansible Install Command
ansible-playbook -vv -i example-inventory/splunk-indexcluster.yml playbooks/install-indexcluster.yml
Hosts
- splk-util1.lab.local (ansible host)
- splk-sh1.lab.local (Splunk Search Head Cluster Node)
- splk-sh2.lab.local (Splunk Search Head Cluster Node)
- splk-sh3.lab.local (Splunk Search Head Cluster Node)
- splk-cm1.lab.local (Splunk Indexer Cluster Master)
- splk-idx1.lab.local (Splunk Indexer Cluster Node)
- splk-idx2.lab.local (Splunk Indexer Cluster Node)
- splk-dp1.lab.local (Splunk Deployment Server & Splunk License Master)
- splunkuf1.lab.local (Splunk Universal Forwarder)
Ansible Install Command
ansible-playbook -vv -i example-inventory/splunk-searchcluster-indexcluster.yml playbooks/install-searchcluster-indexcluster.yml