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
*.retry
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# 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.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# dotenv
.env
# virtualenv
.venv
venv/
ENV/
# Spyder project settings
.spyderproject
# Rope project settings
.ropeproject
# Files directory
files/*
!files/.gitkeep
# ---> Ansible
*.retry
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# 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.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# dotenv
.env
# virtualenv
.venv
venv/
ENV/
# Spyder project settings
.spyderproject
# Rope project settings
.ropeproject
# Files directory
files/*
!files/.gitkeep
# Inventory directory
inventory/*
!inventory/.gitkeep

16
LICENSE
View File

@@ -1,9 +1,9 @@
MIT License
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
MIT License
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:
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.

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

0
inventory/.gitkeep Normal file
View File

View File

@@ -1,51 +1,49 @@
---
- 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: install splunk binary
tags:
- install
unarchive:
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
---
- 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
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: install splunk binary
tags:
- install
unarchive:
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