Skip to content

Commit

Permalink
feat: allow the service name to be configured
Browse files Browse the repository at this point in the history
closes #9

Merge branch 'master' of https://github.com/j-white/ansible-pm2 into develop
  • Loading branch information
franklinkim committed Feb 22, 2016
2 parents 1006083 + e33c366 commit f597df6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Here is a list of all the default variables for this role, which are also availa
pm2_apps: []
# startup system
pm2_startup: ubuntu
# service name for startup system
pm2_service_name: pm2-init.sh
# start on boot
pm2_service_enabled: yes
# current state: started, stopped
Expand All @@ -71,7 +73,7 @@ These are the handlers that are defined in `handlers/main.yml`.
---
- name: restart pm2
service: name=pm2-init.sh state=restarted
service: name={{ pm2_service_name }} state=restarted
when: pm2_service_state != 'stopped'
```
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
pm2_apps: []
# startup system
pm2_startup: ubuntu
# service name for startup system
pm2_service_name: pm2-init.sh
# start on boot
pm2_service_enabled: yes
# current state: started, stopped
Expand Down
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---

- name: restart pm2
service: name=pm2-init.sh state=restarted
service: name={{ pm2_service_name }} state=restarted
when: pm2_service_state != 'stopped'
2 changes: 1 addition & 1 deletion tasks/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

- name: Configuring service
service:
name: pm2-init.sh
name: "{{ pm2_service_name }}"
state: "{{ pm2_service_state }}"
enabled: "{{ pm2_service_enabled }}"

0 comments on commit f597df6

Please sign in to comment.