Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for splunk.secret to be passed as a variable #51

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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: undefined # Used to specify your splunk.secret filename(s), files should be placed in the "files" folder of the role
splunk_secret_text: undefined # Used to specify your splunk.secret via a text value
# 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
19 changes: 17 additions & 2 deletions roles/splunk/tasks/configure_splunk_secret.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- name: Install splunk.secret
- name: Install splunk.secret from file
copy:
src: "{{ splunk_secret_file }}"
dest: "{{ splunk_home }}/etc/auth/splunk.secret"
Expand All @@ -7,4 +7,19 @@
mode: 0644
become: true
notify: restart splunk
when: splunk_configure_secret
when:
- splunk_configure_secret
- splunk_secret_file != 'undefined'

- name: Install splunk.secret from text
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
- splunk_secret_text != 'undefined'
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 }}