Skip to content

Instantly share code, notes, and snippets.

@michaelgugino
Last active April 11, 2018 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelgugino/795024043ab34a1596fd21078a96be6e to your computer and use it in GitHub Desktop.
Save michaelgugino/795024043ab34a1596fd21078a96be6e to your computer and use it in GitHub Desktop.
Something better than what I was given.
- hosts: all # Never a good idea to use all group unless testing
sudo: yes # don't do this, use inventory to set the ansible_become=True variable.
tasks:
- name: Cat inputs out of splunk in opt
slurp:
src: "{{ splunk_inputs_file }}"
register: splunk_inputs_file_slurp
when:
- ansible_distribution == 'RedHat'
vars:
file1: "/opt/splunkforwarder/etc/system/local/inputs.conf"
file2: "/app/splunkforwarder/etc/system/local/inputs.conf"
splunk_inputs_file: "{{ (ansible_distribution_major_version == '7' | bool) | ternary(file1, file2) }}"
- debug:
var: file_content_decoded
vars:
file_content_decoded: "{{ splunk_inputs_file_slurp.content | b64decode }}"
when:
- splunk_inputs_file_slurp is defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment