Hi all,
I have role that contains several tasks that should be run by different Ansible users. The playbook that uses this role should run on Windows hosts and I do this using a command similar to the following:
ansible-playbook --limit windows -i hosts --extra-vars "ansible_user=my_username ansible_password=my_password" site.yaml
Most of the tasks in the role should be done through the user specified in the command above while others should use another Windows user. For these other tasks, I try to override the user credential variables as shown below:
`
- include: task_for_other_windows_user.yml
vars:
ansible_user: “{{other_windows_user_name}}”
ansible_password: “{{other_windows_user_pw}}”
`
This unfortunately doesn’t work as the playbook appears to use the same user initially defined, on all the plays. How do I implement what I’m trying to achieve here?