Error saying script is already running - Ansible playbook error

0 votes

I'm trying to start a node program using pm2 via ansible. 

My playbook:

- name: start the application
  become_user: ubuntu
  command: pm2 start app.js -i max
  tags: 
    - app

But i keep getting this error saying the script is already running. I don't understand why..

Feb 8, 2019 in Ansible by Kavya
1,175 views

1 answer to this question.

0 votes

Remove the previous processes before running this script, something like this:

 - name: delete existing pm2 processes if running
   command: "pm2 delete {{ server_id }}"
   ignore_errors: True
   become: yes
   become_user: rw_user


 - name: start pm2 process
   command: 'pm2 start -x -i 4 --name "{{server_id}}" server.js'
   become: yes
   become_user: rw_user
   environment:
    NODE_ENV: "{{server_env}}"
answered Feb 8, 2019 by Dee

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 views
+2 votes
1 answer
0 votes
1 answer

Error saying permission denied while running ansible playbook

Hey @Neha, add the following line to ...READ MORE

answered Feb 8, 2019 in Ansible by Amy
15,864 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP