如何以Ansible脚本中的root用户身份运行pm2启动脚本并需要运行ecosysytem.config.js

时间:2019-04-30 10:08:45

标签: ansible pm2

我必须使用ansible运行ecosystem.config.js。会是怎样的。我尝试安装启动脚本时出现错误

        - name: Installing startup script
    command: "pm2 startup -u {{ pm2_user }} --hp {{       pm2_user_home.stdout }}"

     fatal: [localhost]: FAILED! => {
"msg": "The task includes an option with an undefined variable. The error was: 'pm2_user' is undefined\n\nThe error appears to have been in '/var/honmanagement/ansible/nodejs.yml': line 58, column 9, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n          state: latest\n      - name: Looking up user home\n        ^ here\n"

}

我必须首先创建pm2_user吗?将如何运行ecosystem.config.js

0 个答案:

没有答案