Ansible Install MSI in windows
To install an application using the MSI file, we need to use win_get_url to mention the path of the MSI file to download and then use the win_package module to install it. The state present means the MSI will be installed on the machine, and the application is in the present state. It is recommended to download the package first from the URL using the win_get_url module as it opens up more flexibility with what must be set when calling win_package.
# cat MSI.yaml
---
- name: Installing Apache MSI
hosts: all
tasks:
- name: Download the Apache installer
win_get_url:
URL: https://archive.apache.org/dist/httpd/binaries/win32/httpd-2.2.25-win32-x86-no_ssl.msi
dest: C:\app\httpd-2.2.25-win32-x86-no_ssl.msi
- name: Install MSI
win_package:
path: C:\app\httpd-2.2.25-win32-x86-no_ssl.msi
state: present
Let's run the playbook,
# ansible-playbook -i hosts msi.yml
PLAY [Installing Apache MSI] ********************************************************************************************************************************
TASK [Gathering Facts] **************************************************************************************************************************************
[WARNING]: ERROR DURING WINRM SEND INPUT - attempting to recover: WinRMOperationTimeoutError
ok: [192.168.1.2]
TASK [Download the Apache installer] ************************************************************************************************************************
changed: [192.168.1.2]
TASK [Install MSI] ******************************************************************************************************************************************
changed: [192.168.1.2]
PLAY RECAP **************************************************************************************************************************************************
192.168.1.2 : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Github repo for:https://github.com/zippyopstraining/windowsmsi/blob/main/msi.yml
Recent Comments
No comments
Leave a Comment
We will be happy to hear what you think about this post