summaryrefslogtreecommitdiff
path: root/roles/web/tasks/nginx.yml
blob: 6348b24c57218ff06f9c3a06c6709fe9a9d3e0ea (plain) (blame)
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
- name: Install nginx
  ansible.builtin.package:
    name:
      - nginx
    state: present

- name: Enable nginx systemd unit 
  ansible.builtin.service:
    name: nginx
    enabled: yes
    state: started

- name: Setup sites directories to serve by nginx
  ansible.builtin.file:
    path: '{{ item }}'
    state: directory
    owner: root
    group: root
    mode: u+rw,g+r,o+r
  loop:
    - /etc/nginx/sites-available
    - /etc/nginx/sites-enabled

- name: Configure nginx
  ansible.builtin.copy:
    src: roles/web/files/nginx.conf
    dest: /etc/nginx/nginx.conf
    owner: root
    group: root
    mode: u+rw,g+,o+r
  notify:
    - Reload nginx

# TODO: logrotate