Did some cleanup

Added heartbeat role
moved scripts to LinuxHelpers repo
Moved old config files to the roles for archive.
This commit is contained in:
James Tombleson 2019-05-06 15:50:26 -07:00
parent d369f84902
commit fad12ff06d
23 changed files with 129 additions and 208 deletions

View File

@ -1,56 +0,0 @@
---
# This will install all the client parts needed for elastic to monitor client computers
- name: download metricbeat
win_get_url:
url: '{{ url_metricbeat }}'
dest: 'C:\temp\metricbeat-{{ elastic_version }}.zip'
force: no
- name: unzip heartbeat
win_unzip:
src: c:\temp\metricbeat-{{ elastic_version }}.zip
dest: C:\temp\metricbeat-{{ elastic_version }}\
creates: C:\temp\metricbeat-{{ elastic_version }}\
- name: Copy metricbeat-{{ elastic_version }} folder
win_command: powershell.exe copy-item -Path 'c:\temp\metricbeat-{{ elastic_version }}\metricbeat-{{ elastic_version }}-windows-x86_64\' -Filter * -Recurse -Destination 'C:\Program Files\Metricbeat\'
args:
creates: C:\Program Files\Metricbeat\
- name: Update template
win_template:
src: metricbeat.j2
dest: C:\Program Files\Metricbeat\metricbeat.yml
- name: Check if metricbeat service is installed
register: service_metricbeat
win_service:
name: metricbeat
#- debug: var=service_metricbeat
- name: Install Metricbeat service
win_command: powershell.exe -ExecutionPolicy ByPass -File install-service-metricbeat.ps1
args:
chdir: C:\program files\metricbeat\
when: service_metricbeat.exists == false
- name: check status of metricbeat service
register: service_metricbeat
win_service:
name: metricbeat
#- debug: var=service_metricbeat
- name: restart service
win_service:
name: metricbeat
state: restarted
when: service_metricbeat.state == 'started'
- name: start service
win_service:
name: metricbeat
state: started
when: service_metricbeat.state == 'stopped'

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for luther38.heartbeat

View File

@ -0,0 +1,2 @@
---
# handlers file for luther38.heartbeat

View File

@ -0,0 +1,60 @@
galaxy_info:
author: your name
description: your description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 2.4
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,2 @@
---
# tasks file for luther38.heartbeat

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- luther38.heartbeat

View File

@ -0,0 +1,2 @@
---
# vars file for luther38.heartbeat

View File

@ -0,0 +1,16 @@
---
- name: Install Metricbeat
hosts: elasticClients
tasks:
- name: Install Metricbeat
become: true
include_role:
name: luther38.metricbeat
vars:
kibana_host: 172.20.0.142
elasticsearch_hosts: '["172.20.0.142:9200"]'
systemd_enable_service: true
systemd_restart_service: true

View File

@ -1,11 +0,0 @@
# Script file to enable all of my ansible-pull commands.
# Used for documentation and rebuilding if needed
# Notes
# -o command will only run the playbook when changes take place.
$REPO = 'https://github.com/luther38/ansible.git'
# This pb will tell all linux hosts to configure auto install of security updates
ansible-pull -U REPO -o playbook/linux/auto-securityupdates.yml

View File

@ -1,39 +0,0 @@
# Shell script to install ansible and other requirements.
# Currently only supports darwin for now.
# Ubuntu installer will be soon
# 1.1: Added sudo command and justed the layout
echo "OS: $OSTYPE"
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "[brew] Intalling Ansible"
brew install ansible
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "[sudo] Install Ansible"
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
else
echo "Running on a unsupported OS"
echo "No changes where made"
exit
fi
echo "[pip] Installing WinRM module"
sudo pip install pywinrm
echo "[pip] Installing Azure module"
sudo pip install 'ansible[azure]'
echo "[pip] Installing Docker module"
sudo pip install docker
echo "Installing roles from galaxy.ansible.com"
echo "[galaxy] Nagios Core - Server Side "
ansible-galaxy install networklore.nagios

View File

@ -1,38 +0,0 @@
# This script will do the following
# 1. Install OpenSSH
# 2. Make a user named Ansible
# 3. Give account sudo
# 4. Confirm SSH is active and running
# If you want to change how SSH is configured you will need to update the config by hand. Currently not supported by this script.
# Use of this script is without warranty. Use at your own risk.
echo "Installing OpenSSH Server"
sudo apt-get update
sudo apt-get install openssh-server -y
echo "Going to create user: ansible"
sudo adduser ansible
echo "Giving ansible sudo permissions"
sudo usermod -aG sudo ansible
sudo systemctl status ssh
echo "Install is complete. Test ansible!"
echo "If you want to change the port, check this scripts config on how to"
echo "With the ansible device you will want to connect to this host to get the SSH key from it before testing."
# Edit /etc/ssh/sshd_config
# Uncomment #Port 22
# Change the port number
# Save and Close
# Change the port from commented to uncommented
# If it is already uncommented, this will do nothing.
#sed -i "/#PORT =.*/PORT = $port" ~/cfg
# Change the port to what we want
#sed -i "s/PORT/= .*/= $port" ~/cfg

View File

@ -1,29 +0,0 @@
# This will install Terraform on the device
#1.0 Started to add Terraform to the project
echo "OS: $OSTYPE"
if [[ "$OSTYPE" == "darin"* ]]; then
# I use debian so sudo
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
# Download current release
wget https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip
unzip terraform_0.11.13_linux_amd64.zip
# Remove the zip
rm terraform_0.11.13_linux_amd64.zip
# copy over to bin
sudo cp terraform /bin/terraform
rm terraform
else
echo "You are running on a OS that is not supported by this script at this time."
echo "No changes have been made."
exit
fi

View File

@ -1,35 +0,0 @@
# This will install Vagrant on the device
#1.0 Started to add Vagrant to the project
echo "OS: $OSTYPE"
if [[ "$OSTYPE" == "darin"* ]]; then
# I use debian so sudo
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
# Download current release
wget https://releases.hashicorp.com/vagrant/2.2.4/vagrant_2.2.4_linux_amd64.zip
unzip vagrant_2.2.4_linux_amd64.zip
# Remove the zip
rm vagrant_2.2.4_linux_amd64.zip
# copy over to bin
sudo cp vagrant /usr/bin/vagrant
rm vagrant
echo "Installing VirtualBox 6"
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian cosmic contrib"
sudo apt update
sudo apt install virtualbox-6.0
else
echo "You are running on a OS that is not supported by this script at this time."
echo "No changes have been made."
exit
fi