summaryrefslogtreecommitdiff
path: root/playbooks/roles/nginx/tasks/main.yml
blob: b4cd6ede9a6f437faf61247ca5895a71cf564d23 (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
42
43
44
---

- name: Allow http
  community.general.ufw:
    rule: allow
    port: '80'
    proto: tcp

- name: Allow https
  community.general.ufw:
    rule: allow
    port: '443'
    proto: tcp
  notify:
    - Restart ufw

- name: Install nginx
  ansible.builtin.apt:
    name: nginx
    state: present
  notify:
    - Restart nginx

- name: Download dhparams
  ansible.builtin.get_url:
    url: "{{ dh_params_src }}"
    dest: /etc/nginx/dhparams.pem
    mode: '0755'

- name: Add system nginx config
  ansible.builtin.copy:
    src: nginx.conf
    dest: /etc/nginx/nginx.conf
    mode: '0755'

- name: Copy nginx sites
  ansible.builtin.template:
    src: "{{ item }}"
    dest: "/etc/nginx/sites-enabled/"
    mode: '0755'
  with_fileglob:
    - "templates/{{ inventory_hostname }}/*.conf"
  notify:
    - Restart nginx