From 0ccc6a361ce73dd53564b7b9d1dbc4466e77bde2 Mon Sep 17 00:00:00 2001 From: Abdul K Date: Thu, 24 Aug 2023 19:57:13 -0700 Subject: [PATCH 01/10] Update multisite logic --- roles/splunk_search_head/tasks/setup_multisite.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/splunk_search_head/tasks/setup_multisite.yml b/roles/splunk_search_head/tasks/setup_multisite.yml index ef65dc72..9610c0eb 100644 --- a/roles/splunk_search_head/tasks/setup_multisite.yml +++ b/roles/splunk_search_head/tasks/setup_multisite.yml @@ -13,7 +13,7 @@ become_user: "{{ splunk.user }}" register: set_new_master until: set_new_master.rc == 0 or (set_new_master.rc != 0 and "Cannot edit this searchhead. Use 'splunk edit cluster-master' to edit information for this searchhead." in set_new_master.stderr) or (set_new_master.rc != 0 and "Cannot edit this searchhead. Use 'splunk edit cluster-manager' to edit information for this searchhead." in set_new_master.stderr) - failed_when: (set_new_master.rc != 0 and "Cannot edit this searchhead. Use 'splunk edit cluster-master' to edit information for this searchhead." not in set_new_master.stderr) or (set_new_master.rc != 0 and "Cannot edit this searchhead. Use 'splunk edit cluster-manager' to edit information for this searchhead." not in set_new_master.stderr) + failed_when: set_new_master.rc != 0 and ("Cannot edit this searchhead. Use 'splunk edit cluster-master' to edit information for this searchhead." not in set_new_master.stderr and "Cannot edit this searchhead. Use 'splunk edit cluster-manager' to edit information for this searchhead." not in set_new_master.stderr) changed_when: set_new_master.rc == 0 retries: "{{ retry_num }}" delay: "{{ retry_delay }}" @@ -40,4 +40,4 @@ notify: - Restart the splunkd service no_log: "{{ hide_password }}" - failed_when: (set_associated_site.rc != 0 and 'No change in master or secret or site.' not in set_associated_site.stderr) or (set_associated_site.rc != 0 and 'No change in manager or secret or site.' not in set_associated_site.stderr) + failed_when: set_associated_site.rc != 0 and ('No change in master or secret or site.' not in set_associated_site.stderr and 'No change in manager or secret or site.' not in set_associated_site.stderr) From e4e353fab09ee511160078e35e287c8a98eb14ce Mon Sep 17 00:00:00 2001 From: Abdul K Date: Thu, 2 Nov 2023 14:22:02 -0700 Subject: [PATCH 02/10] udpate for http auth on apps --- library/http_auth.py | 46 ++++++++++++++++++++++ roles/splunk_common/tasks/install_apps.yml | 7 +--- 2 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 library/http_auth.py diff --git a/library/http_auth.py b/library/http_auth.py new file mode 100644 index 00000000..01bb244a --- /dev/null +++ b/library/http_auth.py @@ -0,0 +1,46 @@ +#!/usr/bin/python + +from ansible.module_utils.basic import AnsibleModule +import requests +import os + +def run_module(): + module_args = dict( + url=dict(type='str', required=True), + dest=dict(type='str', required=True), + token=dict(type='str', required=True) + ) + + module = AnsibleModule( + argument_spec=module_args, + supports_check_mode=True + ) + + headers = { + "Authorization": "Bearer {}".format(module.params['token'].split(":")[1]) + } + + try: + response = requests.get( + module.params['url'], + headers=headers, + ) + response.raise_for_status() + + # Extract filename from URL + filename = os.path.basename(module.params['url']) + + # Join dest directory with filename + file_path = os.path.join(module.params['dest'], filename) + + with open(file_path, 'wb') as f: + for chunk in response.iter_content(chunk_size=8192): + f.write(chunk) + + except requests.exceptions.RequestException as e: + module.fail_json(msg="Failed to download the file. Error: {}".format(e)) + + module.exit_json(changed=True, dest=file_path) + +if __name__ == '__main__': + run_module() \ No newline at end of file diff --git a/roles/splunk_common/tasks/install_apps.yml b/roles/splunk_common/tasks/install_apps.yml index d5a397d6..cdfa0318 100644 --- a/roles/splunk_common/tasks/install_apps.yml +++ b/roles/splunk_common/tasks/install_apps.yml @@ -31,13 +31,10 @@ register: app_local - name: Download remote app - get_url: + http_auth: url: "{{ app_url }}" dest: /tmp/ - mode: 0777 - timeout: 120 - validate_certs: no - force: yes + token: "{{ lookup('env', 'MY_ENV_VARIABLE') }}" register: app_remote when: - app_url is match("^(https?|file)://.*") From 6dbae38d8c59cff7e863cec242a9b641bf570b39 Mon Sep 17 00:00:00 2001 From: Abdul K Date: Mon, 27 Nov 2023 14:12:16 -0800 Subject: [PATCH 03/10] Update env name --- roles/splunk_common/tasks/install_apps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/splunk_common/tasks/install_apps.yml b/roles/splunk_common/tasks/install_apps.yml index cdfa0318..710860d6 100644 --- a/roles/splunk_common/tasks/install_apps.yml +++ b/roles/splunk_common/tasks/install_apps.yml @@ -34,7 +34,7 @@ http_auth: url: "{{ app_url }}" dest: /tmp/ - token: "{{ lookup('env', 'MY_ENV_VARIABLE') }}" + token: "{{ lookup('env', 'ARTIFACTORY_AUTHORIZATION') }}" register: app_remote when: - app_url is match("^(https?|file)://.*") From 3dfdec80aaaa1651fd98f424e2c94d24df642d26 Mon Sep 17 00:00:00 2001 From: Abdul K Date: Tue, 5 Dec 2023 04:57:25 -0800 Subject: [PATCH 04/10] remove token parsing --- library/http_auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/http_auth.py b/library/http_auth.py index 01bb244a..9774b452 100644 --- a/library/http_auth.py +++ b/library/http_auth.py @@ -17,7 +17,7 @@ def run_module(): ) headers = { - "Authorization": "Bearer {}".format(module.params['token'].split(":")[1]) + "Authorization": "Bearer {}".format(module.params['token']) } try: From 7e474301754965d629c85416abf68530f0462455 Mon Sep 17 00:00:00 2001 From: Aditya Pingle Date: Tue, 5 Dec 2023 14:51:08 -0800 Subject: [PATCH 05/10] updated codeowners team from IF-01 to splunk-internal-dev-services; --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 22b98338..d49ec89c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -6,5 +6,5 @@ # Order matters: The last matching pattern has the most precedence. # Default owners for everything in docker-splunk: -* @splunk/if-01 +* @splunk/splunk-internal-dev-services From d780de1a9b33511079fbd6d0abda00d533d9ebb3 Mon Sep 17 00:00:00 2001 From: Abdul K Date: Tue, 12 Dec 2023 14:22:25 -0800 Subject: [PATCH 06/10] Update install process --- roles/splunk_common/tasks/install_apps.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/splunk_common/tasks/install_apps.yml b/roles/splunk_common/tasks/install_apps.yml index 710860d6..89c1d20f 100644 --- a/roles/splunk_common/tasks/install_apps.yml +++ b/roles/splunk_common/tasks/install_apps.yml @@ -31,10 +31,15 @@ register: app_local - name: Download remote app - http_auth: + get_url: url: "{{ app_url }}" dest: /tmp/ - token: "{{ lookup('env', 'ARTIFACTORY_AUTHORIZATION') }}" + mode: 0777 + timeout: 120 + validate_certs: no + force: yes + url_username: "{{ lookup('env', 'ARTIFACTORY_USER') }}" + url_password: "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}" register: app_remote when: - app_url is match("^(https?|file)://.*") From ffa0ed3a8943608c7efb15aeece66d2b22e1a17f Mon Sep 17 00:00:00 2001 From: Abdul K Date: Tue, 12 Dec 2023 14:23:18 -0800 Subject: [PATCH 07/10] Remove custom http module --- library/http_auth.py | 46 -------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 library/http_auth.py diff --git a/library/http_auth.py b/library/http_auth.py deleted file mode 100644 index 9774b452..00000000 --- a/library/http_auth.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/python - -from ansible.module_utils.basic import AnsibleModule -import requests -import os - -def run_module(): - module_args = dict( - url=dict(type='str', required=True), - dest=dict(type='str', required=True), - token=dict(type='str', required=True) - ) - - module = AnsibleModule( - argument_spec=module_args, - supports_check_mode=True - ) - - headers = { - "Authorization": "Bearer {}".format(module.params['token']) - } - - try: - response = requests.get( - module.params['url'], - headers=headers, - ) - response.raise_for_status() - - # Extract filename from URL - filename = os.path.basename(module.params['url']) - - # Join dest directory with filename - file_path = os.path.join(module.params['dest'], filename) - - with open(file_path, 'wb') as f: - for chunk in response.iter_content(chunk_size=8192): - f.write(chunk) - - except requests.exceptions.RequestException as e: - module.fail_json(msg="Failed to download the file. Error: {}".format(e)) - - module.exit_json(changed=True, dest=file_path) - -if __name__ == '__main__': - run_module() \ No newline at end of file From 6844212a7da577a0a774aedbd0f4706aed327436 Mon Sep 17 00:00:00 2001 From: Olivia Yan Date: Thu, 11 Jan 2024 15:37:56 -0500 Subject: [PATCH 08/10] INFRA-41600: Add restart after setting management port to make it effective --- roles/splunk_common/tasks/set_mgmt_port.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/splunk_common/tasks/set_mgmt_port.yml b/roles/splunk_common/tasks/set_mgmt_port.yml index 20f5e2a8..cfc9cd14 100644 --- a/roles/splunk_common/tasks/set_mgmt_port.yml +++ b/roles/splunk_common/tasks/set_mgmt_port.yml @@ -9,3 +9,8 @@ group: "{{ splunk.group }}" when: - "'svc_port' in splunk" + register: set_mgmt_port + +# Restart only when Splunk is running and when any of the above have changed +- include_tasks: ../handlers/restart_splunk.yml + when: set_mgmt_port is changed From 6cda152107c6efe68702f5f8a04d52ca1ab656f9 Mon Sep 17 00:00:00 2001 From: Aditya Pingle Date: Mon, 22 Jan 2024 12:58:25 -0800 Subject: [PATCH 09/10] updated docs for 9.1.3 release; --- docs/CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 70cc7cbf..1ca7ba09 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changelog ## Navigation +* [9.1.3](#913) * [9.1.2](#912) * [9.1.1](#911) * [9.1.0.2](#9102) @@ -80,6 +81,14 @@ --- +## 9.1.3 + +#### Changes +* Support for latest major Splunk release +* Documentation updates + +--- + ## 9.1.2 #### Changes From abd7cc5a072909b672eb6b0ed196b7f649aaa14f Mon Sep 17 00:00:00 2001 From: Aditya Pingle Date: Mon, 22 Jan 2024 13:12:29 -0800 Subject: [PATCH 10/10] updated docs for 9.0.8 release; --- docs/CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 70cc7cbf..54f6461b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,6 +5,7 @@ * [9.1.1](#911) * [9.1.0.2](#9102) * [9.1.0.1](#9101) +* [9.0.8](#908) * [9.0.7](#907) * [9.0.6](#906) * [9.0.5.1](#9051) @@ -112,6 +113,14 @@ --- +## 9.0.8 + +#### Changes +* Support for latest major Splunk release +* Documentation updates + +--- + ## 9.0.7 #### Changes