nginx/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 07 Oct 2024 15:25:37 -0500
changeset 238 bdbc88cb5078
parent 209 81014d20e5b1
permissions -rw-r--r--
Lots of updates and fixes for Ubuntu 24.04 Noble.
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
238
bdbc88cb5078 Lots of updates and fixes for Ubuntu 24.04 Noble.
Luke Hoersten <luke@hoersten.org>
parents: 209
diff changeset
     5
  apt: name="{{item}}"
bdbc88cb5078 Lots of updates and fixes for Ubuntu 24.04 Noble.
Luke Hoersten <luke@hoersten.org>
parents: 209
diff changeset
     6
  loop:
bdbc88cb5078 Lots of updates and fixes for Ubuntu 24.04 Noble.
Luke Hoersten <luke@hoersten.org>
parents: 209
diff changeset
     7
    - "nginx"
bdbc88cb5078 Lots of updates and fixes for Ubuntu 24.04 Noble.
Luke Hoersten <luke@hoersten.org>
parents: 209
diff changeset
     8
    - "libnginx-mod-stream"
118
56bffa9ef826 Added nginx and oragono HUP reloading to systemd handlers. Added nginx config.
Luke Hoersten <luke@hoersten.org>
parents: 47
diff changeset
     9
  notify: restart nginx
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
- name: disable default site
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
  become: yes
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
  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
    14
  notify: reload nginx
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    15
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    16
- name: install base config
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
  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
    19
  notify: reload nginx
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    21
- name: make stream dirs
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
  file: path="/etc/nginx/streams-{{item}}" state="directory"
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    24
  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
    25
  notify: reload nginx
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    26
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    27
- name: make config available
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    28
  become: yes
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    29
  template:
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    30
    src:  "{{nginx_conf_src}}"
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    31
    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
    32
  notify: reload nginx
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    33
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    34
- name: enable config
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
  become: yes
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
  file:
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    37
    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
    38
    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
    39
    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
    40
  notify: reload nginx
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
47
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    42
- name: copy root files
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    43
  become: yes
209
81014d20e5b1 Use rsync for nginx root copy.
Luke Hoersten <luke@hoersten.org>
parents: 175
diff changeset
    44
  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
    45
  when: nginx_root
3f1771bb0d79 Added stream support to nginx configs.
Luke Hoersten <luke@hoersten.org>
parents: 40
diff changeset
    46
40
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    47
- name: enable nginx service
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    48
  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
    49
  systemd: name="nginx.service" enabled="yes" state="started" daemon_reload="yes"