The Ansible tool’s function is to keep pushing the code to the production servers without manual intervention – Ansible automates it. In this post, you will know how to create a Role in Galaxy.
Deployment, in the traditional approach, is tedious. When you use deployment orchestrators, they will take care of password management, monitoring, and deployment.
Deployment Orchestrators and rules to create a Role:
- List of Deployment Orchestrators
- Roles in Ansible Orchestrator
1. Top Deployment Orchestrators.
Puppet | Broad community support |
Some coding skills recommended | |
Extensible using Ruby | |
Requires agents installed on all clients | |
Chef | Integrated with Git |
Some coding skills recommended | |
Extensible using Ruby | |
High learning curve | |
Broad community support | |
Requires chef-client installed on all clients | |
Ansible | Sysadmin friendly |
Python-based | |
No code needed, no host-based agents | |
Simple, fast connections work via SSH | |
Run via text-based files (called playbooks) | |
Minimal learning curve | |
Salt | Works through agents (called minions) |
Highly scalable | |
Sysadmin friendly |
2. Roles in Ansible Orchestrator.
In Ansible, Playbooks play superior role. A play book is a big file, that contain all the infrastructure needed, to run in Ansible.
Playbooks.
Playbooks and roles are similar. Different at the same time. A playbook is a standalone file that Ansible can run that contains all of the information required to set a machine’s state to what you expect.
A playbook can contain variables, tasks, handlers, roles, and even other playbooks, all in the same file. You don’t need any other files to accomplish your task.
So, the playbook is a Master file, which is executable. The role file, you cannot execute on its own.
Make a one-time donation
Make a monthly donation
Make a yearly donation
Choose an amount
Or enter a custom amount
Your contribution is appreciated.
Your contribution is appreciated.
Your contribution is appreciated.
DonateDonate monthlyDonate yearlyRoles.
You can think of a role as a playbook that splits up into multiple different files. Instead of having a single file that contains everything that you need, there’s one file for variables, one for tasks, and another for handlers.
You can’t run a role on its own, though; you need to include it inside a playbook along with the information about which hosts to run on.
When installing a role, you can either install it globally on your machine or locally to a project. As with any dependency, you want it to be local to your project in case multiple projects need different versions of the same dependency.
Ansible roles are premium parts of Ansible. They help keep your playbooks clean and readable.
You can store the roles you created in https://galaxy.ansible.com/ , which is a public directory.
Rules to Create a Role.
- When creating a role, try to make sure that it is usable out of the box. If your role installs a specific piece of software, make it install and configure a basic installation without any user intervention.
- Two types of roles present – Opinionated and un-opinionated. In the public galaxy, you will find Un-opinionated roles -means general use. The Opinionated roles – pertains to a certain app or clients. Checkout here steps to create a Role.
Keep Reading