I had ventured down that path but it failed with an SSL error that it could 
not verify.
But you had me look at this again and i found:

https://github.com/ansible/ansible/issues/18066

once i defined this entry in my hosts file:

localhost ansible_winrm_server_cert_validation=ignore


and added this to my play:

- hosts: localhost
  gather_facts: true
  connection: local




then i tried a simple win_shell command:

- name: windows delegate
  win_shell: echo "hello world" > C:\temp\delegate2.txt
  delegate_to: 192.168.111.13


which then worked!

it seems like its still a known issue in ansible v. 2.3 the fact that it 
doesn't know what to do with winRM?

Thanks!

Den torsdag den 6. juli 2017 kl. 21.20.08 UTC+2 skrev Kai Stian Olstad:
>
> On 06. juli 2017 11:49, Rasmus Sjørslev wrote: 
> > how (if possible) can i run a task using eg. win_shell against a 
> specific 
> > host that takes a variable from the overall playbook it is being 
> > initialised from? 
> > 
> > I have tried an 
> > 
> > - include: dns_changes.yml 
> >    hosts: windows_server 
> >    vars: 
> >      ip: "{{ my_ip }}" 
> > 
> > as a playbook include but that wont work as i think im breaking the 
> > variable scope ? I get an undefined fatal. 
> > 
> > i have also played around with something like: 
> > 
> > - include: dns_changes.yml hosts=windows_server 
> > 
> > as a task include but that does not seem to work. 
>
> use delegate_to, that will run the task(s) on the delegated host. 
>
> -- 
> Kai Stian Olstad 
>

-- 
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/bcb2abf6-b969-4ef6-8d07-c125e819e57d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to