windows-ansible
- name: Download and run ConfigureRemotingForAnsible.ps1 to setup WinRM | |
psexec: | |
hostname: '{{ hostvars[inventory_hostname]["ansible_host"] | default(inventory_hostname) }}' | |
connection_username: '{{ ansible_user }}' | |
connection_password: '{{ ansible_password }}' | |
encrypt: yes | |
executable: powershell.exe | |
arguments: '-' | |
stdin: | | |
$ErrorActionPreference = "Stop" | |
$sec_protocols = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::SystemDefault | |
$sec_protocols = $sec_protocols -bor [Net.SecurityProtocolType]::Tls12 | |
[Net.ServicePointManager]::SecurityProtocol = $sec_protocols | |
$url = "https://github.com/ansible/ansible/raw/devel/examples/scripts/ConfigureRemotingForAnsible.ps1" | |
Invoke-Expression ((New-Object Net.WebClient).DownloadString($url)) | |
exit | |
delegate_to: localhost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment