Project Restructure

This commit is contained in:
2022-10-31 16:08:42 +13:00
parent 2f785fcf6a
commit 3ab2cd4c89
12 changed files with 226 additions and 227 deletions

208
.gitignore vendored
View File

@@ -1,102 +1,106 @@
# ---> Ansible # ---> Ansible
*.retry *.retry
# ---> Python # ---> Python
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
*$py.class *$py.class
# C extensions # C extensions
*.so *.so
# Distribution / packaging # Distribution / packaging
.Python .Python
env/ env/
build/ build/
develop-eggs/ develop-eggs/
dist/ dist/
downloads/ downloads/
eggs/ eggs/
.eggs/ .eggs/
lib/ lib/
lib64/ lib64/
parts/ parts/
sdist/ sdist/
var/ var/
wheels/ wheels/
*.egg-info/ *.egg-info/
.installed.cfg .installed.cfg
*.egg *.egg
# PyInstaller # PyInstaller
# Usually these files are written by a python script from a template # Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it. # before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest *.manifest
*.spec *.spec
# Installer logs # Installer logs
pip-log.txt pip-log.txt
pip-delete-this-directory.txt pip-delete-this-directory.txt
# Unit test / coverage reports # Unit test / coverage reports
htmlcov/ htmlcov/
.tox/ .tox/
.coverage .coverage
.coverage.* .coverage.*
.cache .cache
nosetests.xml nosetests.xml
coverage.xml coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
# Translations # Translations
*.mo *.mo
*.pot *.pot
# Django stuff: # Django stuff:
*.log *.log
local_settings.py local_settings.py
# Flask stuff: # Flask stuff:
instance/ instance/
.webassets-cache .webassets-cache
# Scrapy stuff: # Scrapy stuff:
.scrapy .scrapy
# Sphinx documentation # Sphinx documentation
docs/_build/ docs/_build/
# PyBuilder # PyBuilder
target/ target/
# Jupyter Notebook # Jupyter Notebook
.ipynb_checkpoints .ipynb_checkpoints
# pyenv # pyenv
.python-version .python-version
# celery beat schedule file # celery beat schedule file
celerybeat-schedule celerybeat-schedule
# SageMath parsed files # SageMath parsed files
*.sage.py *.sage.py
# dotenv # dotenv
.env .env
# virtualenv # virtualenv
.venv .venv
venv/ venv/
ENV/ ENV/
# Spyder project settings # Spyder project settings
.spyderproject .spyderproject
# Rope project settings # Rope project settings
.ropeproject .ropeproject
# Files directory # Files directory
files/* files/*
!files/.gitkeep !files/.gitkeep
# Inventory directory
inventory/*
!inventory/.gitkeep

16
LICENSE
View File

@@ -1,9 +1,9 @@
MIT License MIT License
Copyright (c) <year> <copyright holders> Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,3 +1,3 @@
# ansible-playbook-splunk-upgrade # ansible-playbook-splunk-upgrade
This repository contains the playbook contents for completion of a Splunk upgrade. Distributed environments supported This repository contains the playbook contents for completion of a Splunk upgrade. Distributed environments supported

View File

@@ -1,8 +1,7 @@
--- ---
- name: Upgrade the Indexer Master - name: Upgrade the Indexer Master
hosts: index-cluster-masters hosts: index-cluster-masters
become: true handlers:
handlers: - import_tasks: handlers/splunk.yml
- import_tasks: handlers/splunk.yml tasks:
tasks: - import_tasks: tasks/common.yml
- import_tasks: tasks/common.yml

View File

@@ -1,8 +1,7 @@
--- ---
- name: Upgrade the Deployment Server - name: Upgrade the Deployment Server
hosts: deployment-servers hosts: deployment-servers
become: true handlers:
handlers: - import_tasks: handlers/splunk.yml
- import_tasks: handlers/splunk.yml tasks:
tasks: - import_tasks: tasks/common.yml
- import_tasks: tasks/common.yml

View File

@@ -1,13 +1,13 @@
--- ---
# Upgrade License Master # Upgrade License Master
- import_playbook: cluster-master.yml - import_playbook: cluster-master.yml
# Upgrade Deployment Server # Upgrade Deployment Server
- import_playbook: deployment-server.yml - import_playbook: deployment-server.yml
# Upgrade Searchhead Deployer/s # Upgrade Searchhead Deployer/s
- import_playbook: searchhead-deployer.yml - import_playbook: searchhead-deployer.yml
# Heavyweight Forwarder/s # Heavyweight Forwarder/s
- import_playbook: heavyweight-forwarders.yml - import_playbook: heavyweight-forwarders.yml
# Upgrade the Searchead Tier # Upgrade the Searchead Tier
- import_playbook: searchheads.yml - import_playbook: searchheads.yml
# Upgrade the Indexer Tier # Upgrade the Indexer Tier
- import_playbook: indexers.yml - import_playbook: indexers.yml

View File

@@ -1,7 +1,7 @@
--- ---
# Automagically included by ansible for all inventory # Automagically included by ansible for all inventory
splunk_user: splunk splunk_user: splunk
splunk_home: /opt/splunk splunk_home: /opt/splunk
splunk_archive: splunk-7.2.0-8c86330ac18-Linux-x86_64.tgz splunk_archive: splunk-8.2.0-e053ef3c985f-Linux-x86_64.tgz
# Manifest splunk will install upon upgrade. # Manifest splunk will install upon upgrade.
splunk_manifest: splunk-7.2.0-8c86330ac18-linux-2.6-x86_64-manifest splunk_manifest: splunk-8.2.0-e053ef3c985f-linux-2.6-x86_64-manifest

View File

@@ -1,12 +1,12 @@
--- ---
- name: Stop Splunk - name: Stop Splunk
command: /opt/splunk/bin/splunk stop command: /opt/splunk/bin/splunk stop
become_user: splunk become_user: splunk
- name: Start Splunk - name: Start Splunk
command: /opt/splunk/bin/splunk start command: /opt/splunk/bin/splunk start
become_user: splunk become_user: splunk
- name: Start Splunk (No Warning) - name: Start Splunk (No Warning)
command: /opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt command: /opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt
become_user: splunk become_user: splunk

View File

@@ -1,8 +1,7 @@
--- ---
- name: Upgrade the Heavyweights - name: Upgrade the Heavyweights
hosts: heavyweight-forwarders hosts: heavyweight-forwarders
become: true handlers:
handlers: - import_tasks: handlers/splunk.yml
- import_tasks: handlers/splunk.yml tasks:
tasks: - import_tasks: tasks/common.yml
- import_tasks: tasks/common.yml

View File

@@ -1,8 +1,8 @@
--- ---
- name: Upgrade the Indexer Cluster - name: Upgrade the Indexer Cluster
hosts: indexers hosts: indexers
become: true become: true
handlers: handlers:
- import_tasks: handlers/splunk.yml - import_tasks: handlers/splunk.yml
tasks: tasks:
- import_tasks: tasks/common.yml - import_tasks: tasks/common.yml

0
inventory/.gitkeep Normal file
View File

View File

@@ -1,51 +1,49 @@
--- ---
- name: checking if splunk is installed - name: checking if splunk is installed
tags: install tags: install
stat: stat:
path: "{{ splunk_home }}" path: "{{ splunk_home }}"
register: splunk_path register: splunk_path
- name: is splunk installed? - name: is splunk installed?
tags: install tags: install
debug: msg='splunk is already installed under /opt/splunk' debug: msg='splunk is already installed under /opt/splunk'
when: splunk_path.stat.exists when: splunk_path.stat.exists
- name: Check if Splunk is already upgraded? - name: Check if Splunk is already upgraded?
stat: stat:
path: /opt/splunk/{{ splunk_manifest }} path: /opt/splunk/{{ splunk_manifest }}
register: splunk_mani register: splunk_mani
when: splunk_path.stat.exists when: splunk_path.stat.exists
- name: Splunk upgraded - name: Splunk upgraded
debug: debug:
msg: Splunk Manifest is already installed! msg: Splunk Manifest is already installed!
when: splunk_mani.stat.exists when: splunk_mani.stat.exists
- name: copy splunk binary - name: copy splunk binary
tags: tags:
- install - install
copy: copy:
src: "{{ splunk_archive }}" src: "{{ splunk_archive }}"
dest: /tmp/splunk dest: /tmp/splunk
owner: root mode: 775
group: root when: splunk_path.stat.exists and not splunk_mani.stat.exists
mode: 775
when: splunk_path.stat.exists and not splunk_mani.stat.exists
- name: Stop Splunk
command: /opt/splunk/bin/splunk stop
- name: Stop Splunk become_user: splunk
command: /opt/splunk/bin/splunk stop when: splunk_path.stat.exists and not splunk_mani.stat.exists
become_user: splunk
when: splunk_path.stat.exists and not splunk_mani.stat.exists - name: install splunk binary
tags:
- name: install splunk binary - install
tags: unarchive:
- install src: "/tmp/splunk/{{ splunk_archive }}"
unarchive: dest: /opt/
src: "/tmp/splunk/{{ splunk_archive }}" owner: "{{ splunk_user }}"
dest: /opt/ group: "{{ splunk_user }}"
owner: "{{ splunk_user }}" remote_src: true
group: "{{ splunk_user }}" notify: Start Splunk (No Warning)
remote_src: true when: splunk_path.stat.exists and not splunk_mani.stat.exists
notify: Start Splunk (No Warning)
when: splunk_path.stat.exists and not splunk_mani.stat.exists