Skip to content

Commit

Permalink
Merge pull request #121 from jt-edb/merge_3_0_0_master
Browse files Browse the repository at this point in the history
Merge REL-3_0_0 into master
  • Loading branch information
vibhorkumar123 authored Jan 19, 2021
2 parents b8e090c + f0bbc12 commit f345bfc
Show file tree
Hide file tree
Showing 30 changed files with 180 additions and 94 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,35 +345,35 @@ playbook:
roles:
- role: setup_repo
when: "'setup_repo' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_repo' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: install_dbserver
when: "'install_dbserver' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'install_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: init_dbserver
when: "'init_dbserver' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'init_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_replication
when: "'setup_replication' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_replication' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_efm
when: "'setup_efm' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_efm' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_pgpool2
when: "'setup_pgpool2' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_pgpool2' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: manage_pgpool2
when: "'manage_pgpool2' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'manage_pgpool2' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: manage_dbserver
when: "'manage_dbserver' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'manage_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_pemserver
when: "'setup_pemserver' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_pemserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_pemagent
when: "'setup_pemagent' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_pemagent' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_pgbouncer
when: "'setup_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: manage_pgbouncer
when: "'manage_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'manage_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_barmanserver
when: "'setup_barmanserver' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_barmanserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_barman
when: "'setup_barman' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_barman' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: autotuning
when: "'autotuning' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'autotuning' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
```

You can customize the above example to install Postgres, EPAS, EFM or PEM or
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.0.2
21 changes: 10 additions & 11 deletions playbook-examples/pem_server_primary_two_standbys/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
become: yes
gather_facts: yes

# When using collections
#collections:
# - edb_devops.edb_postgres
collections:
- edb_devops.edb_postgres

pre_tasks:
- name: Initialize the user defined variables
Expand All @@ -19,18 +18,18 @@

roles:
- role: setup_repo
when: "'setup_repo' in host_supported_roles"
when: "'setup_repo' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: install_dbserver
when: "'install_dbserver' in host_supported_roles"
when: "'install_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: init_dbserver
when: "'init_dbserver' in host_supported_roles"
when: "'init_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: autotuning
when: "'autotuning' in host_supported_roles"
when: "'autotuning' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_replication
when: "'setup_replication' in host_supported_roles"
when: "'setup_replication' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_efm
when: "'setup_efm' in host_supported_roles"
when: "'setup_efm' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_pemserver
when: "'setup_pemserver' in host_supported_roles"
when: "'setup_pemserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_pemagent
when: "'setup_pemagent' in host_supported_roles"
when: "'setup_pemagent' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
13 changes: 6 additions & 7 deletions playbook-examples/primary_only/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
become: yes
gather_facts: yes

# When using collections
#collections:
# - edb_devops.edb_postgres
collections:
- edb_devops.edb_postgres

pre_tasks:
- name: Initialize the user defined variables
Expand All @@ -18,10 +17,10 @@

roles:
- role: setup_repo
when: "'setup_repo' in host_supported_roles"
when: "'setup_repo' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: install_dbserver
when: "'install_dbserver' in host_supported_roles"
when: "'install_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: init_dbserver
when: "'init_dbserver' in host_supported_roles"
when: "'init_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: autotuning
when: "'autotuning' in host_supported_roles"
when: "'autotuning' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
17 changes: 8 additions & 9 deletions playbook-examples/primary_two_standbys_with_efm/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
become: yes
gather_facts: yes

# When using collections
#collections:
# - edb_devops.edb_postgres
collections:
- edb_devops.edb_postgres

pre_tasks:
- name: Initialize the user defined variables
Expand All @@ -18,14 +17,14 @@

roles:
- role: setup_repo
when: "'setup_repo' in host_supported_roles"
when: "'setup_repo' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: install_dbserver
when: "'install_dbserver' in host_supported_roles"
when: "'install_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: init_dbserver
when: "'init_dbserver' in host_supported_roles"
when: "'init_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_replication
when: "'setup_replication' in host_supported_roles"
when: "'setup_replication' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: autotuning
when: "'autotuning' in host_supported_roles"
when: "'autotuning' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_efm
when: "'setup_efm' in host_supported_roles"
when: "'setup_efm' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
30 changes: 15 additions & 15 deletions playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@

roles:
- role: setup_repo
when: "'setup_repo' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_repo' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: install_dbserver
when: "'install_dbserver' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'install_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: init_dbserver
when: "'init_dbserver' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'init_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_replication
when: "'setup_replication' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_replication' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_efm
when: "'setup_efm' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_efm' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_pgpool2
when: "'setup_pgpool2' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_pgpool2' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: manage_pgpool2
when: "'manage_pgpool2' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'manage_pgpool2' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: manage_dbserver
when: "'manage_dbserver' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'manage_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_pemserver
when: "'setup_pemserver' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_pemserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_pemagent
when: "'setup_pemagent' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_pemagent' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_pgbouncer
when: "'setup_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: manage_pgbouncer
when: "'manage_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'manage_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_barmanserver
when: "'setup_barmanserver' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_barmanserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: setup_barman
when: "'setup_barman' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_barman' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
- role: autotuning
when: "'autotuning' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'autotuning' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
2 changes: 0 additions & 2 deletions plugins/lookup/barman_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
- dict: node_type, hostname, ansible_host (public IP address), private_ip
"""

from ansible.errors import AnsibleError
from ansible.inventory.manager import InventoryManager
from ansible.plugins.lookup import LookupBase


Expand Down
2 changes: 0 additions & 2 deletions plugins/lookup/pem_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
- dict: node_type, hostname, ansible_host (public IP address), private_ip
"""

from ansible.errors import AnsibleError
from ansible.inventory.manager import InventoryManager
from ansible.plugins.lookup import LookupBase


Expand Down
2 changes: 0 additions & 2 deletions plugins/lookup/pem_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
- dict: node_type, hostname, ansible_host (public IP address), private_ip
"""

from ansible.errors import AnsibleError
from ansible.inventory.manager import InventoryManager
from ansible.plugins.lookup import LookupBase


Expand Down
3 changes: 1 addition & 2 deletions plugins/lookup/pg_sr_cluster_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"""

from ansible.errors import AnsibleError
from ansible.inventory.manager import InventoryManager
from ansible.plugins.lookup import LookupBase


Expand Down Expand Up @@ -113,7 +112,7 @@ def run(self, terms, variables=None, **kwargs):
raise AnsibleError(
"Inventory error with the following standbys nodes %s. "
"Upstream node is not configured or not found"
% [s for s in pg_standbys.keys()]
% [s for s in pg_standbys.keys()]
)

pg_standbys_len = len(pg_standbys.keys())
Expand Down
2 changes: 1 addition & 1 deletion plugins/lookup/supported_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
- string
"""

from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase

GROUP_ROLES = {
Expand Down Expand Up @@ -69,6 +68,7 @@
]
}


class LookupModule(LookupBase):
def run(self, terms, variables=None, **kwargs):
supported_roles = []
Expand Down
4 changes: 3 additions & 1 deletion roles/autotuning/tasks/tune_postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@
{{ [ _sys_nvcpus | int * 4, 100 ] | max }}
# Set the shared_buffers value to: LEAST(Total RAM / 2, 10GB)
# Note: we reduce it to LEAST(Total RAM / 3, 10GB) for being less aggressive
# on systems without swap space.
- name: Set the variable _pg_shared_buffers_mb
set_fact:
_pg_shared_buffers_mb: >-
{{ [ (_sys_memtotal_mb | int / 2) | int, 10 * 1024 ] | min }}
{{ [ (_sys_memtotal_mb | int / 3) | int, 10 * 1024 ] | min }}
# Set the work_mem value to: ((Total RAM - shared_buffers)/(16 x CPU cores))
- name: Set the variable _pg_work_mem_mb
Expand Down
2 changes: 1 addition & 1 deletion roles/manage_dbserver/tasks/generate_password.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
no_log: "{{ disable_logging }}"
delegate_to: localhost

- name: Make sure file is has permission for owner only
- name: Make sure file has permission for owner only
file:
path: "{{ passfile }}"
mode: 0600
Expand Down
2 changes: 1 addition & 1 deletion roles/manage_pgbouncer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Below is an example of how to include the `manage_pgbouncer` role:
# Ensure to execute this role only on hosts from the pgbouncer group, or,
# from the primary and standby groups having the 'pgbouncer' inventory
# host var is set to true.
when: "'manage_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'manage_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
```

Defining and adding variables is done in the `set_fact` of the `pre_tasks`.
Expand Down
2 changes: 1 addition & 1 deletion roles/setup_barman/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Below is an example of how to include the `setup_barman` role:
roles:
- setup_barman
when: "'setup_barman' in lookup('edb_devops.edb_postgres.supported_roles')"
when: "'setup_barman' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
```

Defining and adding variables is done in the `set_fact` of the `pre_tasks`.
Expand Down
46 changes: 46 additions & 0 deletions roles/setup_barman/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
galaxy_info:
author: EDB
description: Setup Barman backups
company: "EnterpriseDB"

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: BSD

min_ansible_version: 2.8

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
platforms:
- name: CentOS
versions:
- 7
- name: Red Hat
versions:
- 7

galaxy_tags:
- database
- postgresql
- postgres
- backups
- barman

dependencies: []
2 changes: 1 addition & 1 deletion roles/setup_barman/tasks/configure_barman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- name: Ensure the barman configuration for the current host is present
template:
src: "./templates/barman.{{ barman_backup_method }}.template"
dest: "{{ barman_configuration_files_directory }}/{{ ansible_hostname }}.conf"
dest: "{{ barman_configuration_files_directory }}/{{ inventory_hostname }}.conf"
owner: "{{ barman_user }}"
group: "{{ barman_group }}"
mode: 0700
Expand Down
2 changes: 1 addition & 1 deletion roles/setup_barman/tasks/configure_pg_backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
- name: archive_mode
value: "on"
- name: archive_command
value: "barman-wal-archive {{ hostvars[ansible_hostname].barman_server_private_ip }} {{ ansible_hostname }} %p"
value: "barman-wal-archive {{ hostvars[inventory_hostname].barman_server_private_ip }} {{ inventory_hostname }} %p"
no_log: "{{ disable_logging }}"
when: barman_backup_method == 'rsync'
Loading

0 comments on commit f345bfc

Please sign in to comment.