Ansible Homebrew
- Ansible Homebrew Interview
- Ansible Homebrew Pro
- Brew Install Ansible Specific Version
- Ansible Package Module
Windows Podman is a tool for running Linux containers. You can do this from a Windows desktop as long as you have access to a linux box either running inside of a VM on the host, or available via the network. Jeff Geerling (geerlingguy) maintains a large variety of open source Ansible content. This website catalogs it all. About Jeff Geerling (geerlingguy) Jeff Geerling is an author and software developer from St. He started using Ansible in 2013 and maintains numerous Ansible works. Ansible将会对远程系统模块参数记录在远程的syslog中,除非一个任务或者play被标记了“nolog: True”属性,稍后解释. 在主控机上启用基本的日志功能参见 Ansible的配置文件 文档 并 在配置文件中设置’logpath’.企业用户可能也对 Ansible Tower 感兴趣. Unmaintained Ansible versions can contain unfixed security vulnerabilities (CVE). Please upgrade to a maintained version. See the latest Ansible documentation. Homebrewcask - Install/uninstall homebrew.
As mentioned in my first post, I’d like to try and build a Linux machine with Jenkins, GIT, Maven, Java and Docker.The end goal is to run Selenium WebDriver tests in dockerised containers. I have a lot to learn but I feel this is an area I need to grow my skill set.Also, as I work in test, I am also learning to use test-kitchen to execute infrastructure code.
The book I am learning from is Ansible From Beginner to Pro.I did encounter a few problems whilst following the book as versions of libraries have changed but I’ve managed to get past these errors so far.
This tutorial and the next few to follow have been completed on a Mac with OSX El Capitan. The steps on a Windows machine are likely to be different.
Goals
In this tutorial, we will:
- Install VirtualBox
- Install Vagrant
- Install Ansible
- Check it all works
Introduction
VirtualBox
Virtualisation allows multiple operating systems to simultaneously share your processor resources in a safe and efficient manner.VirtualBox is a provider for virtualisation and it allows your operating system to run in a special guest environment on top of your existing host operating system.In my case, the host operating system is OSX El Capitan.
Vagrant
Vagrant is an open source software for creating a portable development environment within minutes. It is useful for adevelopment team to mimic a server’s configuration locally. It can also be useful fortesting a version of Internet Explorer on a Mac for example.
Ansible
Ansible is a provisioning framework used to deploy software in a consistent manner in one or more machines.It ensures each machine is working with an identical environment.
Note:
I have used Homebrew to install the above mentioned software.Homebrew is a package managment system thatsimplifies the installation of software on the Mac operating system.
To install Homebrew, just follow the simple instructions on their website.
Step 1 - Install VirtualBox
In terminal, type in the following command
brew cask install VirtualBox
Step 2 - Install Vagrant
In terminal, type in the following command
brew cask install vagrant
Step 3 - Install Ansible
In terminal, type in the following command
brew install ansible
Step 4 - Check Installations were Successful
Type in the following commands and if the version is printed, then the installation was successful.
VBoxManage --version
vagrant --version
ansible --version
My versions respectively are:
5.2.6r120293
Vagrant 2.0.1
ansible 2.4.2.0
Step 5 - Install an Ubuntu Server with Vagrant
Before we start using Ansible, we’ll need an environment which we can use to develop our new infrastructure. This is where we use Vagrant.
a. Create a new directory which will contain all your virtual machine installations. I normally put all my projects under a directory called development.Create a directory called virtualmachines and inside this create a directory called ansible-playbook:
mkdir virtualmachines && cd virtualmachines
mkdir ansible-playbook && cd ansible-playbook
On my machine, the full path looks like this:
/Users/pateli03/development/virtualmachines/ansible-playbook
b. To create the virtual machine on which you’re going to install packages and configure with Ansible, run this command:
vagrant init ubuntu/trusty64
This will create a file called Vagrantfile. We will be editing this file in Step 6 but this is what the contents of the file should look like (but with a lot more comments):
c. Finally, get Ubuntu Trusty up and running by executing:
vagrant up
When you execute this command the first time, a few things happen. First, it will check if a box with the name ubuntu/trusty64exists on your machine. If it doesn’t, it will download it from Atlas, a platform to host and discover Vagrant boxes.It is maintained by HashiCorp, the team behind Vagrant.
This could take a few minutes as this is downloading an entire operating system.
- Once downloaded, Vagrant uses VirtualBox to create a virtual machine and boot it.
You can check the status of this virtual machine by running the command:
vagrant status
You can also log in to the machine using:
vagrant ssh
This logs in to the machine using a known SSH key that was generated when the virtual machine was created.
To logout of this machine you can use the command exit
Step 6 - Hello Ansible
We need to let Vagrant know that we want to run Ansible on this virtual machine by adding some instructionsto the Vagrantfile. Go ahead and open the Vagrantfile in your favourite text editor but I recommend using Vim
which isa text editor on Unix-like operating system. Vim has recently become important in my day-to-day life so it is another toolI would like to be more fluent in.
Open your Vagrantfile using this command:
vim Vagrantfile
Press i
on your keyboard to insert text. You will see the bottom of the terminal window change to -- INSERT --
before the last end statement, add the following configuration:
It should look similar to this:
To save the changes:
press ESC
on the keyboard to come back to command mode
then Shift
+ :
then w
+ q
then Enter
to finish saving your changes.
(Note: Don’t enter the + symbol)
Step 7 - Creating the playbook
An Ansible playbook is a YAML file which contains a set of instructions to manage the configuration of remote machines.We will create a playbook now as using the same path specified in our Vagrantfile above – in a directory called provisioning.
mkdir provisioning && cd provisioning
touch playbook.yml
vim playbook.yml
press i
on the keyboard to insert text
Copy and paste the below configuration code which will ping you virtual machine to confirm you can connect to it.
I’ll go into more detail on the configuration format in subsequent posts but be aware YAML syntax is whitespace sensitive.Tabs and whitespaces mean different things. YAML uses spaces and the suggested indentation is 2 spaces.
To save the changes:
press ESC
on the keyboard to come back to command mode
then Shift
+ :
then w
+ q
then Enter
to finish saving your changes.
Step 8 - Running the playbook
You should now be able to run Ansible on your machine. Change directory one level up to the location of your Vagrantfile:
cd ..
Ansible Homebrew Interview
vagrant provision
You should see something quite similar to the image below. Notice the ping task was successfully executed.
Boom! You’ve just provisioned your first virtual machine using Ansible and Vagrant.
Step 9 - Let’s look at VirtualBox
As mentioned earlier, VirtualBox provides us with virtualisation and although it seems like we haven’t done anything with it,let’s have a look. Open the VirtualBox application (You can easily do this with Spotlight - cmd
+ space
and type VirtualBox)
You should have something similar to this:
This is letting us know that Ubuntu Trusty is running properly. Happy days.
Summary
VirtualBox is the software which runs the Operating System and Vagrant acts as a wrapper around VirtualBox to manage it.Together, they can be used to create a local environment that matches your production environment or an environment toexecute Selenium Tests.
With our foundations in place - the next post will focus on using test-kitchen, a test harness used for testing infrastructure codeon isolated platforms. This is quite exciting, a TDD method to design infrastructure.
Commands used in this post
Command | Description |
brew cask install VirtualBox | Installs VirtualBox using Homebrew |
brew cask install vagrant | Installs Vagrant using Homebrew |
brew install ansible | Installs Ansible using Homebrew |
VBoxManage --version | Version of VirtualBox installed |
vagrant --version | Version of Vagrant installed |
ansible --version | Version of Ansible installed |
vagrant init ubuntu/trusty64 | Initialise a virtual machine with Ubuntu Trusty |
vagrant up | Start a virtual machine |
vagrant status | Status of virtual machine |
vagrant ssh | SSH into the virtual machine |
vagrant provision | Run a playbook to provision the virtual machine |
vim Vagrantfile | Open a file called Vagrantfile with Vim text editor |
touch playbook.yml | Create a new file called playbook.yml |
Ansible Homebrew Pro
Jeff Geerling (geerlingguy) maintains a large variety of open source Ansible content. This website catalogs it all.
About Jeff Geerling (geerlingguy)
Jeff Geerling is an author and software developer from St. Louis, MO. He started using Ansible in 2013 and maintains numerous Ansible works.
Ansible Books
Ansible for DevOps | Ansible for Kubernetes |
Project Maintenance Status
I maintain over 250 open source projects and two bestselling books, and without some level of automation (and maybe a little sleep from time to time), it would be impossible for me to keep all the projects relevant.
I use a stale issue bot to clean up repository issues and PRs, and I also sometimes informally put a project into ‘maintenance only’ mode. That is indicated in the listings below using the following conventions:
Icon | Description |
---|---|
✓ | Actively used and maintained. |
! | Maintenance and bugfixes only. |
✗ | Not maintained. |
Table of Contents
Ansible-based Operators
Brew Install Ansible Specific Version
Name | Test Status | Maintained? | Repository |
---|---|---|---|
Drupal Operator | ✓ | GitHub | |
MariaDB Operator | ✓ | GitHub | |
Mcrouter Operator | ! | GitHub | |
Ansible Tower/AWX Operator | ✗ | GitHub |
Container Images Built with Ansible
Name | Test Status | Maintained? | Repository |
---|---|---|---|
geerlingguy/drupal | ✓ | GitHub | |
geerlingguy/fathom | ✓ | GitHub | |
geerlingguy/php-apache | ✓ | GitHub | |
geerlingguy/solr | ✓ | GitHub |
Container Images for Ansible Testing
Name | Test Status | Maintained? | Repository |
---|---|---|---|
geerlingguy/docker-ubuntu2004-ansible | ✓ | GitHub | |
geerlingguy/docker-ubuntu1804-ansible | ✓ | GitHub | |
geerlingguy/docker-ubuntu1604-ansible | ✓ | GitHub | |
geerlingguy/docker-ubuntu1404-ansible | ✗ | GitHub | |
geerlingguy/docker-ubuntu1204-ansible | ✗ | GitHub | |
geerlingguy/docker-centos8-ansible | ✓ | GitHub | |
geerlingguy/docker-centos7-ansible | ✓ | GitHub | |
geerlingguy/docker-centos6-ansible | ✓ | GitHub | |
geerlingguy/docker-debian10-ansible | ✓ | GitHub | |
geerlingguy/docker-debian9-ansible | ✓ | GitHub | |
geerlingguy/docker-debian8-ansible | ✗ | GitHub | |
geerlingguy/docker-ubi8-ansible | ✓ | GitHub | |
geerlingguy/docker-amazonlinux2-ansible | ✓ | GitHub | |
geerlingguy/docker-fedora33-ansible | ✓ | GitHub | |
geerlingguy/docker-fedora32-ansible | ✓ | GitHub | |
geerlingguy/docker-fedora31-ansible | ✓ | GitHub | |
geerlingguy/docker-fedora30-ansible | ✓ | GitHub | |
geerlingguy/docker-fedora29-ansible | ✗ | GitHub | |
geerlingguy/docker-fedora27-ansible | ✗ | GitHub | |
geerlingguy/docker-fedora24-ansible | ✗ | GitHub |
See also: Testing your roles with Molecule
Ansible Collections
Ansible Package Module
Name | Test Status | Maintained? | Repository |
---|---|---|---|
geerlingguy.k8s | ✓ | GitHub | |
geerlingguy.php_roles | ✓ | GitHub |
Ansible Roles
Name | Test Status | Maintained? | Repository |
---|---|---|---|
geerlingguy.adminer | ✓ | GitHub | |
geerlingguy.ansible | ✓ | GitHub | |
geerlingguy.apache | ✓ | GitHub | |
geerlingguy.apache-php-fpm | ✓ | GitHub | |
geerlingguy.aws-inspector | ✓ | GitHub | |
geerlingguy.awx | ✓ | GitHub | |
geerlingguy.backup | ✓ | GitHub | |
geerlingguy.bad_judgement | ✓ | GitHub | |
geerlingguy.blackfire | ✓ | GitHub | |
geerlingguy.certbot | ✓ | GitHub | |
geerlingguy.clamav | ✓ | GitHub | |
geerlingguy.collectd-signalfx | ✓ | GitHub | |
geerlingguy.composer | ✓ | GitHub | |
geerlingguy.daemonize | ✓ | GitHub | |
geerlingguy.docker | ✓ | GitHub | |
geerlingguy.docker_arm | ✓ | GitHub | |
geerlingguy.dotfiles | ✓ | GitHub | |
geerlingguy.drupal | ✓ | GitHub | |
geerlingguy.drush | ✓ | GitHub | |
geerlingguy.ecr_container_build | ✓ | GitHub | |
geerlingguy.elasticsearch | ✓ | GitHub | |
geerlingguy.elasticsearch-curator | ✓ | GitHub | |
geerlingguy.exim | ✓ | GitHub | |
geerlingguy.fathom | ✓ | GitHub | |
geerlingguy.filebeat | ✓ | GitHub | |
geerlingguy.firewall | ✓ | GitHub | |
geerlingguy.fluentd | ✓ | GitHub | |
geerlingguy.git | ✓ | GitHub | |
geerlingguy.github-users | ✓ | GitHub | |
geerlingguy.gitlab | ✓ | GitHub | |
geerlingguy.glusterfs | ✓ | GitHub | |
geerlingguy.gogs | ✓ | GitHub | |
geerlingguy.haproxy | ✓ | GitHub | |
geerlingguy.hdparm | ✓ | GitHub | |
geerlingguy.helm | ✓ | GitHub | |
geerlingguy.homebrew | ✓ | GitHub | |
geerlingguy.htpasswd | ✓ | GitHub | |
geerlingguy.java | ✓ | GitHub | |
geerlingguy.jenkins | ✓ | GitHub | |
geerlingguy.k8s_manifests | ✓ | GitHub | |
geerlingguy.kibana | ✓ | GitHub | |
geerlingguy.kubernetes | ✓ | GitHub | |
geerlingguy.logstash | ✓ | GitHub | |
geerlingguy.mailhog | ✓ | GitHub | |
geerlingguy.mas | ✓ | GitHub | |
geerlingguy.memcached | ✓ | GitHub | |
geerlingguy.munin | ✓ | GitHub | |
geerlingguy.munin-node | ✓ | GitHub | |
geerlingguy.mysql | ✓ | GitHub | |
geerlingguy.nfs | ✓ | GitHub | |
geerlingguy.nginx | ✓ | GitHub | |
geerlingguy.nodejs | ✓ | GitHub | |
geerlingguy.ntp | ✓ | GitHub | |
geerlingguy.packer | ✓ | GitHub | |
geerlingguy.packer-debian | ✓ | GitHub | |
geerlingguy.packer_rhel | ✓ | GitHub | |
geerlingguy.passenger | ✓ | GitHub | |
geerlingguy.php | ✓ | GitHub | |
geerlingguy.php-memcached | ✓ | GitHub | |
geerlingguy.phpmyadmin | ✓ | GitHub | |
geerlingguy.php-mysql | ✓ | GitHub | |
geerlingguy.php-pear | ✓ | GitHub | |
geerlingguy.php-pecl | ✓ | GitHub | |
geerlingguy.php-pgsql | ✓ | GitHub | |
geerlingguy.php-redis | ✓ | GitHub | |
geerlingguy.php-tideways | ✓ | GitHub | |
geerlingguy.php-versions | ✓ | GitHub | |
geerlingguy.php-xdebug | ✓ | GitHub | |
geerlingguy.php-xhprof | ✓ | GitHub | |
geerlingguy.pimpmylog | ✓ | GitHub | |
geerlingguy.pip | ✓ | GitHub | |
geerlingguy.postfix | ✓ | GitHub | |
geerlingguy.postgresql | ✓ | GitHub | |
geerlingguy.puppet | ✓ | GitHub | |
geerlingguy.rabbitmq | ✓ | GitHub | |
geerlingguy.raspberry-pi | ✓ | GitHub | |
geerlingguy.redis | ✓ | GitHub | |
geerlingguy.repo-dotdeb | ✓ | GitHub | |
geerlingguy.repo-epel | ✓ | GitHub | |
geerlingguy.repo-puias | ✓ | GitHub | |
geerlingguy.repo-remi | ✓ | GitHub | |
geerlingguy.ruby | ✓ | GitHub | |
geerlingguy.samba | ✓ | GitHub | |
geerlingguy.security | ✓ | GitHub | |
geerlingguy.solr | ✓ | GitHub | |
geerlingguy.ssh-chroot-jail | ✓ | GitHub | |
geerlingguy.supervisor | ✓ | GitHub | |
geerlingguy.svn | ✓ | GitHub | |
geerlingguy.svn2git | ✓ | GitHub | |
geerlingguy.swap | ✓ | GitHub | |
geerlingguy.varnish | ✓ | GitHub |
Ansible Projects
Name and Link | Test Status | Maintained? |
---|---|---|
Ansible Requirements Updater | N/A | ✓ |
Mac Development Playbook | ✓ | |
Packer Boxes | ✓ | |
Drupal VM | ✓ | |
Raspberry Pi Dramble | ✓ | |
Drupal Pi | ✓ | |
Turing Pi Cluster | ! | |
Ansible Vagrant Examples | N/A | ! |
Also see all my blog posts about Ansible and all my YouTube videos about Ansible.
Ansible Videos and Presentations
Place and Date | Title |
---|---|
YouTube April 2020 | Ansible 101 streaming series |
DrupalCon Seattle 2019 November 26, 2019 | Everything I know about Kubernetes I learned from a cluster of Raspberry Pis |
AnsibleFest Atlanta 2019 September 25, 2019 | There’s a Role for that! How to evaluate community roles for your playbook |
AnsibleFest Austin 2018 August 21, 2018 | Make your Ansible playbooks flexible, maintainable, and scalable |
MidCamp 2018 March 10, 2018 | Jenkins or: How I learned to stop worrying and love automation |
AnsibleFest SF 2016 July 28, 2016 | Ansible Roles for Fun and Profit! |
php[tek] 2016 May 25, 2016 | Highly Available Drupal on a Raspberry Pi Cluster |
YouTube July 27, 2015 | Nginx Load Balancer Visualization on a Cluster of Raspberry Pis |
YouTube July 14, 2015 | Ansible 101 on a Cluster of Raspberry Pi 2s |
MidCamp 2015 March 21, 2015 | Ansible + Drupal: A Fortuitous DevOps Match |
YouTube March 8, 2015 | Ansible serial/forks demo on a Cluster of Raspberry Pis |
DrupalCon Austin June 5, 2014 | DevOps for Humans: Ansible for Drupal Deployment Victory! |
Meetup January 14, 2014 | Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible |
Inspiration
This site was inspired by Robert de Bock’s similar Ansible roles site.
You can view this site's source on GitHub. It is hosted on GitHub Pages and uses a theme by mattgraham.