aboutsummaryrefslogtreecommitdiff
path: root/ansible/update_nginx.yml
blob: 4813e6c5d9ec175823dc610d9d8cf2eb76742665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
- name: Update nginx if needed
  hosts: vps
  become: true
  become_user: root
  tasks:

    - name: Ensure nginx is at the latest version
      ansible.builtin.package:
        name: nginx
        state: latest
      notify: restart nginx

    - name: Ensure nginx is running
      ansible.builtin.service:
        name: nginx
        state: started
        enabled: true

  handlers:
    - name: Restart nginx
      ansible.builtin.service:
        name: nginx
        state: restarted
...