How to split an ansible role’s `defaults/main.yml` file into multiple files?

The feature I’m describing below has been available since Ansible 2.6, but got a bugfix in v2.6.2 and another (minor) one in v2.7. To see a solution for older versions, see Paul’s answer. defaults/main/ Instead of creating defaults/main.yml, create a directory — defaults/main/ — and place all YAML files in there. defaults/main.yml → defaults/main/*.yml Ansible … Read more

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

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