systemd.yml 1.32 KB
Newer Older
U-PALLAS\krasinski's avatar
U-PALLAS\krasinski committed
1
2
---

3
4
5
6
7
8
9
10
# Dynamically set some variables commonly used by this task group.
- name: Setting facts for systemd operations.
  vars:
    external_postgres_suffix: "-{{ external_postgresql_version }}" 
    # Suffix will be '-version', e.g. '-13' for postgresql v13.x.x, or '' (nothing) if we do use the version distributed by the standard repository.
    suffix: "{{ ( use_distribution_postgresql == false ) | ternary(external_postgres_suffix, '') }}"
  set_fact:
    postgres_unit_file_name: "postgresql{{ suffix }}.service"
11

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# This task will place an 'override' for the systemd unit file distributed by postgresql.
# Modifying the original unit file is not recomended as it is replaced with each update of postgresql.
#
# Its current purpose is to define the path to the data directory where the database's actual data will be on the system.
# cf. The template file.
- name: "Define the {{ postgres_unit_file_name }} override file."
  template:
    src: templates/postgresql.service.j2
    dest: "/etc/systemd/system/{{ postgres_unit_file_name }}"
    owner: root
    group: wheel
    mode: '0644'
  when:
    - path_to_icat is defined
    - path_to_icat != None
    - path_to_icat | length > 0
U-PALLAS\krasinski's avatar
U-PALLAS\krasinski committed
28

29
- name: "Start {{ postgres_unit_file_name }}"
U-PALLAS\krasinski's avatar
U-PALLAS\krasinski committed
30
  systemd: 
31
    name: "{{ postgres_unit_file_name }}"
32
33
34
    state: started
    daemon_reload: yes
    enabled: yes
U-PALLAS\krasinski's avatar
U-PALLAS\krasinski committed
35
36

...