I'm using Ansible to create a pm2 service on a EC2 / Ubuntu instance. Below is the script. When I run it, PM2 is installed and the service is enabled. When I run pm2 list, I don't the see the service, but I can grep it (ps aux | grep node) and see that it's running. It also seems like a shadow copy of pm2 is running and loading the app, but I can't seem to control it.
- hosts: comm
sudo: yes
tasks:
- npm: name=pm2 global=yes
- name: configure pm2 to restart on startup
shell: pm2 startup ubuntu >& /dev/null chdir=~/ executable=/bin/bash
sudo: yes
sudo_user: root
- command: sudo env PATH=$PATH:/usr/bin pm2 startup ubuntu -u ubuntu
sudo: yes
- command: /usr/bin/pm2 save
- command: /usr/bin/pm2 start /home/ubuntu/something/app.js --name something
No comments:
Post a Comment