---
# file: roles/postgres/tasks/replica.yml

- name: "{{ pg_data_directory }}/recovery.conf"
  template:
    src: "recovery.conf"
    dest: "{{ pg_data_directory }}/recovery.conf"
    owner: postgres
    group: postgres
    backup: yes
    mode: 0600
  notify: restart postgres
  when: pg_version is version('12', '<')
  tags: postgres

- name: "{{ pg_data_directory }}/standby.signal"
  file:
    owner: postgres
    group: postgres
    mode: 0600
    path: "{{ pg_data_directory }}/standby.signal"
    state: touch 
    access_time: preserve
    modification_time: preserve
  notify: restart postgres
  when: pg_version is version('12', '>=')
  tags: postgres
