Need help with win package module

Hi guys, im currently having trouble with installing a zabbix agent using the win_package module. Im trying to install it in a windows server and i get problems while doing it. The problem is once i run the playbook it freezes and won’t install anything. I’ll provide you the code im using . I want to install it in quiet mode, and pass some arguments that the msi installer needs in order to install correctly.

  • name: Zabbix
    hosts: test
    tasks:
    • name: Install Zabbix 6.0.25
      win_package:
      path: C:\path\to\zabbix\msi\installer.msi
      arguments:
      • /qn
      • LOGTYPE=file
      • LOGFILE=“C:/Zabbix/za.log”
      • SERVER=“servername”
      • LISTENPORT=10050
      • SERVERACTIVE=::1
      • HOSTNAME=localhost
      • TLSCONNECT=psk
      • TLSACCEPT=psk
      • TLSPSKIDENTITY=“identityname”
      • TLSPSKVALUE=“valuename”
      • TLSPSKFILE=“C:/Path/to/psk/key”
      • ENABLEPATH=1
      • INSTALLFOLDER=“C:/Zabbix/”

I’m currently using ansible 2.7.7 and 3.7.3 python version.

The documentation im using to install it is:

Ansible win package module

Zabbix msi installer documentation

Would really apreciate the help :slight_smile:
Bye and thanks

I’m not a Windows guy, but the win_package doc you cite clearly states:

If the package is an MSI do not supply the /qn, /log or /norestart arguments.

Try it without /qn and let us know if that helped.

1 Like

Hi, i’ve tried it and it keeps frozen while running the task. Do you know how can i see like a log or something about what’s the playbook doing?

Also, i’m not sure if i’m using the win package correctly

As long as we’re grasping at straws, let’s speculate that the reason they say not to use the /log option is so that the win_package module can monitor the output. If that’s true (and we’re already on thin ice, but let’s keep going), and if the Zabbix-specific options LOGTYPE=file and LOGFILE="C:/Zabbix/za.log" combine to have the same debilitating affect on the win_package module that /log has, then perhaps win_package is hanging because it’s waiting for output on whatever the Windows equivalent of stdout is but that’s instead being sent to C:\Zabbix\za.log, so it sits around apparently hanging until timeouts expire or an admin pulls the plug.

Try it without /qn, LOGTYPE, and LOGFILE. And if that still doesn’t work, I’m truly out of ideas.

1 Like

I could resolve it, it was a problem with the syntax of the installer. I tried installing manually on Windows and it threw me the typical error window, and when i fixed it, it ended up working on ansible. Thanks ! :smiley:

1 Like

That’s great! Glad you got it working.

Can I ask, what specifically did you need to change in your Ansible task to get it to chooch?

The main problem was not using the “” when giving the additional parameters.
So instead of how it was written up on the post, it should be

KEY=“value”

I also removed some Properties Keys that weren’t useful while installing them, such as Logfile or HOSTNAME.
and at last, i added a >- next to the arguments: (i took this from the ansible doc)
You can also check if it works just by trying to install it by command line and passing the parameters. And as you said, i didn’t need to give the /qn parameter.

so it should go like this:

  • name: Zabbix
    hosts: test
    tasks:
    • name: Install Zabbix 6.0.25
      win_package:
      path: C:\path\to\zabbix\msi\installer.msi
      arguments: >-
      • LOGFILE=“C:/Zabbix/za.log”
      • SERVER=“servername”
      • LISTENPORT=“10050”
      • SERVERACTIVE=“servername”
      • TLSCONNECT=“psk”
      • TLSACCEPT=“psk”
      • TLSPSKIDENTITY=“identityname”
      • TLSPSKVALUE=“valuename”
      • TLSPSKFILE=“C:/Path/to/psk/key”
      • ENABLEPATH=1
      • INSTALLFOLDER=“C:/Zabbix/”

I should still try some other options like using / or \ with the paths or some other things, but with this configuration it worked !

1 Like