I'm guessing this isn't possible, but I might have been looking at it too 
long at this point to know if I'm missing something...

I have a playbook with a role in which one task has a remote_user and a 
delegate_to option set.   That task has to run for each host on the 
delegate_to server which  has a different ssh_user and password.   Using 
ssh-keys or the same password as the ansible_ssh_user, it works okay, 
however, without ssh keys or the same password, it will fail. 

For some people that will be executing this play, they will not be able to 
use ssh_keys and their passwords are different from the inventory and the 
delegate_to host.   I could prompt for the remote_user and password on play 
run, however, I have not figured out how to set the password for the single 
task.

Here is an example. Is there a way to specify the password for jdoe?    
(note syntax and spacing may be off as I just typed this out)

- name: Sample play
  hosts: all

  roles:
    - myRole

  tasks:

  debug:
    msg: "End of play"

In the role/myRole/tasks/main.yml

- include: myfacts.yml

- name: Some task
  command: test 0
  changed_when: false

- name: Problem task
  remote_user: jdoe
  command: "shell command"
  delegate_to: ###.###.###.###

- name: Some other task
  command: "test -f file.txt"
  register: myOutput
  changed_when: false
    

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4e853606-b1fd-411f-ada8-0dfb8183cec2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to