aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/postgres-standby-barman.yml
blob: 6a94b755d6fd77073c3a6bff4d0c10967f311dc0 (plain) (blame)
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
---
- name: Compute barman remote URL
  set_fact:
    barman_remote_url: "{{ scheme }}{{ user }}{{ server }}{{ delimiter }}{{ path }}"
    rsync_options: "{{ postgres_barman_rsync_options | default('') }}{{ rsync_password_file }}"
  vars:
    scheme: "{{ postgres_barman_rsync_enabled | ternary('rsync://', '') }}"
    user: "{{ postgres_barman_remote_user is defined | ternary(postgres_barman_remote_user + '@', '') }}"
    server: "{{ postgres_barman_server }}"
    delimiter: "{{ postgres_barman_rsync_enabled | ternary('', ':')}}"
    path: "{{ postgres_barman_path_prefix | default('~') }}"
    rsync_password_file: "{{ postgres_barman_rsync_enabled | ternary(' --password-file=/var/lib/postgresql/.rsync_pass ', '') }}"

- name: Copy secondary script
  template: src=standby-clone.sh.j2 dest=/root/standby-clone-{{ postgres_version }}-{{ postgres_cluster_name }}.sh mode=0755

- name: Copy rsync password file
  copy:
    content: "{{ barman_rsync_password }}"
    dest: /var/lib/postgresql/.rsync_pass
    owner: postgres
    group: postgres
    mode: 0400
  no_log: True
  when: postgres_barman_rsync_enabled