Skip to content

/bin/sh: pm2: command not found" #24

@luisbrandao

Description

@luisbrandao

Hello.

i notice that, if the node user is different than the user you user to run ansible, the npm.sh vars in /etc/profile.d wont be read and all commands will fail (silently) with the status "command not found"

TASK [ansible-pm2 : Executing commands] **********************************************************************************************************************
task path: /home/luis.deschamps.ext/git/luis/ansible-frontend/roles/ansible-pm2/tasks/manage.yml:3
changed: [alfa] => (item={u'run': u'delete all'}) => {"changed": true, "cmd": "pm2 delete all ", "delta": "0:00:00.004167", "end": "2018-07-05 14:34:57.878938", "failed_when_result": false, "item": {"run": "delete all"}, "msg": "non-zero return code", "rc": 127, "start": "2018-07-05 14:34:57.874771", "stderr": "/bin/sh: pm2: comando não encontrado", "stderr_lines": ["/bin/sh: pm2: command not found"], "stdout": "", "stdout_lines": []}

TASK [ansible-pm2 : Managing apps] ***************************************************************************************************************************
task path: /home/luis.deschamps.ext/git/luis/ansible-frontend/roles/ansible-pm2/tasks/manage.yml:15
changed: [alfa] => (item={u'path': u'/var/www/pwa-fuckster', u'cmd': u'start', u'run': u'entry.json', u'args': u''}) => {"changed": true, "cmd": "pm2 start entry.json ", "delta": "0:00:00.005851", "end": "2018-07-05 14:34:58.766002", "failed_when_result": false, "item": {"args": "", "cmd": "start", "path": "/var/www/pwa-fuckster", "run": "entry.json"}, "msg": "non-zero return code", "rc": 127, "start": "2018-07-05 14:34:58.760151", "stderr": "/bin/sh: pm2: comando não encontrado", "stderr_lines": ["/bin/sh: pm2: command not found"], "stdout": "", "stdout_lines": []}
changed: [alfa] => (item={u'path': u'/var/www/api-fuckster', u'cmd': u'start', u'run': u'entry.json', u'args': u''}) => {"changed": true, "cmd": "pm2 start entry.json ", "delta": "0:00:00.003992", "end": "2018-07-05 14:34:59.676537", "failed_when_result": false, "item": {"args": "", "cmd": "start", "path": "/var/www/api-fuckster", "run": "entry.json"}, "msg": "non-zero return code", "rc": 127, "start": "2018-07-05 14:34:59.672545", "stderr": "/bin/sh: pm2: command not found", "stderr_lines": ["/bin/sh: pm2: command not found"], "stdout": "", "stdout_lines": []}

TASK [ansible-pm2 : Executing post commands] *****************************************************************************************************************
task path: /home/luis.deschamps.ext/git/luis/ansible-frontend/roles/ansible-pm2/tasks/manage.yml:26
changed: [alfa] => (item={u'ignore_errors': True, u'args': None, u'run': u'save', u'env': {u'NODE_ENV': u'production'}}) => {"changed": true, "cmd": "pm2 save ", "delta": "0:00:00.005275", "end": "2018-07-05 14:35:00.544067", "failed_when_result": false, "item": {"args": null, "env": {"NODE_ENV": "production"}, "ignore_errors": true, "run": "save"}, "msg": "non-zero return code", "rc": 127, "start": "2018-07-05 14:35:00.538792", "stderr": "/bin/sh: pm2: comando não encontrado", "stderr_lines": ["/bin/sh: pm2: command not found"], "stdout": "", "stdout_lines": []}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions