Add task to postgres role to manage service state

This commit is contained in:
ionutboangiu
2023-07-14 06:24:31 -04:00
committed by Dan Christian Bogos
parent 95b99614d5
commit 531c9941fa
2 changed files with 10 additions and 1 deletions

View File

@@ -2,3 +2,5 @@
postgresql_version: "postgresql"
postgresql_repo: "http://apt.postgresql.org/pub/repos/apt"
postgresql_key_url: "https://www.postgresql.org/media/keys/ACCC4CF8.asc"
postgresql_service_state: "started"
postgresql_service_enabled: "no"

View File

@@ -17,4 +17,11 @@
ansible.builtin.apt:
name: "{{ postgresql_version }}"
state: latest
update_cache: yes
update_cache: yes
- name: Manage the PostgreSQL service
become: yes
ansible.builtin.systemd:
name: postgresql
state: "{{ postgresql_service_state }}"
enabled: "{{ postgresql_service_enabled }}"