win_package arguments format

Attempting to silently install a package using a response file and the appropriate command line.

The command I need to run is:

  • .\setup.exe -s f1".\setup.iss"

What I need to enter into arguments is:

  • name: install software
    win_package:
    path: “C:\Users\UserName\Desktop\Software\setup.exe”
    product_id: {guid}
    arguments: “-s -f1”.\setup.iss""

I am unable to get the double quotes to pass through it seems. I’ve tried various formats such as:

  • ’ “-s -f1”.\setup.iss"" ’
  • ’ -s -f1".\setup.iss" ’
  • "-s -f1’.\setup.iss’ "

Help?

Are you using Ansible 2.0.0.2?

I suggest trying to do away with the quotes if at all possible, even if you wind up with a full path to the setup.iss

arguments: “-s -f1 C:\Users\UserName\Desktop\Software\setup.exe”

Jon

Unfortunately, the installshield requires the quotes around the referencefile path following the -f1 switch.

And yes on ansible 2.0.0.2

After further poking around after the win_package is parsed out to the windows machine. Every backslash that is entered into the arguments is doubled for the $complex_args variable in the powershell script that is ran on the windows machine.

So

  • “-s -f1”.\setup.iss" becomes “-s -f1”.\setup.iss"

  • “-s -f1”.\setup.iss" becomes “-s -f1”.\\setup.iss"

  • “-s -f1"C:\Users\UserName\Desktop\Software\setup.iss” becomes “-s -f1"C:\\Users\\UserName\\Desktop\\Software\\setup.iss”"

I even set an enviroment variable for the full path of setup.iss and tried to invoke it with

  • "-s -f1'$env:referenceFilePath' " ( ' in order to escape the single quote required to evaluate a variable in a double quote of a .ps1)

Unfortunately, this did not work with win_package. Though it did work when I created a quick script on the local machine for testing. It seems to me that the win_package parses the argument string in an odd way.

Your pathing for “setup.iss” is probably wrong. PowerShell takes a “dot-backslash” approach when using the shell interactively, but that doesn’t mean you should do the same when supplying absolute/relative paths to the ansible module. Also, PowerShell supports forward slashes, so feel free to use them instead, so you don’t have to escape them.

I would assume you would use something like:

  • name: install software
    win_package:
    path: “C:/Users/UserName/Desktop/Software/setup.exe”
    product_id: {guid}
    arguments: '-s -f1 “C:/Users/UserName/Desktop/Software/setup.iss” ’ (i added a space between the last double-quote and single-quote just for clarification. Should probably be removed in prod)

When the appropriate command line format for the reference file is supplied, the installer creates a setup.txt in the installers directory with various other information. Unfortunately, using the an absolute path with forward or back slashes does not appear to work for the ansible arguments as no setup.txt is created.

Interestingly enough, the absolute path with forward slashes did the trick. The normal setup isn’t created, but everything appears to be working as it should. Thanks!

I probably misunderstood. You run the installer manually once to generate the iss file right? And then on subsequent installs you can reference the iss to have a unattended installation?

In any case, the following should probably also work:
arguments: “-s -f1 setup.iss”

My point is simply that although you tell PowerShell about files in the current dir by using dot-slash notation (.\file.iss) that’s not meaning you should use the same format when telling setup.exe about the same file’s direction. PowerShell will just send whatever arguments you supply to the installer, which is why dot-slash won’t work.

Glad you got it working.