When Vagrant sets up a virtual machine it will set up a port on your local machine that you can use to connect to the box via SSH. By default this is usually port 2222, which Vagrant maps to port 22 on the virtual machine. All this is essentially transparent so that when you type vagrant ssh you connect to the box without any problems. Vagrant handles all of the port matching and key finding behind the scenes.
The City University London campus was the venue for Drupalcamp London 2014 and I went along for the weekend as a delegate. This was the first conference for a while where I wasn’t helping out, speaking, or organising in some form so it was good to just turn up and relax. I travelled down on the Friday night from Manchester and successfully booked into my Airbnb room.
New in PHP 5.5 is a group of functions that deal with password hashing and verification. This is such a common thing for PHP applications to do that it was decided to include it into the core of PHP. They effectively solve the problem of hashing and comparing passwords that just about every PHP developer has implemented at one point or another.
There are only a few functions available but they provide all of the functionality needed to create a hash value from a password, check if the hash is valid and to check if the password hash needs to be recreated.
Many systems and applications require certain access to certain ports and protocols. When installing these systems using Ansible it is necessary to also open up the needed ports so that the systems can function correctly. As there is no iptables module in Ansible the shell command is needed to add the iptables rules.
As an example, here is a task that adds a iptables rule to allow Apache to communicate on port 80.
When setting up a server for the first time with Ansible you will need to pass ssh credentials to Ansible directly to set up ssh keys. This is done by the use of the sshpass program which allows Ansible to pass your user credentials directly to ssh in order to open a connection to the server. The sshpass program is easily installed on Linux systems with the apt or yum package managers, but on OSX you will need to install it manually.
When navigating around a Linux box I tend to find I use the same two commands a lot. The first is 'cd' to change a directory, and the second is 'ls' in order to see what is in the new directory. Rather than do this over and over again I decided to look around for a good solution to automate this.
It is best practice to use Ansible with SSH keys in order to create the SSH connections to the servers. This does require a little bit of extra setup before hand in order to ensure that the server can be reached by Ansible via SSH keys alone. As I have been doing this quite a lot recently I decided to package the setup steps into an Ansible playbook.
Vagrant is a tool that allows the easy creation of virtual machines. It was originally developed for use with VirtualBox, but it has been extended to allow integration with other virtualisation tools. Using Vagrant you can create a particular setup that you can then share with other people without having to give them large virtual disk images.
Ansible is a automation and provisioning tool that makes it easy to configure systems with the needed software, configuration options and even content. It is a command line tool, written in Python, that uses SSH connections to run these actions. This means that all you need to do is have a viable SSH connection to a machine and Ansible will run any actions you want to run. Ansible can either run single commands or use what is called a playbook to run several commands. Ansible playbooks are written in YAML, which makes understanding them quite easy.