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
954653f1
Commit
954653f1
authored
3 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Only setup backup when rsnapshot is configured, don't use password for root auth
Fix spaces
parent
ee8cddd9
Branches
Branches containing commit
No related tags found
1 merge request
!4
Only setup backup when rsnapshot is configured, don't use password for root auth
Pipeline
#3424
passed
3 years ago
Stage: test
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
mysql/defaults/main.yml
+2
-0
2 additions, 0 deletions
mysql/defaults/main.yml
mysql/tasks/main.yml
+34
-49
34 additions, 49 deletions
mysql/tasks/main.yml
postgres/defaults/main.yml
+1
-0
1 addition, 0 deletions
postgres/defaults/main.yml
postgres/tasks/main.yml
+21
-18
21 additions, 18 deletions
postgres/tasks/main.yml
with
58 additions
and
67 deletions
mysql/defaults/main.yml
+
2
−
0
View file @
954653f1
...
...
@@ -6,3 +6,5 @@ mysql_root_password: "{{ lookup('passwordstore', 'db/{{ ansible_hostname }}-mysq
mysql_backup_user
:
"
backup"
# yamllint disable-line rule:line-length
mysql_backup_password
:
"
{{
lookup('passwordstore',
'db/{{
ansible_hostname
}}-mysql-backup
create=true
length=20')
}}"
mysql_rsnapshot
:
false
This diff is collapsed.
Click to expand it.
mysql/tasks/main.yml
+
34
−
49
View file @
954653f1
...
...
@@ -24,30 +24,15 @@
state
:
started
enabled
:
true
-
name
:
ensure the mysql root user exists and has the correct password
mysql_user
:
name
:
root
password
:
"
{{
mysql_root_password
}}"
login_user
:
root
login_password
:
"
{{
mysql_root_password
}}"
register
:
mysql_root_creation_result
no_log
:
true
ignore_errors
:
true
-
name
:
initialize the mysql root user
mysql_user
:
name
:
root
password
:
"
{{
mysql_root_password
}}"
no_log
:
true
when
:
mysql_root_creation_result is failed
-
name
:
setup mysql backups with rsnapshot
when
:
'
{{
mysql_rsnapshot
}}'
block
:
-
name
:
ensure a read-only mysql user for backups exists
mysql_user
:
name
:
"
{{
mysql_backup_user
}}"
password
:
"
{{
mysql_backup_password
}}"
login_user
:
root
login_password
:
"
{{
mysql_root_password
}}"
priv
:
"
*.*:SELECT,LOCK
TABLES"
no_log
:
true
-
name
:
ensure the backup procedure can access the backup password
template
:
...
...
This diff is collapsed.
Click to expand it.
postgres/defaults/main.yml
+
1
−
0
View file @
954653f1
---
postgres_pgdg_repo
:
false
postgres_rsnapshot
:
false
This diff is collapsed.
Click to expand it.
postgres/tasks/main.yml
+
21
−
18
View file @
954653f1
...
...
@@ -36,6 +36,9 @@
state
:
started
enabled
:
true
-
name
:
configure snapshots
when
:
'
{{
postgres_rsnapshot
}}'
block
:
-
name
:
ensure we have our postgres backup script
copy
:
src
:
"
pgbackup{{
'-bullseye'
if
ansible_distribution_major_version|int(default=99)
>
10
else
''
}}.sh"
...
...
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