vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on "Patroni" and DCS "etcd" or "consul"). Automating with Ansible.
MIT License
1.29k stars 352 forks source link

add install wal-g #28

Closed patsevanton closed 4 years ago

patsevanton commented 4 years ago

Конфликтов нет. Проверю попозже.

vitabaks commented 4 years ago

@patsevanton

I suggest moving the variable "wal_g_ver" below the variable "patroni_create_replica_methods".

And the comment "# version for deploy etcd cluster" needs to be fixed.

It is also worth adding the variable "wal_g_install" which will be enabled by default, but if necessary, you can disable the wal-g installation. There may be a situation where you do not need to install wal-g using this playbook, for example, when the wal-g is already installed in any other method.

Example:

# WAL-G
wal_g_install: "true" # or "false"
wal_g_install_version: "v0.2.14" # (if patroni_create_replica_methods.wal_g is defined and wal_g_install: "true")
vitabaks commented 4 years ago

The wal-g.yml file does not contain the task of preparing the wal-g configuration.

patsevanton commented 4 years ago

image

deploy_pgcluster.yml

    - name: Show wal_g variable
      debug:
        msg: "wal_g_install is {{ wal_g_install }}"

    - name: "loop through list from a variable patroni_create_replica_methods"
      debug:
        msg: "An item: {{ item }}"
      with_items: "{{ patroni_create_replica_methods }}"

    - import_tasks: tasks/wal-g.yml
      when: wal_g_install == "true" and wal_g in patroni_create_replica_methods
      tags: wal-g

main.yml

patroni_create_replica_methods:
#  - pgbackrest
#  - wal_e
  - wal_g
#  - basebackup
pgbackrest:
  - { option: "command",    value: "/usr/bin/pgbackrest --stanza=<stanza_name> --delta restore" }
  - { option: "keep_data",  value: "True" }
  - { option: "no_params",  value: "True" }
wal_e:
  - { option: "command",    value: "patroni_wale_restore" }
  - { option: "no_master",  value: "1" }
  - { option: "envdir",     value: "/etc/wal_e/envdir" }
  - { option: "use_iam",    value: "1" }
wal_g:
  - { option: "command",    value: "patroni_walg_restore" }
  - { option: "no_master",  value: "1" }
  - { option: "envdir",     value: "/etc/wal_g/envdir" }
  - { option: "use_iam",    value: "1" }

# WAL-G
wal_g_install: "true" # or "true"
wal_g_ver: "v0.2.14" # (if patroni_create_replica_methods.wal_g is defined and wal_g_install: "true")
vitabaks commented 4 years ago

when: wal_g_install == "true" and 'wal_g' in patroni_create_replica_methods or: when: wal_g_install == "true" and patroni_create_replica_methods.wal_g is defined

patsevanton commented 4 years ago

Changed

https://github.com/patsevanton/postgresql_cluster/commit/dcf8eaa8183d54e41fd86ea203dcf3cb773eeb35

This is simple comment

vitabaks commented 4 years ago

d7bea1379b2588ea41644e699457ebf2a25972ce - this is superfluous, please remove. These tasks are necessary only for debugging and should not fall into the PR.

patsevanton commented 4 years ago

Wait release after https://github.com/wal-g/wal-g/pull/574

patsevanton commented 4 years ago

Create new PR. Close