ansible-nginx/handlers/main.yml

47 lines
998 B
YAML

---
- name: reload nginx
ansible.builtin.command: nginx -t
notify:
- real-reload nginx
- docker reload nginx
- name: restart nginx
ansible.builtin.command: nginx -t
notify:
- real-restart nginx
- docker restart nginx
- name: real-reload nginx
ansible.builtin.service:
name: nginx
state: reloaded
when: ansible_virtualization_type != 'docker'
- name: real-restart nginx
ansible.builtin.service:
name: nginx
state: restarted
when: ansible_virtualization_type != 'docker'
- name: docker reload nginx
ansible.builtin.command: service nginx reload
args:
warn: false
when: ansible_virtualization_type == 'docker'
- name: docker restart nginx
ansible.builtin.command: service nginx restart
args:
warn: false
when: ansible_virtualization_type == 'docker'
- name: restart nginx freebsd
ansible.builtin.service:
name: nginx
state: restarted
when: ansible_distribution == "FreeBSD"
- name: setup
ansible.builtin.setup: