Page 1 of 1
Ansible Playbook for NCPA installation on Windows
Posted: Wed Jun 06, 2018 5:53 am
by charangandra
Hi,
Has anyone ever tried to install NCPA agent on Windows using Ansible playbook? Here is my playbook
- name: Install NCPA
win_package:
path:
https://assets.nagios.com/downloads/ncpa/ncpa-2.1.4.exe
- name: Copy the ncpa.cfg template
win_template:
src: ncpa.cfg.j2
dest: 'C:\Program Files (x86)\Nagios\NCPA\etc\ncpa.cfg'
- name: Restart NCPA
win_service:
name: ncpapassive
state: restarted
But getting the below error.
"msg": "product_id is required when the path is not an MSI or the path is an MSI but not local",
Any help is greately appreciated.
Thanks,
Re: Ansible Playbook for NCPA installation on Windows
Posted: Wed Jun 06, 2018 9:10 am
by mcapra
Per the win_package module docs, it is suggested to pass-in a
product_id parameter when the package is not an MSI (it is an exe):
https://docs.ansible.com/ansible/2.4/wi ... odule.html
You should be able to put practically whatever you want in there. I would suggest it be something conspicuous like "NCPA" particularly since the installer writes to
SHCTX:Software\Microsoft\Windows\CurrentVersion\Uninstall\NCPA.
Based on this code, the registry entry should definitely exist (it does on my 2 lab machines) but that's not a guarantee Ansible is looking in the right place or even knows that
product_id is already taken care of:
https://github.com/NagiosEnterprises/nc ... #L388-L391
Though
SHCTX is used when building the installer package and I'm not totally sure what shell context Ansible is using in this case. Things could be getting mixed up. More info:
http://nsis.sourceforge.net/Add_uninsta ... e_Programs
Re: Ansible Playbook for NCPA installation on Windows
Posted: Wed Jun 06, 2018 2:15 pm
by cdienger
Thanks for the assist,
@mcapra!
Re: Ansible Playbook for NCPA installation on Windows
Posted: Thu Jun 07, 2018 4:28 am
by charangandra
Thanks @mcapra!
I've used the product_id as below, but didn't work. step 1 executed which is copying the exe file but the step 2 is stuck in running state for ever. May it is looking for product_id in the registry?
# tasks file for ng_passive
- name: Copy the executable package to temp location
win_copy:
src: ncpa-2.1.4.exe
dest: 'C:\Packages\ncpa-2.1.4.exe'
- name: Install NCPA
win_package:
path: 'C:\Packages\ncpa-2.1.4.exe'
product_id: NCPA
- name: Copy the ncpa.cfg template
win_template:
src: ncpa.cfg.j2
dest: 'C:\Program Files (x86)\Nagios\NCPA\etc\ncpa.cfg'
- name: Restart NCPA
win_service:
name: ncpapassive
state: restarted
Re: Ansible Playbook for NCPA installation on Windows
Posted: Fri Jun 08, 2018 11:37 am
by cdienger
https://docs.ansible.com/ansible/latest ... odule.html puts quotes around the product_id in the examples. Try it with:
- name: Install NCPA
win_package:
path: 'C:\Packages\ncpa-2.1.4.exe'
product_id: 'NCPA'