imfreedom/ansible

Add the rough notes for the windows agents

17 months ago, Gary Kramlich
fb4de13f21f9
Parents ccca37671253
Children 857238d79c83
Add the rough notes for the windows agents
  • +17 -0
    windows.md
  • --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/windows.md Fri Nov 04 23:34:24 2022 -0500
    @@ -0,0 +1,17 @@
    +Make sure PowerShellGet version is newest, just overwrite install with
    +`Install-Module PowerShellGet -AllowClobber -Force` from an admin powershell.
    +
    +
    +Hey grim, before I forget or get sidetracked with other stuff here's the tldr of how I got a Windows VM to configure WinRM and what I had to add on the ansible side of things to be able to connect to it.
    +
    +To make things simpler, I just leveraged the `ConfigureRemotingForAnsible.ps1` script that the ansible team developed. It's not really what I'd use in a production environment (e.g. it uses self-signed certificates) but it's a good starting point when you just need to bootstrap a Windows VM from scratch to test configuring with Ansible.
    +
    +The script and instructions on how to use it can be downloaded from https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1#L17-L37. I always use `-EnableCredSSP` because that's what I use when connecting with ansible.
    +
    +Once you ran that script in your Windows machine you should have everything related to WinRM ready to go. Now on the Ansible side of things, you just need to make sure the following variables are defined (can be done in the inventory, in the playbook, wherever you prefer)
    +
    +ansible_connection: winrm ansible_winrm_transport: credssp ansible_user: pidgin ansible_password: pidgin ansible_become: false ansible_become_method: runas ansible_winrm_server_cert_validation: ignore
    +
    +Note that I used pidgin:pidgin as the username and password for the account I login as using ansible.
    +
    +I'll try to make some time to write this all in the README of the ansible repo but no promises that I can get to this over the next few days ;)