nginx/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sun, 28 Jun 2020 08:59:54 -0500
changeset 50 15edca738a31
parent 47 3f1771bb0d79
child 118 56bffa9ef826
permissions -rw-r--r--
Added AdGuard Home role.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
     3
- name: apt install nginx
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  apt: name="nginx"
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
- name: disable default site
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  become: yes
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  file: path="/etc/nginx/sites-enabled/default" state="absent"
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    10
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    11
- name: install base config
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    12
  become: yes
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    13
  copy: src="nginx.conf" dest="/etc/nginx/nginx.conf"
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
  notify: restart nginx
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    16
- name: make stream dirs
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    17
  become: yes
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    18
  file: path="/etc/nginx/streams-{{item}}" state="directory"
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    19
  loop: ["available", "enabled"]
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    20
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    21
- name: make config available
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    22
  become: yes
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    23
  template:
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    24
    src:  "{{nginx_conf_src}}"
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    25
    dest: "/etc/nginx/{{nginx_server_type}}s-available/{{nginx_server_name}}.conf"
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    26
  notify: restart nginx
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    27
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    28
- name: enable config
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
  become: yes
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
  file:
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    31
    src:  "/etc/nginx/{{nginx_server_type}}s-available/{{nginx_server_name}}.conf"
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    32
    dest: "/etc/nginx/{{nginx_server_type}}s-enabled/{{nginx_server_name}}.conf"
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
    state: "link"
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
  notify: restart nginx
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    36
- name: copy root files
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    37
  become: yes
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    38
  copy: src="{{nginx_root_src}}" dest="{{nginx_root_dest}}/"
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    39
  when: nginx_root
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    40
  notify: restart nginx
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    41
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
- name: enable nginx service
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
  become: yes
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
  systemd: name="nginx" enabled="yes" state="started"