Ansible Galaxy and Prebuilt Playbooks

Rather than create our roles from scratch, we’ll use community submitted roles from Ansible Galaxy for use in our playbook. You can think of Ansible Galaxy as a community repository for Ansible Roles. As any person or team is able to contribute, it is important to use curated playbooks that are well-tested. This ensures that you choose one that is maintained and has a good rating among users.

What do I need to get started with Ansible Galaxy?

Only thing you need to get started using Ansible Galaxy is a machine with Ansible installed (referred to as a Control Node). You can learn more about how to install Ansible manually or simply use InMotion’s Ansible Control Node.

Our Ansible Control Node comes free with our Cloud VPS Hosting.

Installing Roles from Ansible Galaxy

Using the ansible-galaxy command you can install roles ad-hoc or use a requirements file to install multiple roles at once. Here are some examples of that using InMotion Hosting’s curated modular Ansible roles.

Ad-hoc:

$ ansible-galaxy install \
      inmotionhosting.apache inmotionhosting.mysql inmotionhosting.php_fpm

Using a Requirements file:

In your requirements.yml :

---
- src: inmotionhosting.apache
- src: inmotionhosting.mysql
- src: inmotionhosting.php_fpm

Then simply run:

$ ansible-galaxy install -r requirements.yml

Using Roles from Ansible Galaxy

Using the roles we installed earlier, let’s incorporate them into a playbook:

# site.yml
- name: Deploy a LAMP stack
  hosts: lamp
  roles:
    - role: inmotionhosting.apache
    - role: inmotionhosting.mysql
    - role: inmotionhosting.php_fpm

Learn more about how to create an Ansible Playbook.

IC
InMotion Hosting Contributor Content Writer II

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+