
Now that we have a clear view on what we will be testing, it’s time to put things into practice. Is your role built in an idempotent way? This means that a second run cannot create new changes.Does your role run through all tasks without failing?.Is the YAML syntax of my role correct? Even though writing YAML is easy, everyone makes typos once in a while.Our Ansible role will have the following structure:Įrlang_ppa_repo: 'deb How to Determine What to Testīefore we continue working on the content of the test directory, let’s take some time to define what exactly we want to test. Instead, you can create one role and target multiple OSes. You don’t want to write OS-specific roles. Erlang Solutions offer a variety of packages, targeting multiple OSes. Take, for instance, our example role for installing the Erlang language. Targeting Multiple OSesĪn Ansible role can target multiple OSes. As the Unix philosophy states: do one thing, and do it well. This is where Ansible roles come in.Īn Ansible role is a collection of tasks that need to be performed to achieve a certain outcome.Īs a best practice, you want your role to focus on only one thing. As a developer or system engineer, you want to be able to re-use your code.

However, that’s not where its true power lies. The simplest usage is sending ad-hoc commands or one big playbook to (multiple) nodes. Ansible then uses YAML to express reusable descriptions of systems. Ansible and Ansible RolesĪnsible is a configuration management tool written in Python that allows you to manage nodes over SSH or PowerShell. If you’re not familiar with Docker and would like to read more on the subject, head over to the Docker website, and dig into the documentation.

This guarantees that your code will always run the same way, regardless of the environment in which it is running.ĭocker allows you to run all major Linux distributions with support for every infrastructure. Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. Docker Containersĭocker is all about making it easier to create, deploy, and run applications using containers. In this article, we will use the Ansible roles and tests we developed in the previous article, and walk you through the necessary steps to set up a Docker environment and test your Ansible roles against multiple operating systems on Semaphore. Docker allows you to easily create and run containers in any operating system. This is great when you are targeting the same operating system as your continuous integration server, but what to do if you you need to target other operating systems as well? This is where Docker comes into play. In a previous article, we wrote about testing Ansible roles directly against Semaphore.
