Ansible Playbook ca...
Clear all

Ansible Playbook cannot locate the role  


Sathish Kumar
Member Moderator
Joined: 4 months ago
Posts: 1203
31/03/2021 10:06 am  

I am trying to create a new Ansible role called "Adminer" which requires the "Apache" role.

I've specified the Apache role as a dependency in meta/main.yml:

  - src: [email protected]:alexandrubau/ansible-apache.git
    name: apache

I'm testing the Adminer role using Vagrant and I get the following error:

vagrant provision
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: Running provisioner: ansible_local...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (

Alternatively, the compatibility mode can be specified in your Vagrantfile: 

    default: Running ansible-playbook...
ERROR! the role 'apache' was not found in /vagrant/tests/roles:/home/vagrant/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/:/vagrant/tests

The error appears to have been in '/vagrant/meta/main.yml': line 3, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  - src: 
    ^ here

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

Noble Member
Joined: 4 months ago
Posts: 1161
31/03/2021 10:08 am  

Use requirements.yml file and running it with:

ansible-galaxy install -r requirements.yml

Seems like the meta/main.yml file is being read only by the ansible-galaxy command, when you install a role.