roles/postgresql/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sun, 19 Jan 2020 13:40:16 -0600
changeset 83 ccd5604f5b69
parent 75 d8c87a41cc6d
permissions -rw-r--r--
Fixed admin email.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: install postgresql
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  apt: name="{{postgresql_apt_packages}}"
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
- name: configure postgresql data dir
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  become: yes
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  lineinfile:
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
    path: "{{postgresql_config_path}}"
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
    regexp: "^data_directory = "
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
    line: "data_directory = '{{postgresql_data_dir}}'"
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
  notify: restart postgres
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
- name: create postgresql data dir
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
  become: yes
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
  file:
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    path: "{{postgresql_data_dir}}"
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
    state: "directory"
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
    mode: "0700"
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
    owner: "postgres"
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
    group: "postgres"
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
  notify: restart postgres
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
- name: ensure postgresql is started
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
  become: yes
d8c87a41cc6d Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
  systemd: name="postgresql" enabled="yes" state="started"