ansible-role

Example:

# Run the [geerlingguy.docker](https://github.com/geerlingguy/ansible-role-docker) role.
- ansible-role:
    name: geerlingguy.docker
    role_vars:
      docker_edition: ce
      docker_install_compose: false
      docker_users:
      - admin
      - freckles

Description

This is a generic task to execute any of the Ansible roles that are hosted on Ansible galaxy.

Currently only a few basic metadata keys are supported: include_type, become &become_user. The other ones will be added when necessary.

Be aware, if the role is not in the default or community resources repository, this will only work if 'allow_remote' or 'allow_remote_roles' is set to true in the context that is used.

Variables

Name Type Default Description

name

string --

The role name. Required

vars

n/a --

n/a Required

become

boolean --

Whether to become another user.

become_user

string --

The user to become.

include_type

string include

n/a

Examples

Example 1

Run the geerlingguy.docker role.

Code
- ansible-role:
    name: geerlingguy.docker
    role_vars:
      docker_edition: ce
      docker_install_compose: false
      docker_users:
      - admin
      - freckles
Description

Runs the geerlingguy.docker role, setting a few variables which are documented in that roles README.md.

Note, any users specified in the 'docker_users' var won't be created automatically, as would be the case with the 'docker-service' frecklet (which, by the way, uses that same role under the hood).

Command-line

frecklecute ansible-role --help

Usage: frecklecute ansible-role [OPTIONS] NAME

  This is a generic task to execute any of the Ansible roles that are hosted
  on [Ansible galaxy](https://galaxy.ansible.com).

  Currently only a few basic metadata keys are supported: ``include_type``,
  ``become`` &``become_user``. The other ones will be added when necessary.

  Be aware, if the role is not in the default or community resources
  repository, this will only work if 'allow_remote' or 'allow_remote_roles'
  is set to true in the context that is used.

Options:
  --vars VARS                  n/a  [required]
  --become / --no-become       Whether to become another user.
  --become-user BECOME_USER    The user to become.
  --include-type INCLUDE_TYPE  n/a  [default: include]
  --help                       Show this message and exit.