Skip to content

Commit

Permalink
feat: add pm2_upstart for docker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed Feb 9, 2019
1 parent 15f7b99 commit ff05645
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ pm2_apps_default_env: {}
pm2_apps_default_cmd: start
# delete all initially on every run
pm2_apps_delete_all: yes
# service name for startup system
pm2_service_name: pm2-init.sh
# install upstart
pm2_upstart: yes
# start on boot
pm2_service_enabled: yes
# service name for startup system
pm2_service_name: pm2-init.sh
# current state: started, stopped
pm2_service_state: started
# version
pm2_version:
# user to run pm2 commands
pm2_user: "{{ ansible_user_id }}"
# startup platform
pm2_platform:
6 changes: 3 additions & 3 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
service:
name: "{{ pm2_service_name }}"
state: restarted
when: pm2_service_state != 'stopped'
when: pm2_upstart and pm2_service_state != 'stopped'

- name: reload pm2
service:
name: "{{ pm2_service_name }}"
state: reloaded
when: pm2_service_state != 'stopped'
when: pm2_upstart and pm2_service_state != 'stopped'

- name: update pm2
shell: pm2 update
when: pm2_service_state != 'stopped'
when: pm2_upstart and pm2_service_state != 'stopped'
3 changes: 2 additions & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
register: pm2_user_home

- name: Installing startup script
command: "pm2 startup -u {{ pm2_user }} --hp {{ pm2_user_home.stdout }}"
command: "pm2 startup {{ pm2_platform }} -u {{ pm2_user }} --hp {{ pm2_user_home.stdout }}"
when: pm2_upstart
1 change: 1 addition & 0 deletions tasks/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
name: "{{ pm2_service_name }}"
state: "{{ pm2_service_state }}"
enabled: "{{ pm2_service_enabled }}"
when: pm2_upstart

0 comments on commit ff05645

Please sign in to comment.