How do I include vars.yml in playbook or tasks - main.yml

Hi All,

I am trying to include variables that I have defined under roles/var/var.yml in roles/conf/tasks/main.yml, but I am not able to do it.

roles/conf/tasks/main.yml

`

Hi All,

I am trying to include variables that I have defined under
roles/var/var.yml in roles/conf/tasks/main.yml, but I am not able to do it.

*roles/conf/tasks/main.yml*

---
- name: vars
  include_vars: var.yml

Here you are using var.yml...

- name: Changes for sysctl file
  shell:
         echo -e "\n###For Cloudera###" >> /etc/sysctl.conf

Note: I have tried like these all possibilities ({{ var }}.yml, var.yml),
but none worked.

*roles/vars/vars.yml*

...but here the file is called vars.yml

What am I missing here?

I would guess your error message would give you this clue.