My adventure with Ansible.
Go to file
2019-10-20 15:46:43 -07:00
.vscode Starting to get back on the saddle... Looking at getting AWX installed at home so I can use that over something like Jenkins... maybe 2019-10-18 19:27:09 -07:00
docs Updated docs 2019-10-20 15:46:43 -07:00
examples Updated docs 2019-10-20 15:46:43 -07:00
playbook adding docs to the project given I forgot how to use vault. removed sensu as its not getting used currently 2019-10-20 14:51:10 -07:00
roles AWX is now installing on my ubuntu 18.04. Also added a debug playbook to get a copy of all the ansible variables 2019-10-20 12:36:39 -07:00
.gitignore AWX is now installing on my ubuntu 18.04. Also added a debug playbook to get a copy of all the ansible variables 2019-10-20 12:36:39 -07:00
ansible-vars.all Starting to get back on the saddle... Looking at getting AWX installed at home so I can use that over something like Jenkins... maybe 2019-10-18 19:27:09 -07:00
ansible.cfg adding docs to the project given I forgot how to use vault. removed sensu as its not getting used currently 2019-10-20 14:51:10 -07:00
dev.yml Vault is now working 2019-05-16 15:46:19 -07:00
README.md Starting to get back on the saddle... Looking at getting AWX installed at home so I can use that over something like Jenkins... maybe 2019-10-18 19:27:09 -07:00
test.yaml Starting to get back on the saddle... Looking at getting AWX installed at home so I can use that over something like Jenkins... maybe 2019-10-18 19:27:09 -07:00
Vagrantfile Starting to get back on the saddle... Looking at getting AWX installed at home so I can use that over something like Jenkins... maybe 2019-10-18 19:27:09 -07:00

Ansible

This repo contains my configuration and setup for my ansible use. Use at your own risk.

  1. Install Ansible on development device
  2. Clone this repository to work in
  3. Configure devices to remote into
  4. Configure Ansible's Inventory files
  5. Set Vault Secret
  6. Run Connection tests

Installers

New hosts

Linux

wget https://github.com/luther38/Ansible/blob/master/scripts/installAnsible.sh
chmod 777 installAnsible.sh
./installOpenSSH.sh

Windows

$url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
$file = "$env:temp\ConfigureRemotingForAnsible.ps1"
(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
powershell.exe -ExecutionPolicy ByPass -File $file

Configuration

I have a basic configuration file in place at the root of this folder for anisble to find. If you work out of this directory the configuration file will take effect that is loaded.

Inventory

Inventory files have been moved over to .yml format. The ansibe.cfg is looking for ./dev.yml as it's default inventory file. For Prod use make another file that will contain all servers that will be managed.

I have a template file in place that should only be used as a reference. Make a copy of that file and name it hosts then update that file.

The configuration file that is active is looking for a directory that contains all of the inventory files. This way all files can be parted out rather then one big file.

Vault Secret

The configuration file is looking for ./.ansible_vault file to contain the secret for vault entries. Git is already configured to ignore this file. You will need to make this file and place your key in it so ansible can decrypt vaults as needed.

Run the following command and replace secret with your password. Once that is done move on to generating the encrypted strings.

echo 'secret' > ./.ansible_vault

To generate secure strings for the inventory file run the following command.

ansible-vault encrypt_string 'secret'

This will output the value that needs to be placed

Testing Linux devices

ansible linux -i hosts -m ping

Testing Windows devices

ansible windows -i hosts -m win_ping

Unit Testing

Still in the works