nginx_service_name variable

This commit is contained in:
Kirill Shnurov 2021-01-13 09:41:04 +03:00
parent 3e0b830f84
commit f3274bd0bd
3 changed files with 9 additions and 4 deletions

View File

@ -12,6 +12,7 @@ nginx_ppa_version: stable
# The name of the nginx package to install.
nginx_package_name: "nginx"
nginx_service_name: "nginx"
nginx_service_state: started
nginx_service_enabled: true

View File

@ -1,10 +1,14 @@
---
- name: restart nginx
service: name=nginx state=restarted
service:
name: "{{ nginx_service_name }}"
state: restarted
- name: validate nginx configuration
command: nginx -t -c /etc/nginx/nginx.conf
command: "{{ nginx_service_name }} -t -c /etc/nginx/nginx.conf"
changed_when: false
- name: reload nginx
service: name=nginx state=reloaded
service:
name: "{{ nginx_service_name }}"
state: reloaded

View File

@ -43,6 +43,6 @@
- name: Ensure nginx service is running as configured.
service:
name: nginx
name: "{{ nginx_service_name }}"
state: "{{ nginx_service_state }}"
enabled: "{{ nginx_service_enabled }}"