postgresql/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 03 Apr 2023 13:20:18 -0500
changeset 211 9e2b2cc6ccf1
parent 40 b42b417751e5
child 227 2e0366f2dcbe
permissions -rw-r--r--
Version update
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
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: install postgresql
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="{{postgresql_apt_packages}}"
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: configure postgresql data dir
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
  lineinfile:
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
    path: "{{postgresql_config_path}}"
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
    regexp: "^data_directory = "
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
    line: "data_directory = '{{postgresql_data_dir}}'"
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
  notify: restart postgres
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
- name: create postgresql data dir
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
  become: yes
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
  file:
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    path: "{{postgresql_data_dir}}"
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
    state: "directory"
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
    mode: "0700"
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
    owner: "postgres"
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
    group: "postgres"
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
  notify: restart postgres
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
- name: ensure postgresql is started
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
  become: yes
b42b417751e5 Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
  systemd: name="postgresql" enabled="yes" state="started"