Merge pull request #2 from luther38/windows-testing

Windows testing
This commit is contained in:
James Tombleson 2019-04-17 07:47:47 -07:00 committed by GitHub
commit 60bebe92df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 21 deletions

View File

@ -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
```
ansible linux -i hosts -m ping
```
### Testing Windows devices
```bash
ansible windows -i hosts -m win_ping
```

37
configssh.sh Executable file
View File

@ -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

View File

@ -5,6 +5,8 @@
ansible_user=ansible
ansible_connection=ssh
ansible_password=
ansible_become_method=sudo
ansible_become_pass=
[windows]
192.168.0.2

View File

@ -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:

View File

@ -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