1

我想使用 ansible 安装 package.json,我使用的是文档中的示例,唯一不同的是我使用的是 npm 而不是 nvm,所以任务看起来像这样

- name: npm install (manual)
  npm:
    path:"{{ project_path }}"
    executable: /usr/bin/npm

{{ project_path }}package.json文件的路径,基本上是/srv/example.com/.

这个任务的结果是

TASK [angular : npm install (manual)] ******************************************
task path: /srv/example.com/orchestration/ansible/roles/angular/tasks/main.yml:16
Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/packaging/language/npm.py
<default> ESTABLISH LOCAL CONNECTION FOR USER: vagrant
<default> EXEC /bin/sh -c 'echo ~ && sleep 0'
<default> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/vagrant/.ansible/tmp/ansible-tmp-1540437954.12-74081721294328 `" && echo ansible-tmp-1540437954.12-74081721294328="` echo /home/vagrant/.ansible/tmp/ansible-tmp-1540437954.12-74081721294328 `" ) && sleep 0'
<default> PUT /tmp/tmpkx6E4h TO /home/vagrant/.ansible/tmp/ansible-tmp-1540437954.12-74081721294328/npm.py
<default> EXEC /bin/sh -c 'chmod u+x /home/vagrant/.ansible/tmp/ansible-tmp-1540437954.12-74081721294328/ /home/vagrant/.ansible/tmp/ansible-tmp-1540437954.12-74081721294328/npm.py && sleep 0'
<default> EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-anopitzukaokwawzhqmxqjfzoxjtozxh; /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1540437954.12-74081721294328/npm.py; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1540437954.12-74081721294328/" > /dev/null 2>&1'"'"' && sleep 0'
ok: [default] => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "executable": "/usr/bin/npm", 
            "global": false, 
            "ignore_scripts": false, 
            "name": null, 
            "path": "/srv/example.com/", 
            "production": false, 
            "registry": null, 
            "state": "present", 
            "version": null
        }
    }
}

它什么也没做,为什么?我该如何安装我的package.json,有人可以帮助我了解如何克服这个问题,谢谢。

4

0 回答 0