File: pg_setup_systemd.yml

package info (click to toggle)
check-pgbackrest 2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,396 kB
  • sloc: perl: 972; sh: 488; python: 145; makefile: 33
file content (27 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
- name: Copy global systemd unit file to /etc/systemd/system
  ansible.builtin.copy:
    remote_src: true
    src: "/usr/lib/systemd/system/postgresql-{{ pg_version }}.service"
    dest: "/etc/systemd/system/{{ pg_service }}.service"
    mode: "0600"
    owner: root
    group: root
  become: true
  when:
    - ansible_os_family == 'RedHat'

- name: Update systemd unit file
  ansible.builtin.lineinfile:
    dest: "/etc/systemd/system/{{ pg_service }}.service"
    regexp: "{{ item.regexp }}"
    line: "{{ item.line }}"
    insertafter: "{{ item.insertafter | default(omit) }}"
  loop:
    - { regexp: "^Description=.*", line: "Description=Database server PG {{ pg_version }} - Instance: {{ pg_instance_name }}"}
    - { regexp: "^Environment=PGDATA.*", line: "Environment=PGDATA={{ pg_data }}" }
    - { regexp: "^PIDFile=.*", line: "PIDFile={{ pg_data }}/postmaster.pid", insertafter: "^\\[Service\\]$" }
    - { regexp: "^ExecStopPost=.*", line: "ExecStopPost=+/usr/bin/systemctl daemon-reload", insertafter: "^\\[Service\\]$" }
  become: true
  when:
    - ansible_os_family == 'RedHat'