Ansible Command Module Error

I am encountering issues while trying to execute below task in a playbook.

  • name: Setup OpenDJ
    command: “setup --cli --propertiesFilePath /tmp/opendjsetup.props --no-prompt”
    args:
    chdir: “{{ install_dir }}/opendj”

creates: “{{ install_dir }}/opendj/config”

ignore_errors: yes

where install_dir=/opt

Error i am encountering is below. Any help is really appreciated.

Command module can't find setup, in PATH.
I guess you are trying to run the setup command in /opt/opendj ?
In that case add it should be commad: "{{ install_dir }}/opendj/setup ........

I have tried that one but no luck. Still it throws different error

“changed”: true,
“cmd”: [
“/opt/opendj/setup”,
“–cli”,
“–propertiesFilePath”,
“/tmp/opendjsetup.props”,
“–no-prompt”
],
“delta”: “0:00:02.185983”,
“end”: “2017-03-14 20:27:04.226508”,
“failed”: true,
“invocation”: {
“module_args”: {
“_raw_params”: “/opt/opendj/setup --cli --propertiesFilePath /tmp/opendjsetup.props --no-prompt”,
“_uses_shell”: false,
“chdir”: “/opt/opendj”,
“creates”: null,
“executable”: null,
“removes”: null,
“warn”: true
},
“module_name”: “command”
},
“rc”: 7,
“start”: “2017-03-14 20:27:02.040525”,
“stderr”: “”,
“stdout”: “”,
“stdout_lines”: ,
“warnings”:
}