'Ansible win_package & win_shell - How to pass arguments that have quotes to a command?
How to pass these arguments that have several double quotes correctly?
tasks:
- name: Install McAfee tp
win_shell: |
D:\vra_install\AV\setupEP.exe ADDLOCAL="tp" INSTALLDIR="D:\Program Files" /qb /l"D:\temp\"
args:
executable: cmd
[root]# ansible-playbook mcafee-win-install.yml -e "host=prx103"
ERROR! failed at splitting arguments, either an unbalanced jinja2 block or quotes: D:\vra_install\AV\setupEP.exe ADDLOCAL="tp" INSTALLDIR="D:\Program Files" /qb /l"D:\temp\"
I tried win_package implementation but the program does not want to install. I guess the arguments were not passed correctly.
- name: Install TP
win_package:
path: D:\vra_install\AV\setupEP.exe
arguments:
- ADDLOCAL="tp"
- INSTALLDIR="D:\Program Files"
- /qb
- /l"D:\temp\" '
creates_path: D:\Program Files\McAfee\Endpoint Security\Threat Prevention\AMCore
creates_service: mfevtp
state: present
fatal: [veaprdprx103]: FAILED! => {
"changed": false,
"msg": "unexpected rc from install D:\\vra_install\\AV\\setupEP.exe: see rc, stdout and stderr for more details",
"rc": 16019,
"reboot_required": false,
"stderr": "",
"stderr_lines": [],
"stdout": "",
"stdout_lines": []
Thank you.
Solution 1:[1]
I would try using single quotes for the full string.
E.G.:
tasks:
- name: Install McAfee tp.
win_shell: |
'D:\vra_install\AV\setupEP.exe ADDLOCAL="tp" INSTALLDIR="D:\Program Files" /qb /l"D:\temp\"'
args:
executable: cmd
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | malpanez |
