This commit is contained in:
Robert Kaussow 2024-08-13 09:40:06 +02:00
parent ad3a53bed7
commit e340d11ad5
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
2 changed files with 56 additions and 59 deletions

View File

@ -1,6 +1,6 @@
---
- name: Restart PostgreSQL
service:
ansible.builtin.service:
name: postgres
state: restarted
daemon_reload: True

View File

@ -1,7 +1,6 @@
---
- block:
- name: Create network specs
template:
ansible.builtin.template:
src: etc/containers/systemd/postgres.network.j2
dest: "/etc/containers/systemd/postgres.network"
owner: root
@ -22,11 +21,11 @@
register: __postgres_volumes_raw
- name: Register container volumes map
set_fact:
ansible.builtin.set_fact:
__postgres_volumes_map: "{{ __postgres_volumes_raw.results | json_query('[].volume') | items2dict(key_name='Name', value_name='Mountpoint') }}"
- name: Deploy postgres env files
template:
ansible.builtin.template:
src: "etc/containers/systemd/{{ item }}.j2"
dest: "/etc/containers/systemd/{{ item }}"
owner: root
@ -38,7 +37,7 @@
notify: __postgres_restart
- name: Create container specs
template:
ansible.builtin.template:
src: etc/containers/systemd/postgres.container.j2
dest: "/etc/containers/systemd/postgres.container"
owner: root
@ -56,10 +55,8 @@
when: "'postgres-initdb' in __postgres_volumes_map"
- name: Ensure service state
systemd:
ansible.builtin.service:
name: "postgres.service"
state: started
daemon_reload: True
enabled: True
become: True
become_user: root