summaryrefslogtreecommitdiff
path: root/roles/nginx/tasks/main.yml
blob: 4c9354f00d7bf13d0560042b0e8487a716a3070b (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- name: Install nginx
  community.general.apk:
    name: nginx

- name: Remove default nginx site config
  ansible.builtin.file:
    path: /etc/nginx/http.d/default.conf
    state: absent

- name: Install nginx config
  ansible.builtin.copy:
    src: nginx.conf
    dest: /etc/nginx/nginx.conf

- name: Install fastcgi_params
  ansible.builtin.copy:
    src: fastcgi_params
    dest: /etc/nginx/fastcgi_params

- name: Install mime.types
  ansible.builtin.copy:
    src: mime.types
    dest: /etc/nginx/mime.types

- name: Start nginx service and configure to restart on boot
  ansible.builtin.service:
    name: nginx
    enabled: true
    state: started

- name: Install script to update nginx
  ansible.builtin.copy:
    src: update_nginx
    dest: /usr/bin/update_nginx
    mode: "755"

- name: Install daily crontab to update nginx
  ansible.builtin.cron:
    special_time: daily
    name: Update nginx
    job: /usr/bin/update_nginx