win_nssm

43 views
Skip to first unread message

Manish Kumar

unread,
Aug 22, 2019, 3:54:33 AM8/22/19
to Ansible Project

Hi All,

getting below error  so you have any idea about it  ?

ERROR! Syntax Error while loading YAML.
  mapping values are not allowed in this context

The error appears to be in '/home/manish/mk/ansible/install_exe.yml': line 6, column 13, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Install & start application as Windows service (via nssm)
    win_nssm:
            ^ here

Playbook

---
- name: Install a service
  gather_facts: false
  hosts: all
- name: Install & start application as Windows service (via nssm)
    win_nssm:
      name: "npp.7.7.1.Installer"
      application: "{{C:\Users\Administrator\Downloads}}"
      state: restarted

Thanks,
Manish

Dick Visser

unread,
Aug 22, 2019, 4:01:23 AM8/22/19
to ansible...@googlegroups.com
Curly braces put you in jinja context, and I don't think
"C:\Users\Administrator\Downloads" is a variable.
According to the docs application is "The application binary".


--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

Manish Kumar

unread,
Aug 22, 2019, 8:33:39 AM8/22/19
to Ansible Project
Please share in case play book is available to install notepad++ which is already downloaded in the window server .

MKPhil

unread,
Aug 22, 2019, 10:24:54 AM8/22/19
to Ansible Project
win_nssm is for creating windows services with nssm (the Non-Sucking Service Manager).  What you probably want is win_command (https://docs.ansible.com/ansible/latest/modules/win_command_module.html)  so something like:

---
- name: Install Notepad++
  gather_facts: false
  hosts: all
  tasks:
    - win_command: "C:\Users\Administrator\Downloads\npp.7.7.1.Installer.exe"

Manish Kumar

unread,
Aug 22, 2019, 12:24:27 PM8/22/19
to Ansible Project
getting below error :

ERROR! Syntax Error while loading YAML.
  did not find expected hexdecimal number

The error appears to be in '/home/manish/mk/ansible/install_pkg.yml': line 6, column 25, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
    - win_command: "C:\Users\Administrator\Downloads\npp.7.7.1.Installer.exe"
                        ^ here
This one looks easy to fix. It seems that there is a value started
with a quote, and the YAML parser is expecting to see the line ended
with the same kind of quote. For instance:

    when: "ok" in result.stdout

Could be written as:

   when: '"ok" in result.stdout'

Or equivalently:

   when: "'ok' in result.stdout"
Reply all
Reply to author
Forward
0 new messages