Skip to content

Commit

Permalink
Merge pull request #47 from NBZ4live/master
Browse files Browse the repository at this point in the history
Move the binary and service names to the default variables
  • Loading branch information
jdauphant committed May 17, 2015
2 parents be56e91 + daf0ca7 commit 746520f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ nginx_official_repo: False
keep_only_specified: False

nginx_installation_type: "packages"
nginx_binary_name: "nginx"
nginx_service_name: "{{nginx_binary_name}}"
nginx_conf_dir: "/etc/nginx"

nginx_user: "{% if ansible_os_family == 'RedHat' %}nginx{% elif ansible_os_family == 'Debian' %}www-data{% endif %}"
Expand Down
4 changes: 2 additions & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: restart nginx
service: name=nginx state=restarted
service: name={{ nginx_service_name }} state=restarted
when: nginx_installation_type in nginx_installation_types_using_service and nginx_daemon_mode == "on"

- name: reload nginx
service: name=nginx state=reloaded
service: name={{ nginx_service_name }} state=reloaded
when: nginx_installation_type in nginx_installation_types_using_service and nginx_daemon_mode == "on"
2 changes: 1 addition & 1 deletion tasks/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
tags: [configuration,nginx]

- name: Check nginx syntax of configuration files
shell: nginx -t
shell: "{{ nginx_binary_name }} -t"
register: result
changed_when: "result.rc != 0"
always_run: yes
Expand Down
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
- include: configuration.yml

- name: Start the nginx service
service: name=nginx state=started enabled=yes
service: name={{ nginx_service_name }} state=started enabled=yes
when: nginx_installation_type in nginx_installation_types_using_service and nginx_daemon_mode == "on"
tags: [service,nginx]

0 comments on commit 746520f

Please sign in to comment.