diff --git a/tasks/common.yml b/tasks/common.yml index e3aaf07..f27161c 100644 --- a/tasks/common.yml +++ b/tasks/common.yml @@ -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 command: /opt/splunk/bin/splunk stop become_user: splunk + when: splunk_path.stat.exists and not splunk_mani.stat.exists -- name: Upgrade Splunk +- name: install splunk binary + tags: + - install unarchive: - src: "{{ splunk_archive }}" - dest: /opt/splunk - owner: splunk - group: splunk + src: "/tmp/splunk/{{ splunk_archive }}" + dest: /opt/ + owner: "{{ splunk_user }}" + group: "{{ splunk_user }}" + remote_src: true notify: Start Splunk (No Warning) + when: splunk_path.stat.exists and not splunk_mani.stat.exists