Yes, just do the same vars directive on the task like you have done on the
play, e.g.
- name: my task
ping:
vars:
ansible_python_interpreter: /usr/bin/python
You would have to keep in mind variable precedence [1], task vars do beat
play vars but the following will beat task vars
- Vars added with include_vars:
- Vars/facts added with set_fact or register
- Extra vars specified by '-e' when Ansible was invoked
[1] -
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable
Thanks
Jordan
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a77fcc89-1357-4a8f-a722-dc891eeda4e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.