nginx/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 03 Aug 2020 12:24:13 -0500
changeset 129 7ced28b4207c
parent 118 56bffa9ef826
child 175 5b2a3d2cce22
permissions -rw-r--r--
Added worker restats for uwsgi to reduce memory runaway.
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"
118
56bffa9ef826 Added nginx and oragono HUP reloading to systemd handlers. Added nginx config.
Luke Hoersten <luke@hoersten.org>
parents: 47
diff changeset
     6
  notify: restart nginx
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
- name: disable default site
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  become: yes
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
  file: path="/etc/nginx/sites-enabled/default" state="absent"
118
56bffa9ef826 Added nginx and oragono HUP reloading to systemd handlers. Added nginx config.
Luke Hoersten <luke@hoersten.org>
parents: 47
diff changeset
    11
  notify: reload nginx
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    12
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    13
- name: install base config
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    14
  become: yes
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    15
  copy: src="nginx.conf" dest="/etc/nginx/nginx.conf"
118
56bffa9ef826 Added nginx and oragono HUP reloading to systemd handlers. Added nginx config.
Luke Hoersten <luke@hoersten.org>
parents: 47
diff changeset
    16
  notify: reload nginx
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    18
- name: make stream dirs
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    19
  become: yes
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    20
  file: path="/etc/nginx/streams-{{item}}" state="directory"
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    21
  loop: ["available", "enabled"]
118
56bffa9ef826 Added nginx and oragono HUP reloading to systemd handlers. Added nginx config.
Luke Hoersten <luke@hoersten.org>
parents: 47
diff changeset
    22
  notify: reload nginx
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    23
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    24
- name: make config available
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    25
  become: yes
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    26
  template:
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    27
    src:  "{{nginx_conf_src}}"
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    28
    dest: "/etc/nginx/{{nginx_server_type}}s-available/{{nginx_server_name}}.conf"
118
56bffa9ef826 Added nginx and oragono HUP reloading to systemd handlers. Added nginx config.
Luke Hoersten <luke@hoersten.org>
parents: 47
diff changeset
    29
  notify: reload nginx
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    30
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    31
- name: enable config
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
  become: yes
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
  file:
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    34
    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
    35
    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
    36
    state: "link"
118
56bffa9ef826 Added nginx and oragono HUP reloading to systemd handlers. Added nginx config.
Luke Hoersten <luke@hoersten.org>
parents: 47
diff changeset
    37
  notify: reload nginx
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    38
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    39
- name: copy root files
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    40
  become: yes
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    41
  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
    42
  when: nginx_root
118
56bffa9ef826 Added nginx and oragono HUP reloading to systemd handlers. Added nginx config.
Luke Hoersten <luke@hoersten.org>
parents: 47
diff changeset
    43
  notify: reload nginx
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    44
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
- name: enable nginx service
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    46
  become: yes
118
56bffa9ef826 Added nginx and oragono HUP reloading to systemd handlers. Added nginx config.
Luke Hoersten <luke@hoersten.org>
parents: 47
diff changeset
    47
  systemd: name="nginx.service" enabled="yes" state="started" daemon_reload="yes"