Refactor service logic
This allows for more control over the nginx service. Change-Id: I61984c35a5c45ad94d02a12d2fa6fa8a29c81d44 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
5fa2ca3e42
commit
65afd10447
@ -28,3 +28,9 @@ nginx_file_nginx_conf_dest: /etc/nginx/nginx.conf
|
|||||||
nginx_file_nginx_conf_src: ""
|
nginx_file_nginx_conf_src: ""
|
||||||
|
|
||||||
nginx_package_name: nginx
|
nginx_package_name: nginx
|
||||||
|
|
||||||
|
nginx_service_nginx_daemon_reload: true
|
||||||
|
nginx_service_nginx_enabled: true
|
||||||
|
nginx_service_nginx_manage: true
|
||||||
|
nginx_service_nginx_name: nginx
|
||||||
|
nginx_service_nginx_state: started
|
||||||
|
@ -12,8 +12,3 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
---
|
---
|
||||||
- name: Restart nginx
|
|
||||||
become: yes
|
|
||||||
service:
|
|
||||||
name: nginx
|
|
||||||
state: restarted
|
|
||||||
|
@ -14,8 +14,20 @@
|
|||||||
---
|
---
|
||||||
- name: Enable nginx service
|
- name: Enable nginx service
|
||||||
become: true
|
become: true
|
||||||
service:
|
systemd:
|
||||||
enabled: yes
|
daemon_reload: "{{ nginx_service_nginx_daemon_reload }}"
|
||||||
name: nginx
|
enabled: "{{ nginx_service_nginx_enabled }}"
|
||||||
notify:
|
name: "{{ nginx_service_nginx_name }}"
|
||||||
- Restart nginx
|
register: nginx_service_nginx
|
||||||
|
when: nginx_service_nginx_manage
|
||||||
|
|
||||||
|
- name: Set nginx service state
|
||||||
|
become: true
|
||||||
|
systemd:
|
||||||
|
daemon_reload: "{{ nginx_service_nginx_daemon_reload }}"
|
||||||
|
name: "{{ nginx_service_nginx_name }}"
|
||||||
|
state: "{{ nginx_service_nginx_state }}"
|
||||||
|
register: nginx_service_nginx_state_info
|
||||||
|
when:
|
||||||
|
- nginx_service_nginx_manage
|
||||||
|
- nginx_service_nginx_state in ['reloaded', 'restarted', 'started', 'stopped']
|
||||||
|
Loading…
Reference in New Issue
Block a user