nginx/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Thu, 23 Feb 2023 17:55:33 -0600
changeset 210 dcdb18c5dc21
parent 209 81014d20e5b1
child 238 bdbc88cb5078
permissions -rw-r--r--
Version updates
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
209
81014d20e5b1 Use rsync for nginx root copy.
Luke Hoersten <luke@hoersten.org>
parents: 175
diff changeset
    41
  synchronize: src="{{nginx_root_src}}" dest="{{nginx_root_dest}}/"
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    42
  when: nginx_root
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    43
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
- name: enable nginx service
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
  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
    46
  systemd: name="nginx.service" enabled="yes" state="started" daemon_reload="yes"