aboutsummaryrefslogtreecommitdiffstats
path: root/roles/postgres/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/postgres/tasks')
-rw-r--r--roles/postgres/tasks/create_db.yml6
-rw-r--r--roles/postgres/tasks/create_user.yml6
-rw-r--r--roles/postgres/tasks/main.yml53
3 files changed, 0 insertions, 65 deletions
diff --git a/roles/postgres/tasks/create_db.yml b/roles/postgres/tasks/create_db.yml
deleted file mode 100644
index d2f3676..0000000
--- a/roles/postgres/tasks/create_db.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-
-- name: create database # noqa: no-changed-when
- ansible.builtin.command: createdb -U postgres -O "{{ postgres_db_user }}" "{{ postgres_db_name }}"
- register: result
- failed_when: result.rc != 0 and "already exists" not in result.stderr
diff --git a/roles/postgres/tasks/create_user.yml b/roles/postgres/tasks/create_user.yml
deleted file mode 100644
index 793676e..0000000
--- a/roles/postgres/tasks/create_user.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-
-- name: create database user # noqa: no-changed-when
- ansible.builtin.command: createuser -U postgres "{{ postgres_db_user }}"
- register: result
- failed_when: result.rc != 0 and "already exists" not in result.stderr
diff --git a/roles/postgres/tasks/main.yml b/roles/postgres/tasks/main.yml
deleted file mode 100644
index f3d24da..0000000
--- a/roles/postgres/tasks/main.yml
+++ /dev/null
@@ -1,53 +0,0 @@
----
-
-- name: install postgres
- ansible.builtin.package:
- name:
- - postgresql-server
- - postgresql-contrib
- state: present
-
-- name: create postgres directories
- ansible.builtin.file:
- path: "{{ postgres_dir }}/{{ item }}"
- owner: "{{ postgres_user }}"
- group: "{{ postgres_group }}"
- mode: "0750"
- state: directory
- loop:
- - ""
- - "data"
-
-- name: delete default data dir if exists
- ansible.builtin.file:
- path: "{{ postgres_default_dir }}"
- state: absent
- when: postgres_dir != "/var/postgresql"
-
-- name: link postgres directory to default one
- ansible.builtin.file:
- src: "{{ postgres_dir }}"
- dest: "{{ postgres_default_dir }}"
- owner: "{{ postgres_user }}"
- group: "{{ postgres_group }}"
- state: link
- mode: "0750"
- follow: false
- when: postgres_dir != "/var/postgresql"
-
-- name: init postgres database # noqa: no-changed-when
- ansible.builtin.shell:
- cmd: |
- su "{{ postgres_user }}" \
- -c 'initdb -D "{{ postgres_dir }}/data/" -U "{{ postgres_db_user }}" --encoding=UTF-8 --locale=en_US.UTF-8'
- chdir: "{{ postgres_dir }}"
- register: result
- failed_when:
- - result.rc != 0
- - "'exists but is not empty' not in result.stderr"
-
-- name: enable and restart postgres service
- ansible.builtin.service:
- name: postgresql
- state: restarted
- enabled: true
remember that computers suck.