To see how we can deploy the code in the ways we talked about in the Software distribution strategy section, we will need an environment, and obviously we are going to create it using Ansible. First of all, to ensure that our roles are properly loaded, we need the ansible.cfg file with the following content:
[defaults] roles_path = roles
Then, we need the playbooks/groups/web.yaml file to allow us to properly bootstrap our web servers:
- hosts: web user: vagrant roles: - common - webserver
As you can imagine from the previous file content, we will need to create the roles common and webserver, which are very similar to the ones we created in Chapter 4, Handling Complex Deployment. We will start with the roles/common/tasks/main.yaml file with the following content. The full code is available on GitHub:
- name: Ensure EPEL is enabled ...