From 95de82c0e6d4371c89ebe4b62b67630621c551ca Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Wed, 17 Apr 2019 08:59:24 -0700 Subject: [PATCH] Moved scripts out of the root Updated installers. --- installAnsible.sh | 28 ------------------- playbook/linux/nagios/deployNagios.yml | 28 +++++++++++++++++++ playbook/linux/nagios/readme.md | 8 ++++++ scripts/installAnsible.sh | 34 +++++++++++++++++++++++ configssh.sh => scripts/installOpenSSH.sh | 1 + scripts/installTerraform.sh | 29 +++++++++++++++++++ 6 files changed, 100 insertions(+), 28 deletions(-) delete mode 100644 installAnsible.sh create mode 100644 playbook/linux/nagios/deployNagios.yml create mode 100644 playbook/linux/nagios/readme.md create mode 100644 scripts/installAnsible.sh rename configssh.sh => scripts/installOpenSSH.sh (90%) create mode 100644 scripts/installTerraform.sh diff --git a/installAnsible.sh b/installAnsible.sh deleted file mode 100644 index 4b94e57..0000000 --- a/installAnsible.sh +++ /dev/null @@ -1,28 +0,0 @@ - -# Shell script to install ansible and other requirements. -# Currently only supports darwin for now. -# Ubuntu installer will be soon - - -if [[ "$OSTYPE" == "darwin"* ]]; then - - echo "OS: Dawriw" - echo "[brew] Intalling Ansible" - brew install ansible - - echo "[pip] Installing WinRM module" - sudo pip install pywinrm - - echo "[pip] Installing Azure module" - sudo pip install 'ansible[azure]' - - echo "[pi] Installing Docker module" - sudo pip install docker - -else - echo "Running on a unsupported OS" - echo "No changes where made" - -fi - - diff --git a/playbook/linux/nagios/deployNagios.yml b/playbook/linux/nagios/deployNagios.yml new file mode 100644 index 0000000..99bfb7b --- /dev/null +++ b/playbook/linux/nagios/deployNagios.yml @@ -0,0 +1,28 @@ +- name: Install Nagios Core + hosts: nagios + + tasks: + - name: Install requrements + apt: + name: {{ packages }} + vars: + packages: + - install + - build-essential + - libgd-dev + - openssl + - libssl-dev + - unzip + - apache2 + + - name: Make Group: Nagios + group: + name: nagios + + + + + + - name: Make User: Nagios + + diff --git a/playbook/linux/nagios/readme.md b/playbook/linux/nagios/readme.md new file mode 100644 index 0000000..f54cf24 --- /dev/null +++ b/playbook/linux/nagios/readme.md @@ -0,0 +1,8 @@ + +# Nagios Playbooks + +This is where all nagios related playbooks will be stored for now. + +## Hosts + +The playbooks will define that 'hosts: nagios' Anything related to nagios configuration and security will be found here. diff --git a/scripts/installAnsible.sh b/scripts/installAnsible.sh new file mode 100644 index 0000000..3111787 --- /dev/null +++ b/scripts/installAnsible.sh @@ -0,0 +1,34 @@ + +# 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 diff --git a/configssh.sh b/scripts/installOpenSSH.sh similarity index 90% rename from configssh.sh rename to scripts/installOpenSSH.sh index 0f5f8bd..c85643d 100755 --- a/configssh.sh +++ b/scripts/installOpenSSH.sh @@ -21,6 +21,7 @@ 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 diff --git a/scripts/installTerraform.sh b/scripts/installTerraform.sh new file mode 100644 index 0000000..98ca892 --- /dev/null +++ b/scripts/installTerraform.sh @@ -0,0 +1,29 @@ + +# 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