Ansible- ROLES

usage: ansible-galaxy [-h] [--version] [-v] TYPE ...
# Create working area
$ mkdir myansiblework
# Get into Working area.
$cd myansiblework
# Check for existing Role.
$ ansible-galaxy role list
# Create a ansible Role.
$ ansible-galaxy role init <<RoleName>>

# To run the full project's Role we can create a Playbook which will invoke all the role's files for setup.
  • /usr/share/ansible/roles
  • /etc/ansible/roles
Check existing Roles
Role-default paths
Create Roles
Role-setup view

Using roles at the play level

The classic (original) way to use roles is with the roles option for a given play:

- hosts: webserver
- common
- webservers



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store