role variables

8 views
Skip to first unread message

Sreejith Sreejayan

unread,
Jan 21, 2019, 9:45:53 AM1/21/19
to Ansible Project

Anybody knows passing solution  vars_files in dependencies role
i have variable files located in vars dir but i tried to pass vars_files in this play but its not working any solution to solve this issues .



 now passing var like this vars:
      aws_efs_paths:
        - { path: "/iphare", owner: "root", group: "root", mode: "0644", region: "hello-1", filesystem_id: "hdk-hfksd-lf"} but i have vars file with different env in vars passing this to all playbook is difficult .

dependencies:
  - role: nfs
    vars:
      aws_efs_paths:
        - { path: "/iphare", owner: "root", group: "root", mode: "0644", region: "hello-1", filesystem_id: "hdk-hfksd-lf"}

Kai Stian Olstad

unread,
Jan 21, 2019, 10:12:09 AM1/21/19
to ansible...@googlegroups.com
On Monday, 21 January 2019 15:45:53 CET Sreejith Sreejayan wrote:
>
> Anybody knows passing solution vars_files in dependencies role
> i have variable files located in vars dir but i tried to pass vars_files in
> this play but its not working any solution to solve this issues .

It's hard to overwrite vars variable in roles, check the precedence here
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable

Instead of using vars in the role use defaults, and you can overwrite them everywhere.


--
Kai Stian Olstad


Sreejith Sreejayan

unread,
Jan 21, 2019, 10:57:46 AM1/21/19
to ansible...@googlegroups.com
Thank you, Kai Stain Olstad i will check that



--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2301834.Z7x9MlNeIO%40x1.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages