Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
databases
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infra
ansible-shared
databases
Commits
42b68751
Commit
42b68751
authored
2 years ago
by
Thomas Schneider
Browse files
Options
Downloads
Patches
Plain Diff
postgres: Add Commvault backup compatibility
parent
1014451f
No related branches found
No related tags found
No related merge requests found
Pipeline
#4378
passed
2 years ago
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
postgres/defaults/main.yml
+8
-0
8 additions, 0 deletions
postgres/defaults/main.yml
postgres/handlers/main.yml
+6
-0
6 additions, 0 deletions
postgres/handlers/main.yml
postgres/tasks/main.yml
+48
-2
48 additions, 2 deletions
postgres/tasks/main.yml
with
62 additions
and
2 deletions
postgres/defaults/main.yml
+
8
−
0
View file @
42b68751
...
...
@@ -2,3 +2,11 @@
postgres_pgdg_repo
:
false
postgres_rsnapshot
:
false
postgres_commvault_compat
:
false
postgres_versions_debian
:
buster
:
"
11"
bullseye
:
"
13"
bookworm
:
"
14"
postgres_version
:
"
{{
postgres_versions_debian[ansible_distribution_release]
}}"
This diff is collapsed.
Click to expand it.
postgres/handlers/main.yml
0 → 100644
+
6
−
0
View file @
42b68751
---
-
name
:
Restart Postgres
systemd
:
name
:
postgresql.service
state
:
restarted
This diff is collapsed.
Click to expand it.
postgres/tasks/main.yml
+
48
−
2
View file @
42b68751
...
...
@@ -17,8 +17,7 @@
-
name
:
ensure postgres packages are installed
apt
:
name
:
# yamllint disable-line rule:line-length
-
postgresql{{ "-{}".format(postgres_version) if postgres_version is defined }}
-
postgresql-{{ postgres_version }}
-
python3-psycopg2
-
libpq-dev
state
:
present
...
...
@@ -41,6 +40,7 @@
block
:
-
name
:
ensure we have our postgres backup script
copy
:
# yamllint disable-line rule:line-length
src
:
"
pgbackup{{
'-bullseye'
if
ansible_distribution_major_version|int(default=99)
>
10
else
''
}}.sh"
dest
:
/usr/local/bin/pgbackup.sh
owner
:
root
...
...
@@ -59,3 +59,49 @@
file
:
path
:
/etc/cron.d/postgres-snapshot
state
:
absent
-
name
:
Configure Commvault backup compatibility
when
:
postgres_commvault_compat
block
:
-
name
:
Create WAL backup directory
file
:
path
:
/var/backups/pg_wal
state
:
directory
owner
:
postgres
group
:
postgres
mode
:
'
0750'
-
name
:
Configure Postgres WAL archive
lineinfile
:
path
:
/etc/postgresql/{{ postgres_version }}/main/postgresql.conf
regexp
:
"
{{
item.regexp
}}"
line
:
"
{{
item.line
}}"
loop
:
-
regexp
:
^archive_mode\s*=
line
:
archive_mode = on
-
regexp
:
^archive_command\s*=
line
:
archive_command = 'cp %p /var/backups/pg_wal/%f'
notify
:
-
Restart Postgres
-
name
:
Configure Postgres ident mappings
lineinfile
:
path
:
/etc/postgresql/{{ postgres_version }}/main/pg_ident.conf
regexp
:
"
{{
item.regexp
}}"
line
:
"
{{
item.line
}}"
loop
:
-
regexp
:
^postgres\s+postgres\s+postgres$
line
:
"
postgres
\t
postgres
\t\t
postgres"
-
regexp
:
^postgres\s+root\s+postgres$
line
:
"
postgres
\t
root
\t\t\t
postgres"
notify
:
-
Restart Postgres
-
name
:
Configure Postgres to use ident mapping for postgres role
lineinfile
:
path
:
/etc/postgresql/{{ postgres_version }}/main/pg_hba.conf
regexp
:
^local\s+all\s+postgres\s+peer
# yamllint disable-line rule:line-length
line
:
"
local
all
postgres
peer
map=postgres"
notify
:
-
Restart Postgres
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment