By clicking or navigating this website site, you agree to allow our collection of information on Scaleway to offer you an optimal user experience and to keep track of statistics through cookies. Learn more about our Cookie Policy.

Getting Started with Ansible Galaxy

Ansible Galaxy Overview

The idea behind Galaxy is to give greater visibility to one of Ansible’s most exciting features: reusable Roles for server configuration or application installation. Many people share roles on Ansible Galaxy.

Ansible roles are consists of many playbooks which are way to group multiple tasks together into one container to do the automation in very effective manner with clean directory structures.

Creating a LAMP Server with Ansible Roles

To create a Ansible roles, we need to use the ansible-galaxy command which has the templates to create it. Roles must be downloaded before they can be used in playbooks.

This will create it under the default directory /etc/ansible/roles and do the modifications else we need to create each directories and files manually.

1 . Install Apache, MySQL and PHP with a ansible-galaxy command. We will use the role from geerlinguy who is a software developer involved in many open source development communities. Check geerlinguy for many other roles.

Creating a Solr Server with Ansible Roles

Apache Solr is a fast open-source Java search server. Solr enables you to easily create search engines which searches websites, databases and files. For more information on Solr, refer to the Solr official documentation.

1 . Install Java, tomcat6, Solr with a ansible-galaxy command. We will use the role from geerlinguy who is a software developer involved in many open source development communities. Check geerlinguy for many other roles.

Note: java and tomcat6 roles are optional, since they’ll be automatically picked up during installation of the geerlingguy.solr role

The Solr server is now created. The roles’ pages on the Ansible Galaxy website highlight the available variables for setting things like what version of Solr to install, where to install it, etc. (for example: geerlingguy.solr Galaxy page).

Other Helpful Galaxy Commands

Some other helpful ansible-galaxy commands:

ansible-galaxy list displays a list of installed roles, with version numbers

ansible-galaxy remove [role] removes an installed role

ansible-galaxy init can be used to create a role template suitable for submission to Ansible Galaxy

Additionally, you can configure the default path where Ansible roles will be downloaded by editing your ansible.cfg configuration file (normally located in /etc/ansible/ansible.cfg and setting a roles_path in the [defaults] section.