Ansible Playbook cannot locate the role

+1 vote

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:

---
dependencies:
  - src: git+https@github.com: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 (2.4.2.0).

Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode

    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:

dependencies:
  - src: https://github.com/alexandrubau/ansible-apache.git
    ^ here

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
Mar 13, 2019 in Ansible by Laksha
6,930 views
Hi Laksha,

1. Please check the role whether it is properly configured(mail.yml)

2. Check your syntax in the dependencies section, I think it is not in the proper format.

3. If roles are added with proper dependencies in /meta/main.yml exists then only it will execute either in ansible 1.3 or higher version

1 answer to this question.

+1 vote

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.

answered Mar 13, 2019 by krishti

Related Questions In Ansible

+1 vote
2 answers

What is the difference between ansible playbook and roles?

Hi, Roles: Roles containing certain vars_files, tasks, and handlers ...READ MORE

answered Jan 21, 2020 in Ansible by vivek
• 530 points
21,823 views
0 votes
1 answer

How do I wget a file from web server using shell in the ansible playbook

Hey Ayaan, you could probably use this ...READ MORE

answered Jan 24, 2019 in Ansible by Anushri
4,155 views
0 votes
1 answer
0 votes
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 views
+2 votes
1 answer
0 votes
1 answer

Role of subelement module in an Ansible playbook

Hey @Rahul thanks for a better question ...READ MORE

answered Jan 16, 2019 in Ansible by Emily
2,393 views
+1 vote
4 answers

Pass variable to ansible playbook through command line

ansible-playbook test.yml --extra-vars "arg1=${var1} arg2=${var2}" Use is like ...READ MORE

answered May 7, 2019 in Ansible by Bobin
14,391 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP