I have created a simple playbook to add IIS feature to a windows server.
`
- name: Install IIS
win_feature:
name: “Web-WebServer, Web-Mgmt-Tools”
state: present
restart: yes
include_sub_features: yes
include_management_tools: yes
`
And this is the result:
`
[acabrera@cops-test ansible]$ ansible-playbook -vvvv -i hosts/rms ten201_rbo_web.yml
PLAY [Install Win feature ISS on RBO Web server] ******************************
GATHERING FACTS ***************************************************************
<rbapp31b22966.ms.rmsonecloud.net> ESTABLISH WINRM CONNECTION FOR USER: cpadm on PORT 5986 TO rbapp31b22966.ms.rmsonecloud.net
<rbapp31b22966.ms.rmsonecloud.net> WINRM CONNECT: transport=plaintext endpoint=https://rbapp31b22966.ms.rmsonecloud.net:5986/wsman
<rbapp31b22966.ms.rmsonecloud.net> REMOTE_MODULE setup
<rbapp31b22966.ms.rmsonecloud.net> EXEC (New-Item -Type Directory -Path $env:temp -Name “ansible-tmp-1437602865.92-148939687313381”).FullName | Write-Host -Separator ‘’;
<rbapp31b22966.ms.rmsonecloud.net> WINRM EXEC ‘PowerShell’ [‘-NoProfile’, ‘-NonInteractive’, ‘-EncodedCommand’, ‘KABOAGUAdwAtAEkAdABlAG0AIAAtAFQAeQBwAGUAIABEAGkAcgBlAGMAdABvAHIAeQAgAC0AUABhAHQAaAAgACQAZQBuAHYAOgB0AGUAbQBwACAALQBOAGEAbQBlACAAIgBhAG4AcwBpAGIAbABlAC0AdABtAHAALQAxADQAMwA3ADYAMAAyADgANgA1AC4AOQAyAC0AMQA0ADgAOQAzADkANgA4ADcAMwAxADMAMwA4ADEAIgApAC4ARgB1AGwAbABOAGEAbQBlACAAfAAgAFcAcgBpAHQAZQAtAEgAbwBzAHQAIAAtAFMAZQBwAGEAcgBhAHQAbwByACAAJwAnADsA’]
<rbapp31b22966.ms.rmsonecloud.net> WINRM RESULT <Response code 0, out “C:\Users\cpadm\AppDa”, err “”>
<rbapp31b22966.ms.rmsonecloud.net> PUT /tmp/tmpGesC_8 TO C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381\setup
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpGesC_8 to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381\setup.ps1 (offset=0 size=2039)
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpGesC_8 to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381\setup.ps1 (offset=2039 size=2039)
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpGesC_8 to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381\setup.ps1 (offset=4078 size=2039)
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpGesC_8 to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381\setup.ps1 (offset=6117 size=2039)
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpGesC_8 to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381\setup.ps1 (offset=8156 size=1098)
<rbapp31b22966.ms.rmsonecloud.net> PUT /tmp/tmpy9Vivt TO C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381\arguments
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpy9Vivt to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381\arguments (offset=0 size=2)
<rbapp31b22966.ms.rmsonecloud.net> EXEC PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -File C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381\setup.ps1 C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381\arguments; Remove-Item "C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602865.92-148939687313381" -Force -Recurse;
<rbapp31b22966.ms.rmsonecloud.net> WINRM EXEC ‘PowerShell’ [‘-NoProfile’, ‘-NonInteractive’, ‘-EncodedCommand’, ‘UABvAHcAZQByAFMAaABlAGwAbAAgAC0ATgBvAFAAcgBvAGYAaQBsAGUAIAAtAE4AbwBuAEkAbgB0AGUAcgBhAGMAdABpAHYAZQAgAC0ARQB4AGUAYwB1AHQAaQBvAG4AUABvAGwAaQBjAHkAIABVAG4AcgBlAHMAdAByAGkAYwB0AGUAZAAgAC0ARgBpAGwAZQAgAEMAOgBcAFUAcwBlAHIAcwBcAGMAcABhAGQAbQBcAEEAcABwAEQAYQB0AGEAXABMAG8AYwBhAGwAXABUAGUAbQBwAFwAYQBuAHMAaQBiAGwAZQAtAHQAbQBwAC0AMQA0ADMANwA2ADAAMgA4ADYANQAuADkAMgAtADEANAA4ADkAMwA5ADYAOAA3ADMAMQAzADMAOAAxAFwAXABzAGUAdAB1AHAALgBwAHMAMQAgAEMAOgBcAFUAcwBlAHIAcwBcAGMAcABhAGQAbQBcAEEAcABwAEQAYQB0AGEAXABMAG8AYwBhAGwAXABUAGUAbQBwAFwAYQBuAHMAaQBiAGwAZQAtAHQAbQBwAC0AMQA0ADMANwA2ADAAMgA4ADYANQAuADkAMgAtADEANAA4ADkAMwA5ADYAOAA3ADMAMQAzADMAOAAxAFwAXABhAHIAZwB1AG0AZQBuAHQAcwA7ACAAUgBlAG0AbwB2AGUALQBJAHQAZQBtACAAIgBDADoAXABVAHMAZQByAHMAXABjAHAAYQBkAG0AXABBAHAAcABEAGEAdABhAFwATABvAGMAYQBsAFwAVABlAG0AcABcAGEAbgBzAGkAYgBsAGUALQB0AG0AcAAtADEANAAzADcANgAwADIAOAA2ADUALgA5ADIALQAxADQAOAA5ADMAOQA2ADgANwAzADEAMwAzADgAMQBcACIAIAAtAEYAbwByAGMAZQAgAC0AUgBlAGMAdQByAHMAZQA7AA==’]
<rbapp31b22966.ms.rmsonecloud.net> WINRM RESULT <Response code 0, out “{ “changed”: f”, err “”>
ok: [rbapp31b22966.ms.rmsonecloud.net] => {“ansible_facts”: {“ansible_distribution”: “Microsoft Windows NT 6.1.7601 Service Pack 1”, “ansible_distribution_version”: “6.1.7601.65536”, “ansible_fqdn”: “RBAPP31B22966.MS.RMSONECLOUD.NET”, “ansible_hostname”: “RBAPP31B22966”, “ansible_interfaces”: [{“default_gateway”: “10.64.24.1”, “dns_domain”: “ms.rmsonecloud.net”, “interface_index”: 12, “interface_name”: “vmxnet3 Ethernet Adapter #5”}], “ansible_ip_addresses”: [“10.64.24.14”, “fe80::f1c1:7db7:ea7b:20ff”], “ansible_os_family”: “Windows”, “ansible_powershell_version”: 3, “ansible_system”: “Win32NT”, “ansible_totalmem”: 17179869184, “ansible_winrm_certificate_expires”: “2025-07-13 22:30:42”}, “changed”: false}
TASK: [ten201 | Install IIS] **************************************************
<rbapp31b22966.ms.rmsonecloud.net> ESTABLISH WINRM CONNECTION FOR USER: cpadm on PORT 5986 TO rbapp31b22966.ms.rmsonecloud.net
<rbapp31b22966.ms.rmsonecloud.net> WINRM CONNECT: transport=plaintext endpoint=https://rbapp31b22966.ms.rmsonecloud.net:5986/wsman
<rbapp31b22966.ms.rmsonecloud.net> REMOTE_MODULE win_feature name=‘Web-WebServer, Web-Mgmt-Tools’ state=present
<rbapp31b22966.ms.rmsonecloud.net> EXEC (New-Item -Type Directory -Path $env:temp -Name “ansible-tmp-1437602912.73-281252093964288”).FullName | Write-Host -Separator ‘’;
<rbapp31b22966.ms.rmsonecloud.net> WINRM EXEC ‘PowerShell’ [‘-NoProfile’, ‘-NonInteractive’, ‘-EncodedCommand’, ‘KABOAGUAdwAtAEkAdABlAG0AIAAtAFQAeQBwAGUAIABEAGkAcgBlAGMAdABvAHIAeQAgAC0AUABhAHQAaAAgACQAZQBuAHYAOgB0AGUAbQBwACAALQBOAGEAbQBlACAAIgBhAG4AcwBpAGIAbABlAC0AdABtAHAALQAxADQAMwA3ADYAMAAyADkAMQAyAC4ANwAzAC0AMgA4ADEAMgA1ADIAMAA5ADMAOQA2ADQAMgA4ADgAIgApAC4ARgB1AGwAbABOAGEAbQBlACAAfAAgAFcAcgBpAHQAZQAtAEgAbwBzAHQAIAAtAFMAZQBwAGEAcgBhAHQAbwByACAAJwAnADsA’]
<rbapp31b22966.ms.rmsonecloud.net> WINRM RESULT <Response code 0, out “C:\Users\cpadm\AppDa”, err “”>
<rbapp31b22966.ms.rmsonecloud.net> PUT /tmp/tmpA5nJRf TO C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\win_feature
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpA5nJRf to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\win_feature.ps1 (offset=0 size=2033)
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpA5nJRf to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\win_feature.ps1 (offset=2033 size=2033)
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpA5nJRf to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\win_feature.ps1 (offset=4066 size=2033)
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpA5nJRf to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\win_feature.ps1 (offset=6099 size=2033)
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpA5nJRf to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\win_feature.ps1 (offset=8132 size=2033)
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmpA5nJRf to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\win_feature.ps1 (offset=10165 size=39)
<rbapp31b22966.ms.rmsonecloud.net> PUT /tmp/tmp7DJHfn TO C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\arguments
<rbapp31b22966.ms.rmsonecloud.net> WINRM PUT /tmp/tmp7DJHfn to C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\arguments (offset=0 size=125)
<rbapp31b22966.ms.rmsonecloud.net> EXEC PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -File C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\win_feature.ps1 C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288\arguments; Remove-Item "C:\Users\cpadm\AppData\Local\Temp\ansible-tmp-1437602912.73-281252093964288" -Force -Recurse;
<rbapp31b22966.ms.rmsonecloud.net> WINRM EXEC ‘PowerShell’ [‘-NoProfile’, ‘-NonInteractive’, ‘-EncodedCommand’, ‘UABvAHcAZQByAFMAaABlAGwAbAAgAC0ATgBvAFAAcgBvAGYAaQBsAGUAIAAtAE4AbwBuAEkAbgB0AGUAcgBhAGMAdABpAHYAZQAgAC0ARQB4AGUAYwB1AHQAaQBvAG4AUABvAGwAaQBjAHkAIABVAG4AcgBlAHMAdAByAGkAYwB0AGUAZAAgAC0ARgBpAGwAZQAgAEMAOgBcAFUAcwBlAHIAcwBcAGMAcABhAGQAbQBcAEEAcABwAEQAYQB0AGEAXABMAG8AYwBhAGwAXABUAGUAbQBwAFwAYQBuAHMAaQBiAGwAZQAtAHQAbQBwAC0AMQA0ADMANwA2ADAAMgA5ADEAMgAuADcAMwAtADIAOAAxADIANQAyADAAOQAzADkANgA0ADIAOAA4AFwAXAB3AGkAbgBfAGYAZQBhAHQAdQByAGUALgBwAHMAMQAgAEMAOgBcAFUAcwBlAHIAcwBcAGMAcABhAGQAbQBcAEEAcABwAEQAYQB0AGEAXABMAG8AYwBhAGwAXABUAGUAbQBwAFwAYQBuAHMAaQBiAGwAZQAtAHQAbQBwAC0AMQA0ADMANwA2ADAAMgA5ADEAMgAuADcAMwAtADIAOAAxADIANQAyADAAOQAzADkANgA0ADIAOAA4AFwAXABhAHIAZwB1AG0AZQBuAHQAcwA7ACAAUgBlAG0AbwB2AGUALQBJAHQAZQBtACAAIgBDADoAXABVAHMAZQByAHMAXABjAHAAYQBkAG0AXABBAHAAcABEAGEAdABhAFwATABvAGMAYQBsAFwAVABlAG0AcABcAGEAbgBzAGkAYgBsAGUALQB0AG0AcAAtADEANAAzADcANgAwADIAOQAxADIALgA3ADMALQAyADgAMQAyADUAMgAwADkAMwA5ADYANAAyADgAOABcACIAIAAtAEYAbwByAGMAZQAgAC0AUgBlAGMAdQByAHMAZQA7AA==’]
<rbapp31b22966.ms.rmsonecloud.net> WINRM RESULT <Response code 0, out “{ “changed”: f”, err “”>
failed: [rbapp31b22966.ms.rmsonecloud.net] => {“changed”: false, “exitcode”: “InvalidArgs”, “failed”: true, “feature_result”: , “restart_needed”: false, “success”: false}
msg: Failed to add feature
FATAL: all hosts have already failed – aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/home/acabrera/ten201_rbo_web.retry
rbapp31b22966.ms.rmsonecloud.net : ok=1 changed=0 unreachable=0 failed=1
`
My ansible linux box is CEntOS 7.
Any ideas ?
Thanks in advance.