Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion roles/splunk/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ clientName: undefined
splunk_admin_username: admin
splunk_admin_password: undefined # Use ansible-vault encrypt_string, e.g. ansible-vault encrypt_string --ask-vault-pass 'var_value_to_encrypt' --name 'var_name'
splunk_configure_secret: false # If set to true, you need to update files/splunk.secret
splunk_secret_file: splunk.secret # Used to specify your splunk.secret filename(s), files should be placed in the "files" folder of the role
#splunk_secret_file: splunk.secret # Used to specify your splunk.secret filename(s), files should be placed in the "files" folder of the role
#splunk_secret_text:
# Although there are tasks for the following Splunk configurations in this role, they are not included in any tasks by default. You can add them to your install_splunk.yml if you would like to have Ansible manage any of these files
splunk_configure_authentication: false
ad_bind_password: undefined # Use ansible-vault encrypt_string, e.g. ansible-vault encrypt_string --ask-vault-pass 'var_value_to_encrypt' --name 'var_name'
Expand Down
14 changes: 13 additions & 1 deletion roles/splunk/tasks/configure_splunk_secret.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,16 @@
mode: 0644
become: true
notify: restart splunk
when: splunk_configure_secret
when: splunk_configure_secret and splunk_secret_file is defined

- name: Install splunk.secret
template:
src: splunk.secret.j2
dest: "{{ splunk_home }}/etc/auth/splunk.secret"
owner: "{{ splunk_nix_user }}"
group: "{{ splunk_nix_group }}"
mode: 0644
become: true
notify: restart splunk
when: splunk_configure_secret and splunk_secret_text is defined

1 change: 1 addition & 0 deletions roles/splunk/templates/splunk.secret.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ splunk_secret_text }}
12 changes: 12 additions & 0 deletions scripts/generate-secrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash


docker_id=$(docker run --rm -d -e "SPLUNK_START_ARGS=--accept-license" -e "SPLUNK_PASSWORD=doesntmatter" splunk/universalforwarder)

while [ ! $(docker inspect --format '{{json .State.Health.Status}}' $docker_id) = "\"healthy\"" ]
do
sleep 2
done

docker exec $docker_id sudo cat /opt/splunkforwarder/etc/auth/splunk.secret
docker container stop $docker_id