Error while running playbook consisting of roles - Ansible

0 votes

I've created my first ansible role and I'm getting an error.

---
- hosts: webservers
  roles:
    - nginx

Error:

ERROR! the role 'nginx' was not found in /root/roles:/root:/etc/ansible/roles

The error appears to have been in '/root/server.yml': line 4, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
    - nginx
      ^ here
Mar 12 in Ansible by Bob
67 views

1 answer to this question.

0 votes

You get this error because ansible was not able to find nginx role in your file hierarchy. 

If you want to use a role named nginx, ansible will try to load a file nginx/tasks/main.yml in one of your roles folders.

Copy into your nginx role folder this code: https://github.com/jdauphant/ansible-role-nginx

And use it as described in its README.md

answered Mar 12 by William

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer
0 votes
3 answers
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
216 views
0 votes
1 answer
0 votes
1 answer