This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== Ansible on RHEL 6 with Windows 10 ===== ==== Install ==== <code> yum install libcurl-devel yum install openssl-devel su - ansible pip install ovirt-engine-sdk-python==4.3 </code> <code> subscription-manager repos --enable rhel-server-rhscl-6-rpms yum install rh-python36-python useradd ansible su - ansible source /opt/rh/rh-python36/enable export PATH=$PATH:$HOME/.local/bin pip3 install --user ansible pip3 install --user pywinrm </code> ==== Windows Configuration ==== Create a Windows user with password. <code> $reg_winlogon_path = "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" Set-ItemProperty -Path $reg_winlogon_path -Name AutoAdminLogon -Value 0 Remove-ItemProperty -Path $reg_winlogon_path -Name DefaultUserName -ErrorAction SilentlyContinue Remove-ItemProperty -Path $reg_winlogon_path -Name DefaultPassword -ErrorAction SilentlyContinue </code> === WinRM Setup === <code> $url = "https://raw.githubusercontent.com/ansible/ansible/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 # This isn't needed but is a good security practice to complete Set-ExecutionPolicy -ExecutionPolicy Restricted -Force </code> === Test === <code> Enter-PSSesion -ComputerName 192.168.122.166 -Credential ansible -UseSSL -SessionOption New-PSSessionOption -SkipCACheck -SkipCNCheck </code> ==== Ansible ==== Create inventory: <code> [windows] DESKTOP-8KM1PCG [windows:vars] ansible_user=ansible ansible_password=C00LP4SSW0RD ansible_connection=winrm ansible_winrm_server_cert_validation=ignore ansible_winrm_transport=credssp </code> Run a test ping: <code> ansible windows -i /path/to/inventory/for/windows -m win_ping </code> Get IP Address via cmd: <code> ansible windows -i windows -m win_command -a "ipconfig" </code> Get list of users via powershell: <code> ansible windows -i windows -m win_shell -a "Get-LocalUser" </code> ==== References ==== * https://www.ansible.com/blog/integrating-ansible-and-red-hat-enterprise-linux-8-beta * https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html * https://access.redhat.com/solutions/92933