From 1a1dc1c813eae8ea8985d11d593c1d273ffd15c8 Mon Sep 17 00:00:00 2001 From: Seth Swanson Date: Tue, 17 Oct 2023 09:52:49 -0600 Subject: [PATCH 1/2] Corrected include_task to be include_tasks --- roles/splunk/tasks/configure_dmc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/splunk/tasks/configure_dmc.yml b/roles/splunk/tasks/configure_dmc.yml index 2132f794..546f3aee 100644 --- a/roles/splunk/tasks/configure_dmc.yml +++ b/roles/splunk/tasks/configure_dmc.yml @@ -1,6 +1,6 @@ --- - name: Check splunk - include_task: check_splunk.yml + include_tasks: check_splunk.yml - name: Configure DMC as a IDXC member include_tasks: configure_idxc_sh.yml From 0179c9c978c64b305ca6075d009af809f158745f Mon Sep 17 00:00:00 2001 From: Seth Swanson Date: Wed, 18 Oct 2023 09:21:24 -0600 Subject: [PATCH 2/2] Changed the dmc task to take a var for the list of servers that are not indexers --- roles/splunk/defaults/main.yml | 3 +++ roles/splunk/tasks/configure_dmc.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/splunk/defaults/main.yml b/roles/splunk/defaults/main.yml index e884d5a5..ac095db1 100644 --- a/roles/splunk/defaults/main.yml +++ b/roles/splunk/defaults/main.yml @@ -51,6 +51,9 @@ git_project: undefined git_version: master # Configure default version to clone, overridable inside the git_apps dictionary within host_vars app_relative_path: # set a sub-path you want to sync within a repo. If the repo contains multiple apps in the root directory, just set this to a trailing slash. splunk_app_deploy_path: undefined # Path under $SPLUNK_HOME/ to deploy apps to - Note that this may be set in group_vars, host_vars, playbook vars, or inside the git_apps dictionary within host_vars +# DMC Vars +splunk_dmc_not_indexer_host_expression: 'all:!indexers' +splunk_dmc_not_indexers_list: "{{ query('inventory_hostnames', splunk_dmc_not_indexer_host_expression) }}" # List of all inventory items that are not the indexers. If your configuration uses a nonstandard name for hostnames you can replace this with a different list. # IDXC Vars splunk_idxc_key: mypass4symmkey splunk_idxc_rf: 2 diff --git a/roles/splunk/tasks/configure_dmc.yml b/roles/splunk/tasks/configure_dmc.yml index 546f3aee..0a81775d 100644 --- a/roles/splunk/tasks/configure_dmc.yml +++ b/roles/splunk/tasks/configure_dmc.yml @@ -9,7 +9,7 @@ - name: Configure systems as search peers to be monitored except indexers ansible.builtin.shell: | {{ splunk_home }}/bin/splunk add search-server https://{{ item }}:{{ splunkd_port }} -auth "{{ splunk_auth }}" -remoteUsername "{{ splunk_admin_username }}" -remotePassword "{{ splunk_admin_password }}" - loop: "{{ query('inventory_hostnames', 'all:!indexer') }}" + loop: "{{ splunk_dmc_not_indexers_list }}" become: true become_user: "{{ splunk_nix_user }}" no_log: true