While the workshop should be informative and useful if you can't run Ansible on the day, being able to try commands as we go along will likely aid memory and allow more interaction.
If the instructions below aren't clear, please raise an Issue (or better still a Pull Request) against thse instructions.
- One control node - this can be your laptop
if you're running OS X or Linux. The control node should have the following
installed:
- ansible 2.1
- git
- One target node - this should probably be a fresh VM on your laptop. The accompanying playbooks will run best against Fedora/CentOS/RHEL etc. but require minor tweaks for Debian/Ubuntu etc. The target host should have a local account that you can ssh as without password using SSH keys, and that acount should be able to sudo as root without password.
This is intended for people who are running windows or who want a simple way to create the necessary VMs.
For Windows/Linux on 64 bit CPUs (32 bit CPUs are not supported in this doc at this point, improvement suggestions welcomed)
Most Apple Macs have hardware virtualization on by default, so no action should be required.
- Download and install Virtualbox for your OS from https://www.virtualbox.org/wiki/Downloads
- Download and install vagrant from https://www.vagrantup.com/downloads.html
- Install the vbguest vagrant plugin:
vagrant plugin install vagrant-vbguest
- Fedora:
- Ubuntu:
Download and extract: https://github.com/willthames/devops-singapore-2016/archive/master.zip
From the workshop resources directory (on Windows, Shift+Right Click on a folder will give you an option to open a command prompt in that directory), run:
cd vagrant
vagrant up --provision target
vagrant up --provision control
vagrant reload --provision target
on the command line. (The order here allows the control node to get its ssh key onto the target, before turning off password access on the target node again)
If you see:
The box 'centos/7' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/centos/7"]
Error:
you may need to install Visual C++ runtime (see hashicorp/vagrant#6754)
On windows, if you don't already have a command-line ssh client, download and install git from https://git-scm.com/downloads. When installing, ensure that the 'Git Bash here' option is ticked.
From the workshop resources directory (use Shift + Right click to get Git Bash here on the folder in windows), run:
vagrant ssh control
From the control node, run:
ansible -m ping target
ansible -m command -a whoami -b target
On your control node:
cd workingdir
git clone https://github.com/willthames/devops-singapore-2016
cd devops-singapore-2016/ansible
TARGET=_INSERT_IP_ADDRESS_OF_TARGET_HOST_HERE_
USER=_INSERT_USERNAME_FOR_TARGET_HOST_HERE_
echo > inventory/target << EOF
[web]
target ansible_host=$TARGET ansible_user=$USER
EOF
Then the following should work
ansible -m ping target
ansible -m command -a whoami -b target