I’m a Ansible newbie and i’m trying to run a playbook with a role but cant figure out what wrong with it.
i’m have in my home folder 2 folders: ansible-role-VMware & ansible-VMware.
In ansible-VMware, i have a yml file which is deploy.yml:
Look at the “role directory structure” on that page. In that structure, common and webserver are roles.
In other words, a role is not a simple yaml file; a role rolename is a collection of files under a directory called rolename in one of the directories in the role path.
So your first problem is that your directory ansible-role-VMware is not one of the directories in the roles path. You can fix this either by adding ansible-role-VMware’s fully-qualified path to the roles-path variable in your ansible.cfg file, or by putting your role in one of the directories that is in your roles path already, such as in ansible-VMWare.
The second problem is that your file deployova.yml is not in the correct place in the directory structure. You can fix that by creating ansible-VMware/roles/tasks and putting it in there.
Thethird problem is not really a problem, but if you don’t have multiple files that you will want to choose between in the same role, you might as well call your file “main.yaml” so that Ansible will find it automatically. Then you can leave out the “tasks_from” directive.
I think you are getting confused. Let's work from your home directory.
Everything from now on will happen in your home directory or below it. Make
sure you have set up /etc/ansible.cfg correctly for your needs OR that you
have a suitable ansible.cfg in your home directory.
First we go to your home directory:
cd
Then we create a place for your playbooks and roles: