win_package - missing product id error

1,612 views
Skip to first unread message

Anfield

unread,
Aug 19, 2016, 3:12:32 PM8/19/16
to Ansible Project
Trying to install notepad onto a windows 2012 server and getting an error "Missing required arguement: product_id"

- Do I have to go lookup a product id for every .exe I want to install? Where do I get this?

-notepad.yml

#Install Notepad 6.9.2 from executable in shared drive
- hosts: all
  gather_facts: false
  tasks:
   - name: Install Notepad 6.9.2 Package
     win_package:
      arguements: "/install /passive /norestart"

Log below - 

[root@localhost group_vars]# ansible-playbook notepad.yml -vvvv
Using /etc/ansible/ansible.cfg as config file
Loaded callback default of type stdout, v2.0

PLAYBOOK: notepad.yml **********************************************************
1 plays in notepad.yml

PLAY [all] *********************************************************************

TASK [Install Notepad 6.9.2 Package] *******************************************
task path: /etc/ansible/group_vars/notepad.yml:5
<10.10.128.0> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO                                                         10.10.128.0
<10.10.128.0> EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name "ansible-tmp-1471633257.79-18742                                                        9094883462").FullName | Write-Host -Separator '';
<10.10.128.0> PUT "/tmp/tmpFMnfbg" TO "C:\Users\Administrator\AppData\Local\Temp                                                        \ansible-tmp-1471633257.79-187429094883462\win_package.ps1"
<10.10.128.0> EXEC Set-StrictMode -Version Latest
Try
{
& 'C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1471633257.79-187429094                                                        883462\win_package.ps1'
}
Catch
{
$_obj = @{ failed = $true }
If ($_.Exception.GetType)
{
$_obj.Add('msg', $_.Exception.Message)
}
Else
{
$_obj.Add('msg', $_.ToString())
}
If ($_.InvocationInfo.PositionMessage)
{
$_obj.Add('exception', $_.InvocationInfo.PositionMessage)
}
ElseIf ($_.ScriptStackTrace)
{
$_obj.Add('exception', $_.ScriptStackTrace)
}
Try
{
$_obj.Add('error_record', ($_ | ConvertTo-Json | ConvertFrom-Json))
}
Catch
{
}
Echo $_obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Finally { Remove-Item "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-147                                                        1633257.79-187429094883462" -Force -Recurse -ErrorAction SilentlyContinue }
fatal: [10.10.128.0]: FAILED! => {"changed": false, "failed": true, "invocation"                                                        : {"module_name": "win_package"}, "msg": "Missing required argument: product_id"                                                        }

NO MORE HOSTS LEFT *************************************************************
        to retry, use: --limit @notepad.retry

PLAY RECAP *********************************************************************
10.10.128.0                : ok=0    changed=0    unreachable=0    failed=1


Anfield

unread,
Aug 19, 2016, 3:41:17 PM8/19/16
to Ansible Project
Nevermind - I just added product_id="notepad" to get past this error


Trond Hindenes

unread,
Aug 19, 2016, 5:16:53 PM8/19/16
to Ansible Project
You basically need the id, as that's what gets checked for idempodency. So if you put in something wrong it will attempt to install on every run. You'll find the correct key in the uninstall node in the registry.

Anfield

unread,
Aug 23, 2016, 10:09:49 AM8/23/16
to Ansible Project
so is there no way I can use a dummy id? Id have to install on another machine first and then find the product_id?

Anfield

unread,
Aug 23, 2016, 10:34:50 AM8/23/16
to Ansible Project
Changed my playbook to the following but it seems like it stalls and doesnt provide an final error

#Install Notepad 6.9.2 from specified repository
- hosts: all
  gather_facts: false
  tasks:
   - name: Install Notepad 6.9.2 Package
     win_package:
      path: \\IT00001352\Users\user\Documents\ANSIBLE\npp.6.9.2.Installer.exe
      product_id: "Notepad 6.9.2"
      user_name: "user"
      user_password: "pass"
      arguements: "/install /passive /norestart"

It seems to stick at the following output for a long time. I can see from the target box that powershell.exe is running as is the notepad installer itself. 

Is there something else I am missing in the above playbook?

Log output - 

10.10.128.0> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO                       10.10.128.0
<10.10.128.0> EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name "ansible-tmp-1471961958.88-29561                      933562114").FullName | Write-Host -Separator '';
<10.10.128.0> PUT "/tmp/tmpW4L0nP" TO "C:\Users\Administrator\AppData\Local\Temp                      \ansible-tmp-1471961958.88-29561933562114\win_package.ps1"
<10.10.128.0> EXEC Set-StrictMode -Version Latest
Try
{
& 'C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1471961958.88-295619335                      62114\win_package.ps1'
}
Catch
{
$_obj = @{ failed = $true }
If ($_.Exception.GetType)
{
$_obj.Add('msg', $_.Exception.Message)
}
Else
{
$_obj.Add('msg', $_.ToString())
}
If ($_.InvocationInfo.PositionMessage)
{
$_obj.Add('exception', $_.InvocationInfo.PositionMessage)
}
ElseIf ($_.ScriptStackTrace)
{
$_obj.Add('exception', $_.ScriptStackTrace)
}
Try
{
$_obj.Add('error_record', ($_ | ConvertTo-Json | ConvertFrom-Json))
}
Catch
{
}
Echo $_obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Finally { Remove-Item "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-147                      1961958.88-29561933562114" -Force -Recurse -ErrorAction SilentlyContinue }

Anfield

unread,
Aug 23, 2016, 11:24:45 AM8/23/16
to Ansible Project
Also took the product id from the registry of my machine and tried that in the playbook also, same result

Anfield

unread,
Aug 23, 2016, 12:11:55 PM8/23/16
to Ansible Project
Any ideas anyone?

J Hawkesworth

unread,
Aug 23, 2016, 3:04:04 PM8/23/16
to Ansible Project
Yes, I have hit this with notepad++. I think it hangs because a dialog is prompting the user for some input.

I think there's a chocolatey package for it, so probably the easiest way to get round it is to use chocolatey.

I think there's a zip file version as well if you don't mind scripting a bit more of the installation.

Otherwise I would suggest raising an issue with the notepad++ developers. Having a fully unattended installer is not an unreasonable thing to ask for and likely the devs could make use of such a thing in their testing.

Let us know how you get on.

Jon

don_r...@vgasu.vrn.ru

unread,
Aug 25, 2017, 6:37:51 PM8/25/17
to Ansible Project
https://gist.github.com/don-rumata/f42134fd59e7c7630cbef31b05306552

вторник, 23 августа 2016 г., 19:11:55 UTC+3 пользователь Anfield написал:
Any ideas anyone?
Reply all
Reply to author
Forward
0 new messages