Hello Everyone,

i have a role "x" that uses two default vars:
(roles/x/defaults/main.yml)
server1var: server1
server2var: server2

based on these vars, tasks are executed on server1 or server2

now I have a playbook that executes some tasks and then includes role "x": 

  tasks: 
    - name: fetch file from remote server
      fetch:
        src: ...
        dest: ...
   - name: copy file to remote server
      copy:
        src: ...
        dest: ...

    - include_role: 
        name: x

In this playbook the two vars from /roles/x/defaults/main.yml are also 
present with different values. 
      vars:
        server1var: server3
        server2var: server4

Is it possible that the tasks executed by "include_role" take the vars from 
the current playbook?

 All tasks that gets executed by the include_role should be executed with 
the vars
        server1var: server3
        server2var: server4

instead of the default vars:
         server1var: server1
         server2var: server2

Can anyone tell me how i can do that?
is it just like this maybe?

    - include_role: 
        name: x 
      vars:
        server1var: server3
        server2var: server4

What is the best way to this?

Thank you for your time and help in advance.

 

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/04ef8506-ebcd-46b0-90e2-7b128528cbban%40googlegroups.com.

Reply via email to