Created
February 27, 2025 14:30
-
-
Save deekayen/9f5b3f561572fa7cfc41bbd1ac99d26e to your computer and use it in GitHub Desktop.
Enable WinRM for Ansible using User Data in AWS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<powershell> | |
$url = "https://raw.githubusercontent.com/ansible/ansible-documentation/refs/heads/devel/examples/scripts/ConfigureRemotingForAnsible.ps1" | |
$file = "$env:temp\ConfigureRemotingForAnsible.ps1" | |
(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file) | |
powershell.exe -ExecutionPolicy ByPass -File $file -EnableCredSSP -CertValidityDays 3650 -ForceNewSSLCert | |
$Password = ConvertTo-SecureString "SETAREALPASSWORDHERE" -AsPlainText -Force | |
New-LocalUser "ansible_provision" -Password $Password -FullName "Ansible User" -Description "For running Ansible" | |
Add-LocalGroupMember -Group Administrators -Member ansible_provision | |
</powershell> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment