Install (or uninstall) Microsoft .NET Framework 4.5.2 on Windows.
The target Windows machines must have whitelisted Internet access to download the .NET installer from download.microsoft.com.
By default, this role installs the .NET Framework. Toggling the dotnet452_uninstall
variable from false
to true
will uninstall the framework if it exists.
None.
- hosts: servers
roles:
- { role: deekayen.dotnet452, dotnet452_uninstall: false }
TASK [deekayen.dotnet452 : Install Microsoft .NET Framework 4.5.2.] ************
ok: [10.0.0.100] => {"changed": false, "name": "https://download.microsoft.com/download/E/2/1/E21644B5-2DF2-47C2-91BD-63C560427900/NDP452-KB2901907-x86-x64-AllOS-ENU.exe"}
TASK [deekayen.dotnet452 : debug] **********************************************
ok: [10.0.0.100] => {
"dotnet452_exe": {
"changed": false,
"name": "https://download.microsoft.com/download/E/2/1/E21644B5-2DF2-47C2-91BD-63C560427900/NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
}
}
Because the uninstall task uses Ansible's raw
module, the play output will always report ok
status instead of changed
. The playbook may also complete before the msiexec process has completely finished uninstalling the framework.
Microsoft .NET Framework must exist already on Windows 2008R2 for Ansible to connect and invoke Powershell. This module will confirm that the desired version is installed.
TASK [deekayen.dotnet452 : Uninstall Microsoft .NET Framework 4.5.2.] **********
ok: [10.0.0.100] => {"changed": false, "rc": 0, "stderr": "", "stdout": "", "stdout_lines": []}
TASK [deekayen.dotnet452 : debug] **********************************************
ok: [10.0.0.100] => {
"dotnet452_removed": {
"changed": false,
"rc": 0,
"stderr": "",
"stdout": "",
"stdout_lines": []
}
}
Uninstalling .NET Framework on Windows 2008R2 will break Ansible's ability to invoke Powershell. You won't be able to reconnect with Ansible to the remote host until you re-install .NET Framework by some other means than this role.
BSD