How Do You Troubleshoot the Ansible Message “ERROR! the role was not found”?

Problem scenario
You run ansible-playbook on a playbook (e.g., .yaml file) that uses a role.  It fails with the message "ERROR! the role was not found".  How do you correct this problem?

Find the ansible.cfg file.  Look at the roles_path stanza.  Add or modify the path that you want Ansible to look at for a role every time the Ansible playbook runs.

If you want a special ansible.cfg file (to not interfere with other users on your Ansible control host), copy one to the directory with the playbook.  This will be used by default (when the ansible-playbook command runs).  You can modify the roles_path as you desire without affecting other users.  To learn more about the ansible.cfg file, see this link.

Leave a comment

Your email address will not be published. Required fields are marked *