You've already forked splunk-upgrade
Add tasks to verify install/upgrade state and apply as neccesary
This commit is contained in:
@@ -1,12 +1,51 @@
|
|||||||
---
|
---
|
||||||
|
- name: checking if splunk is installed
|
||||||
|
tags: install
|
||||||
|
stat:
|
||||||
|
path: "{{ splunk_home }}"
|
||||||
|
register: splunk_path
|
||||||
|
|
||||||
|
- name: is splunk installed?
|
||||||
|
tags: install
|
||||||
|
debug: msg='splunk is already installed under /opt/splunk'
|
||||||
|
when: splunk_path.stat.exists
|
||||||
|
|
||||||
|
- name: Check if Splunk is already upgraded?
|
||||||
|
stat:
|
||||||
|
path: /opt/splunk/{{ splunk_manifest }}
|
||||||
|
register: splunk_mani
|
||||||
|
when: splunk_path.stat.exists
|
||||||
|
|
||||||
|
- name: Splunk upgraded
|
||||||
|
debug:
|
||||||
|
msg: Splunk Manifest is already installed!
|
||||||
|
when: splunk_mani.stat.exists
|
||||||
|
|
||||||
|
- name: copy splunk binary
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
copy:
|
||||||
|
src: "{{ splunk_archive }}"
|
||||||
|
dest: /tmp/splunk
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 775
|
||||||
|
when: splunk_path.stat.exists and not splunk_mani.stat.exists
|
||||||
|
|
||||||
|
|
||||||
- name: Stop Splunk
|
- name: Stop Splunk
|
||||||
command: /opt/splunk/bin/splunk stop
|
command: /opt/splunk/bin/splunk stop
|
||||||
become_user: splunk
|
become_user: splunk
|
||||||
|
when: splunk_path.stat.exists and not splunk_mani.stat.exists
|
||||||
|
|
||||||
- name: Upgrade Splunk
|
- name: install splunk binary
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
unarchive:
|
unarchive:
|
||||||
src: "{{ splunk_archive }}"
|
src: "/tmp/splunk/{{ splunk_archive }}"
|
||||||
dest: /opt/splunk
|
dest: /opt/
|
||||||
owner: splunk
|
owner: "{{ splunk_user }}"
|
||||||
group: splunk
|
group: "{{ splunk_user }}"
|
||||||
|
remote_src: true
|
||||||
notify: Start Splunk (No Warning)
|
notify: Start Splunk (No Warning)
|
||||||
|
when: splunk_path.stat.exists and not splunk_mani.stat.exists
|
||||||
|
|||||||
Reference in New Issue
Block a user