From 59f54f8e3b6f3d5374ee134bbf0ac0fb82895397 Mon Sep 17 00:00:00 2001 From: JocelynPa Date: Wed, 5 Apr 2023 10:05:01 +0200 Subject: [PATCH] Add task for update splunk --- Update_Splunk.yml | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Update_Splunk.yml b/Update_Splunk.yml index 93b0e03..02dc2f6 100644 --- a/Update_Splunk.yml +++ b/Update_Splunk.yml @@ -6,6 +6,11 @@ splunk_version: "9.0.4.1-419ad9369127-Linux-x86_64" tasks: + + - name: Sauvegarder la configuration des indexeurs + command: "{{ splunk_home }}/bin/splunk cmd btool --debug > {{ backup_dir }}/btool_{{ inventory_hostname }}.txt" + run_once: yes + - name: Arrêter le service Splunk systemd: name: splunk @@ -16,6 +21,28 @@ src: "/tmp/splunk-{{ splunk_version }}.tgz" dest: "/opt" remote_src: yes + creates: "{{ splunk_home }}/etc/system/local/.upgrade_marker" + when: inventory_hostname == groups['all:!splunk_uf_Linux:!splunk_uf_windows'][0] + + - name: Attribution des droits + shell: "chown -R splunk:splunk /opt/splunk/*" + + - name: Attendre que la mise à jour soit appliquée à tous les indexeurs + wait_for: + path: "{{ splunk_home }}/etc/system/local/.upgrade_marker" + state: present + when: inventory_hostname != groups['all:!splunk_uf_Linux:!splunk_uf_windows'][0] + + - name: Vérifier l'état du cluster + command: "{{ splunk_home }}/bin/splunk show cluster-status" + register: cluster_status + ignore_errors: true + run_once: yes + + - name: Afficher l'état du cluster + debug: + var: cluster_status.stdout_lines + run_once: yes - name: Desactiver le démarrage automatique shell: "/opt/splunk/bin/splunk disable boot-start" @@ -28,9 +55,6 @@ - /etc/init.d/splunk - /etc/systemd/system/splunk.service - - name: Attribution des droits - shell: "chown -R splunk:splunk /opt/splunk/*" - - name: Redémarrer le serveur reboot: pre_reboot_delay: 0