aboutsummaryrefslogblamecommitdiffhomepage
path: root/tasks/postgres-standby-barman.yml
blob: fb71d32e9dfd6c65381f115be64041702e97d90b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
   











                                                                                                                                 

                                                                                                                                   








                                          
                                     
---
- 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 barman clone script
  template: src=standby-barman-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