Compare commits

..

No commits in common. "fix/more-resilient-postgresql-management" and "master" have entirely different histories.

2 changed files with 3 additions and 29 deletions

View file

@ -1,12 +1,12 @@
--- ---
- name: Gathering user's configuration. - name: Initialising the playbook.
hosts: all hosts: all
roles: roles:
- init - init
tags: tags:
- always - always
- name: Installing and configuring the PostgreSQL engine. - name: Setting up the Pleroma database.
hosts: pleroma_database hosts: pleroma_database
become: yes become: yes
become_method: sudo become_method: sudo
@ -14,19 +14,6 @@
- pleroma-database - pleroma-database
tags: tags:
- pleroma-database - pleroma-database
vars:
pleroma_database_installation: True
- name: Performing database administration.
hosts: pleroma_database
become: yes
become_method: sudo
roles:
- pleroma-database
tags:
- pleroma-database
vars:
pleroma_database_administration: True
- name: Setting up Pleroma. - name: Setting up Pleroma.
hosts: pleroma_main hosts: pleroma_main

View file

@ -3,7 +3,6 @@
apk: apk:
name: "{{ pleroma_postgres_packages }}" name: "{{ pleroma_postgres_packages }}"
state: present state: present
when: pleroma_database_installation | default(False)
- name: Postgres -- Ensure that the database is initialised. - name: Postgres -- Ensure that the database is initialised.
command: command:
@ -11,7 +10,6 @@
- /etc/init.d/postgresql - /etc/init.d/postgresql
- setup - setup
creates: /var/lib/postgresql/11/data/postgresql.conf creates: /var/lib/postgresql/11/data/postgresql.conf
when: pleroma_database_installation | default(False)
- name: Postgres -- Ensuring that the additional directories exist. - name: Postgres -- Ensuring that the additional directories exist.
file: file:
@ -23,7 +21,6 @@
loop: loop:
- "{{ pleroma_postgres_log_dir }}" - "{{ pleroma_postgres_log_dir }}"
- "{{ pleroma_postgres_confd }}" - "{{ pleroma_postgres_confd }}"
when: pleroma_database_installation | default(False)
- name: Postgres -- Ensuring that PostgreSQL is configured. - name: Postgres -- Ensuring that PostgreSQL is configured.
template: template:
@ -35,8 +32,6 @@
loop: loop:
- { src: etc_postgresql_pg_hba.conf.j2, dest: "{{ pleroma_postgres_base_conf }}/pg_hba.conf" } - { src: etc_postgresql_pg_hba.conf.j2, dest: "{{ pleroma_postgres_base_conf }}/pg_hba.conf" }
- { src: etc_postgresql_confd_postgresql_override.conf, dest: "{{ pleroma_postgres_confd }}/postgresql_override.conf" } - { src: etc_postgresql_confd_postgresql_override.conf, dest: "{{ pleroma_postgres_confd }}/postgresql_override.conf" }
when: pleroma_database_installation | default(False)
notify: "restart postgres"
- name: Postgres -- Ensuring that the symlink to the override config is present. - name: Postgres -- Ensuring that the symlink to the override config is present.
file: file:
@ -46,8 +41,6 @@
path: "{{ pleroma_postgres_confd_symlink }}" path: "{{ pleroma_postgres_confd_symlink }}"
src: "{{ pleroma_postgres_confd }}" src: "{{ pleroma_postgres_confd }}"
state: link state: link
when: pleroma_database_installation | default(False)
notify: "restart postgres"
- name: Postgres -- Ensuring that the override config is included in the main config. - name: Postgres -- Ensuring that the override config is included in the main config.
lineinfile: lineinfile:
@ -58,14 +51,12 @@
path: "{{ pleroma_postgres_base_conf }}/postgresql.conf" path: "{{ pleroma_postgres_base_conf }}/postgresql.conf"
regexp: ^.*include\s=\s'.*'.*$ regexp: ^.*include\s=\s'.*'.*$
state: present state: present
when: pleroma_database_installation | default(False)
notify: "restart postgres"
- name: Postgres -- Ensuring that PostgreSQL is enabled and started. - name: Postgres -- Ensuring that PostgreSQL is enabled and started.
service: service:
name: postgresql name: postgresql
enabled: yes enabled: yes
when: pleroma_database_installation | default(False) state: restarted
- name: Postgres -- Ensuring that Postgres is available before continuing. - name: Postgres -- Ensuring that Postgres is available before continuing.
wait_for: wait_for:
@ -74,7 +65,6 @@
host: localhost host: localhost
port: 5432 port: 5432
state: started state: started
when: pleroma_database_administration | default(False)
- name: Postgres -- Ensuring that the database user {{ pleroma.config.db.user }} exists. - name: Postgres -- Ensuring that the database user {{ pleroma.config.db.user }} exists.
become_user: postgres become_user: postgres
@ -87,7 +77,6 @@
state: present state: present
vars: vars:
ansible_ssh_pipelining: true ansible_ssh_pipelining: true
when: pleroma_database_administration | default(False)
- name: Postgres -- Ensuring that the database {{ pleroma.config.db.name }} exists. - name: Postgres -- Ensuring that the database {{ pleroma.config.db.name }} exists.
become_user: postgres become_user: postgres
@ -100,7 +89,6 @@
state: present state: present
vars: vars:
ansible_ssh_pipelining: true ansible_ssh_pipelining: true
when: pleroma_database_administration | default(False)
- name: Postgres -- Ensuring the PostgreSQL extensions is added to the database. - name: Postgres -- Ensuring the PostgreSQL extensions is added to the database.
become_user: postgres become_user: postgres
@ -115,4 +103,3 @@
- uuid-ossp - uuid-ossp
vars: vars:
ansible_ssh_pipelining: true ansible_ssh_pipelining: true
when: pleroma_database_administration | default(False)