From d829c9131a3177973d3843d3dd252e4c55c3c8fe Mon Sep 17 00:00:00 2001 From: Hamza Aziz Date: Wed, 30 Jul 2025 10:50:56 -0700 Subject: [PATCH 1/3] skip_cluster_bundle_push var added --- inventory/environ.py | 2 ++ .../tasks/apply_cluster_bundle.yml | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/inventory/environ.py b/inventory/environ.py index e813bc0f..2979b251 100755 --- a/inventory/environ.py +++ b/inventory/environ.py @@ -125,6 +125,8 @@ def getDefaultVars(): getSplunkdSSL(defaultVars) getDistributedTopology(defaultVars) getLicenses(defaultVars) + # Determine if Skip CM Bundle Push Enabled + defaultVars["splunk"]["skip_cluster_bundle_push"] = os.environ.get('SPLUNK_SKIP_CLUSTER_BUNDLE_PUSH', '').lower() == 'true' # Determine DMC settings defaultVars["dmc_forwarder_monitoring"] = os.environ.get('DMC_FORWARDER_MONITORING', False) defaultVars["dmc_asset_interval"] = os.environ.get('DMC_ASSET_INTERVAL', '3,18,33,48 * * * *') diff --git a/roles/splunk_cluster_master/tasks/apply_cluster_bundle.yml b/roles/splunk_cluster_master/tasks/apply_cluster_bundle.yml index 9950d720..a4af2b3c 100644 --- a/roles/splunk_cluster_master/tasks/apply_cluster_bundle.yml +++ b/roles/splunk_cluster_master/tasks/apply_cluster_bundle.yml @@ -10,7 +10,9 @@ status_code: [200] register: peer_list until: peer_list.json.entry | length == groups['splunk_indexer'] | length - when: "'splunk_indexer' in groups" + when: + - "'splunk_indexer' in groups" + - not (splunk.skip_cluster_bundle_push | default(false) | bool) retries: "{{ retry_num }}" delay: "{{ retry_delay }}" @@ -41,6 +43,7 @@ no_log: "{{ hide_password }}" retries: "{{ retry_num }}" # We will sometimes see this if the number of peers dictacted by the replication factor aren't up delay: "{{ retry_delay }}" + when: not (splunk.skip_cluster_bundle_push | default(false) | bool) - name: Wait for bundle push command: "{{ splunk.exec }} show cluster-bundle-status -auth {{ splunk.admin_user }}:{{ splunk.password }}" @@ -53,8 +56,14 @@ become: yes become_user: "{{ splunk.user }}" no_log: "{{ hide_password }}" + when: not (splunk.skip_cluster_bundle_push | default(false) | bool) - debug: msg: "WARNING: Indexer bundle push still in progress - proceeding anyways..." when: - - cluster_bundle_status.stdout.find("cluster_status=Rolling restart of the peers is in progress")!=-1 + - not (splunk.skip_cluster_bundle_push | default(false) | bool) + - cluster_bundle_status is defined and cluster_bundle_status.stdout.find("cluster_status=Rolling restart of the peers is in progress")!=-1 + +- debug: + msg: "Cluster bundle push skipped as per configuration." + when: splunk.skip_cluster_bundle_push | default(false) | bool \ No newline at end of file From e5d5d27f077c335bed4ba91bd64ab72094394dc7 Mon Sep 17 00:00:00 2001 From: Hamza Aziz Date: Wed, 30 Jul 2025 10:54:07 -0700 Subject: [PATCH 2/3] cm bundle push skip logic added --- roles/splunk_cluster_master/tasks/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/splunk_cluster_master/tasks/main.yml b/roles/splunk_cluster_master/tasks/main.yml index ec47878d..b1fd15b1 100644 --- a/roles/splunk_cluster_master/tasks/main.yml +++ b/roles/splunk_cluster_master/tasks/main.yml @@ -53,5 +53,9 @@ - splunk.multisite_search_factor_origin is defined - splunk.multisite_search_factor_total is defined +- include_tasks: apply_cluster_bundle.yml + when: + - not splunk.skip_cluster_bundle_push | default(false) | bool + - include_tasks: ../../../roles/splunk_common/tasks/check_for_required_restarts.yml From 23837310671166b348f9dc9ad5660d65b1b740c8 Mon Sep 17 00:00:00 2001 From: Hamza Aziz Date: Wed, 30 Jul 2025 13:19:24 -0700 Subject: [PATCH 3/3] Comments addressed --- docs/ADVANCED.md | 1 + .../tasks/apply_cluster_bundle.yml | 13 ++----------- roles/splunk_cluster_master/tasks/main.yml | 9 +++------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/docs/ADVANCED.md b/docs/ADVANCED.md index 088d0e7a..fded6a31 100644 --- a/docs/ADVANCED.md +++ b/docs/ADVANCED.md @@ -37,6 +37,7 @@ Splunk-Ansible ships with an inventory script in `inventory/environ.py`. The scr | SPLUNK_HEAVY_FORWARDER_URL | Comma-separated list of all Splunk Enterprise heavy forwarder hosts (network alias) | no | no | no | | SPLUNK_DEPLOYER_URL | One Splunk Enterprise deployer host (network alias) | no | yes | no | | SPLUNK_CLUSTER_MASTER_URL | One Splunk Enterprise cluster master host (network alias) | no | no | yes | +| SPLUNK_SKIP_CLUSTER_BUNDLE_PUSH | When set to "true", skips the cluster bundle push that happens on the cluster master | no | no | no | | SPLUNK_SEARCH_HEAD_CAPTAIN_URL | One Splunk Enterprise search head host (network alias). Passing this ENV variable will enable search head clustering. | no | yes | no | | SPLUNK_LICENSE_MASTER_URL | One Splunk Enterprise license master host (network alias). Passing this ENV variable will enable license master setup. | no | no | no | | SPLUNK_DEPLOYMENT_SERVER | One Splunk host (network alias) that we use as a [deployment server](http://docs.splunk.com/Documentation/Splunk/latest/Updating/Configuredeploymentclients). | no | no | no | diff --git a/roles/splunk_cluster_master/tasks/apply_cluster_bundle.yml b/roles/splunk_cluster_master/tasks/apply_cluster_bundle.yml index a4af2b3c..e6424ef9 100644 --- a/roles/splunk_cluster_master/tasks/apply_cluster_bundle.yml +++ b/roles/splunk_cluster_master/tasks/apply_cluster_bundle.yml @@ -10,9 +10,7 @@ status_code: [200] register: peer_list until: peer_list.json.entry | length == groups['splunk_indexer'] | length - when: - - "'splunk_indexer' in groups" - - not (splunk.skip_cluster_bundle_push | default(false) | bool) + when: "'splunk_indexer' in groups" retries: "{{ retry_num }}" delay: "{{ retry_delay }}" @@ -43,7 +41,6 @@ no_log: "{{ hide_password }}" retries: "{{ retry_num }}" # We will sometimes see this if the number of peers dictacted by the replication factor aren't up delay: "{{ retry_delay }}" - when: not (splunk.skip_cluster_bundle_push | default(false) | bool) - name: Wait for bundle push command: "{{ splunk.exec }} show cluster-bundle-status -auth {{ splunk.admin_user }}:{{ splunk.password }}" @@ -56,14 +53,8 @@ become: yes become_user: "{{ splunk.user }}" no_log: "{{ hide_password }}" - when: not (splunk.skip_cluster_bundle_push | default(false) | bool) - debug: msg: "WARNING: Indexer bundle push still in progress - proceeding anyways..." when: - - not (splunk.skip_cluster_bundle_push | default(false) | bool) - - cluster_bundle_status is defined and cluster_bundle_status.stdout.find("cluster_status=Rolling restart of the peers is in progress")!=-1 - -- debug: - msg: "Cluster bundle push skipped as per configuration." - when: splunk.skip_cluster_bundle_push | default(false) | bool \ No newline at end of file + - cluster_bundle_status.stdout.find("cluster_status=Rolling restart of the peers is in progress")!=-1 \ No newline at end of file diff --git a/roles/splunk_cluster_master/tasks/main.yml b/roles/splunk_cluster_master/tasks/main.yml index b1fd15b1..0aecb779 100644 --- a/roles/splunk_cluster_master/tasks/main.yml +++ b/roles/splunk_cluster_master/tasks/main.yml @@ -22,6 +22,8 @@ loop: "{{ splunk.app_paths_install.idxc }}" - include_tasks: apply_cluster_bundle.yml + when: + - not splunk.skip_cluster_bundle_push | bool # This installed_apps list gets mutated by ESS bundle generation, hence we # need to refresh this array of apps before disabling them all @@ -53,9 +55,4 @@ - splunk.multisite_search_factor_origin is defined - splunk.multisite_search_factor_total is defined -- include_tasks: apply_cluster_bundle.yml - when: - - not splunk.skip_cluster_bundle_push | default(false) | bool - -- include_tasks: ../../../roles/splunk_common/tasks/check_for_required_restarts.yml - +- include_tasks: ../../../roles/splunk_common/tasks/check_for_required_restarts.yml \ No newline at end of file