It is possible to use Anisble to update or interact with Windows.
To do this, you first need to install and configure winrm. This guide will not cover how to do that.
Once you have verified that winrm is working, you can use a playbook like this to update Windows itself:
- hosts: corellia_win
gather_facts: True
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_remote_tmp: '\tmp'
ansible_user: <YOUR USERNAME>
ansible_ssh_port: 5986
ansible_password: <YOUR PASSWORD>
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
tasks:
- win_updates:
category_names:
- SecurityUpdates
- CriticalUpdates
- UpdateRollups
…using this same approach, you should be able to do any number of things. For example, we can use win_shell to get a return of the files in C:\Temp:
- hosts: corellia_win
gather_facts: True
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_remote_tmp: '\tmp'
ansible_user: <YOUR USERNAME>
ansible_ssh_port: 5986
ansible_password: <YOUR PASSWORD>
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
tasks:
- name: List files from C:\Temp...
win_shell: Get-ChildItem -Path C:\Temp | ForEach-Object { $_.Name }
register: sqs_list
- debug:
msg: ""
…more to come on using this excellent, if very basic, administration tool. I like it as it makes sense to a UNIX-inclined administrator.