diff --git a/README.md b/README.md index 27c2995..dd119f8 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,32 @@ # Ansible -First things first, install ansible +Review the installAnsible.sh for quick setup. -```bash -sudo apt-get install ansible -``` +Make sure you run the commands out of this folder so things work as desired. ## Configuration -[doc](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-configuration-settings-locations) - -The configuration file -Changes can be made and used in a configuration file which will be searched for in the following order: - -ANSIBLE_CONFIG (environment variable if set) -ansible.cfg (in the current directory) -~/.ansible.cfg (in the home directory) -/etc/ansible/ansible.cfg +I have a basic configuration file in place at the root of this folder for anisble to find. ## Inventory -The default location for inventory should be placed in /etc/ansible/hosts. But you can always overwrite what inventory file is used with the -i flag +I have a template file in place that should only be used as a refrence. Make a copy of that file and name it hosts then update that file. + +## Testing Inventory -## Cheat Sheet - -Quick notes for ansible via cmd +### Testing Linux devices ```bash -ansible -i \inb -``` \ No newline at end of file +ansible linux -i hosts -m ping +``` + +### Testing Windows devices + +```bash +ansible windows -i hosts -m win_ping +``` + + + diff --git a/configssh.sh b/configssh.sh new file mode 100755 index 0000000..0f5f8bd --- /dev/null +++ b/configssh.sh @@ -0,0 +1,37 @@ +# 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" + +# 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 + diff --git a/hosts.template b/hosts.template index 4db46c5..567e261 100644 --- a/hosts.template +++ b/hosts.template @@ -5,6 +5,8 @@ ansible_user=ansible ansible_connection=ssh ansible_password= +ansible_become_method=sudo +ansible_become_pass= [windows] 192.168.0.2 diff --git a/playbook/linux/InstallPowerShellCore.yml b/playbook/linux/deployPwsh.yml similarity index 94% rename from playbook/linux/InstallPowerShellCore.yml rename to playbook/linux/deployPwsh.yml index 7b1699e..a2f2bf9 100644 --- a/playbook/linux/InstallPowerShellCore.yml +++ b/playbook/linux/deployPwsh.yml @@ -5,11 +5,9 @@ tasks: - name: Check if PowerShell is installed - #register: command_result failed_when: "'Failed' PowerShell is already installed." apt: name: powershell - state: absent - name: Install Microsoft GPG Key get_url: diff --git a/playbook/nagios/deployNagios.yml b/playbook/nagios/deployNagios.yml new file mode 100644 index 0000000..1429c8d --- /dev/null +++ b/playbook/nagios/deployNagios.yml @@ -0,0 +1,25 @@ +- 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 + + + + + - name: Make User: Nagios + +