Ansible: Can I execute role from command line?

With ansible 2.7 you can do this:

$ cd /path/to/ansible/
$ ansible localhost -m include_role -a name=<role_name>
localhost | SUCCESS => {
    "changed": false,
    "include_variables": {
        "name": "<role_name>"
    }
}
localhost | SUCCESS => {
    "msg": "<role_name>"
}

This will run role from /path/to/ansible/roles or configured role path.

Read more here:
https://github.com/ansible/ansible/pull/43131

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)