WINRM

Hi,

I am working on automation using ansible where in I need to connect to remote window server and install NT service . Please help me for the correct playbook as I have installed Winrm on window and connectivity is working from Linux -Ansible control server to window.

ansible]$ ansible all -i inventory.yml -m win_ping
172.31.82.137 | SUCCESS => {
“changed”: false,
“ping”: “pong”
}

I need playbook for window service install.

Thanks,
Manish

I have tried below playbook but getting error :

ansible-playbook window.yml -i inventory.yml
ERROR! the field ‘hosts’ is required but was not set

Playbook contents:

  • name: test raw module
    hosts: windows----------------> I think here is the problem . I tried with ip but same error as i don’t have domain name available in my personal account .
    tasks:
  • name: run ipconfig
    win_command: ipconfig
    register: ipconfig
  • debug: var=ipconfig

Playbook looks ok, maybe something with spacing?