Skip to content

Commit f32f43e

Browse files
committed
moved start service task
1 parent b658a55 commit f32f43e

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

roles/postgresql/tasks/main.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,22 @@
2828
volumes:
2929
- "{{ postgresql_data_dir }}:/var/lib/pgsql/data:Z"
3030
env:
31-
POSTGRESQL_USER: "postgres"
32-
POSTGRESQL_PASSWORD: "{{ postgresql_admin_password }}"
33-
POSTGRESQL_DATABASE: "{{ postgresql_databases[0].name | default('foreman') }}"
3431
POSTGRESQL_ADMIN_PASSWORD: "{{ postgresql_admin_password }}"
3532
quadlet_options:
3633
- |
3734
[Install]
3835
WantedBy=default.target
3936
37+
- name: Run daemon reload
38+
ansible.builtin.systemd:
39+
daemon_reload: true
40+
41+
- name: Start the PostgreSQL Service
42+
ansible.builtin.systemd:
43+
name: "{{ postgresql_container_name }}"
44+
enabled: true
45+
state: started
46+
4047
- name: Create PostgreSQL users
4148
community.postgresql.postgresql_user:
4249
name: "{{ item.name }}"
@@ -46,7 +53,6 @@
4653
login_host: localhost
4754
state: present
4855
loop: "{{ postgresql_users }}"
49-
when: postgresql_users | length > 0
5056

5157
- name: Create PostgreSQL databases
5258
community.postgresql.postgresql_db:
@@ -57,14 +63,3 @@
5763
login_host: localhost
5864
state: present
5965
loop: "{{ postgresql_databases }}"
60-
when: postgresql_databases | length > 0
61-
62-
- name: Run daemon reload
63-
ansible.builtin.systemd:
64-
daemon_reload: true
65-
66-
- name: Start the PostgreSQL Service
67-
ansible.builtin.systemd:
68-
name: "{{ postgresql_container_name }}"
69-
enabled: true
70-
state: started

0 commit comments

Comments
 (0)