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.yml2
-rw-r--r--roles/postgres/tasks/create_user.yml2
-rw-r--r--roles/postgres/tasks/main.yml12
3 files changed, 8 insertions, 8 deletions
diff --git a/roles/postgres/tasks/create_db.yml b/roles/postgres/tasks/create_db.yml
index 7a4fe6e..5f8db70 100644
--- a/roles/postgres/tasks/create_db.yml
+++ b/roles/postgres/tasks/create_db.yml
@@ -1,4 +1,4 @@
- name: create database # noqa: no-changed-when
- command: createdb -U postgres -O "{{ postgres_db_user }}" "{{ postgres_db_name }}"
+ 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
index 4716939..483e507 100644
--- a/roles/postgres/tasks/create_user.yml
+++ b/roles/postgres/tasks/create_user.yml
@@ -1,4 +1,4 @@
- name: create database user # noqa: no-changed-when
- command: createuser -U postgres "{{ postgres_db_user }}"
+ 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
index a203574..8046d40 100644
--- a/roles/postgres/tasks/main.yml
+++ b/roles/postgres/tasks/main.yml
@@ -1,12 +1,12 @@
- name: install postgres
- package:
+ ansible.builtin.package:
name:
- postgresql-server
- postgresql-contrib
state: present
- name: create postgres directories
- file:
+ ansible.builtin.file:
path: "{{ postgres_dir }}/{{ item }}"
owner: "{{ postgres_user }}"
group: "{{ postgres_group }}"
@@ -17,13 +17,13 @@
- "data"
- name: delete default data dir if exists
- file:
+ ansible.builtin.file:
path: "{{ postgres_default_dir }}"
state: absent
when: postgres_dir != "/var/postgresql"
- name: link postgres directory to default one
- file:
+ ansible.builtin.file:
src: "{{ postgres_dir }}"
dest: "{{ postgres_default_dir }}"
owner: "{{ postgres_user }}"
@@ -34,7 +34,7 @@
when: postgres_dir != "/var/postgresql"
- name: init postgres database # noqa: no-changed-when
- shell:
+ 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'
@@ -45,7 +45,7 @@
- "'exists but is not empty' not in result.stderr"
- name: enable and restart postgres service
- service:
+ ansible.builtin.service:
name: postgresql
state: restarted
enabled: true
remember that computers suck.