Skip to content

Instantly share code, notes, and snippets.

@ekristen
Last active January 2, 2016 12:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekristen/f6c0cfd5bf5add25aa2b to your computer and use it in GitHub Desktop.
Save ekristen/f6c0cfd5bf5add25aa2b to your computer and use it in GitHub Desktop.
splunkforwarder:
pkg.installed:
- sources:
- splunkforwarder: salt://resources/splunkforwarder-6.0.1-189883-linux-2.6-amd64.deb
splunk_enable_boot:
cmd.run:
- name: /opt/splunkforwarder/bin/splunk enable boot-start --no-prompt --answer-yes --accept-license
- unless: /usr/sbin/update-rc.d -n splunk defaults|grep 'already exist'
- require:
- pkg: splunkforwarder
splunk_deploy_poll:
cmd.run:
- name: /opt/splunkforwarder/bin/splunk set deploy-poll {{ pillar['splunk']['deployment']['host'] }}:{{ pillar['splunk']['deployment']['port'] }}
- unless: /opt/splunkforwarder/bin/splunk list deploy-poll -auth {{ pillar['splunk']['forwarder']['user'] }}:{{ pillar['splunk']['forwarder']['password'] }} | grep "{{ pillar['splunk']['deployment']['host'] }}:{{ pillar['splunk']['deployment']['port'] }}"
- require:
- cmd: splunk_enable_boot
splunk_start:
cmd.run:
- name: /opt/splunkforwarder/bin/splunk start --no-prompt --answer-yes --accept-license
- unless: /usr/bin/pgrep -f 'splunkd'
- require:
- cmd: splunk_deploy_poll
@gravyboat
Copy link

splunkforwarder:
  pkg.installed:
    - sources:
    - splunkforwarder: salt://resources/splunkforwarder-6.0.1-189883-linux-2.6-amd64.deb
  cmd.wait:
    - name: /opt/splunkforwarder/bin/splunk enable boot-start --no-prompt --answer-yes --accept-license
    - unless: /usr/sbin/update-rc.d -n splunk defaults|grep 'already exist'
    - require:
      - pkg: splunkforwarder

deploy_poll_splunk:
  cmd.wait:
    - name: /opt/splunkforwarder/bin/splunk set deploy-poll {{ pillar['splunk']['deployment']['hostname'] }}:{{ pillar['splunk']['deployment']['port'] }}
    - require:
      - cmd: splunkforwarder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment