Connecting to a WinRM host with different credentials?

24 views
Skip to first unread message

Dave York

unread,
Feb 22, 2020, 11:42:01 PM2/22/20
to Ansible Project
I have a playbook in which I want to create a random password and use it later to connect to a windows box over WinRM

I've generated a random password like this:
  - nameGenerate a temporary random password for new host
    set_fact
      randopass"{{ lookup('password', '/dev/null length=15 chars=ascii_letters') }}"

I set the admin password with vmware_guest os customization:
      customization:
        password'{{ randopass }}'
        timezone004

Then - I'm trying to use:
  connectionwinrm
  port5985
  remote_userAdministrator
  remote_pass'{{ randopass }}'
  gather_factsyes

I've tried "remote_password, remote_pass, ansible_pass, ansible_password" and I get an error message like this:

ERROR! 'remote_pass' is not a valid attribute for a Play


What can I use for this part of the play to connect as a different user/password?

I'm using ansible tower if it matters

Tom Van de Velde

unread,
Feb 23, 2020, 5:13:22 AM2/23/20
to ansible...@googlegroups.com
Hi,

According to doc it should be
ansible_user: LocalUsername
ansible_password: Password
ansible_connection: winrm
ansible_winrm_transport: basic
Regards

Tom

On 23 Feb 2020, at 05:42, Dave York <dave...@gmail.com> wrote:


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4aa02718-fd41-4efa-9023-01b53d77ec3a%40googlegroups.com.

Jordan Borean

unread,
Feb 23, 2020, 1:52:47 PM2/23/20
to Ansible Project
Further to the above, those are variables and not attributes you can set on a play. You need to set them under your the vars key or just add them using add_host in the previous play.

Dave York

unread,
Feb 23, 2020, 11:07:45 PM2/23/20
to Ansible Project
That was what I was looking for.  Thanks Jordan/Tom
Reply all
Reply to author
Forward
0 new messages