Question

I am trying to use Ansible's dependencies feature but I cannot get it to work. Could someone provide a minimal example of a role that depends on another role that uses the dependencies feature eg:

--- dependencies: - { role: common }

Many thanks.

Était-ce utile?

La solution

You should be able to use it if you put the content you specified in your question in this file:

<your-project-home>/roles/webservers/meta/main.yml 

Make sure your common role exists in:

<your-project-home>/roles/common

Make sure your project structure looks like this:

yourplaybook.yml
roles/
   common/
   webservers/

yourplaybook.yml should look something like this:

---
- hosts: all
  roles:
     - webservers

Then you would call your playbook like this:

ansible-playbook -i ./inventory-file yourplaybook.yml
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top