Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kubespray
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Kubespray
Commits
cd429d36
Commit
cd429d36
authored
8 years ago
by
Matthew Mosesohn
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1159 from holser/etcd_backup_restore
Backup etcd
parents
771aef0b
c04a6254
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
roles/etcd/handlers/backup.yml
+45
-0
45 additions, 0 deletions
roles/etcd/handlers/backup.yml
roles/etcd/handlers/main.yml
+3
-0
3 additions, 0 deletions
roles/etcd/handlers/main.yml
with
48 additions
and
0 deletions
roles/etcd/handlers/backup.yml
0 → 100644
+
45
−
0
View file @
cd429d36
---
-
name
:
Backup etcd data
command
:
/bin/true
notify
:
-
Refresh Time Fact
-
Set etcd Backup Directory Prefix
-
Set Backup Directory
-
Create Backup Directory
-
Backup etcd v2 data
-
Backup etcd v3 data
when
:
etcd_cluster_is_healthy.rc ==
0
-
name
:
Refresh Time Fact
setup
:
filter=ansible_date_time
-
name
:
Set etcd Backup Directory Prefix
set_fact
:
etcd_backup_prefix
:
'
/var/backups'
-
name
:
Set Backup Directory
set_fact
:
etcd_backup_directory
:
"
{{
etcd_backup_prefix
}}/etcd-{{
ansible_date_time.date
}}_{{
ansible_date_time.time
}}"
-
name
:
Create Backup Directory
file
:
path
:
"
{{
etcd_backup_directory
}}"
state
:
directory
owner
:
root
group
:
root
mode
:
0600
-
name
:
Backup etcd v2 data
command
:
"
{{
bin_dir
}}/etcdctl
backup
--data-dir
{{
etcd_data_dir
}}
--backup-dir
{{
etcd_backup_directory
}}"
environment
:
ETCDCTL_API
:
2
retries
:
3
delay
:
"
{{
retry_stagger
|
random
+
3
}}"
-
name
:
Backup etcd v3 data
command
:
"
{{
bin_dir
}}/etcdctl
--endpoints={{
etcd_access_addresses
}}
snapshot
save
{{
etcd_backup_directory
}}/snapshot.db"
environment
:
ETCDCTL_API
:
3
retries
:
3
delay
:
"
{{
retry_stagger
|
random
+
3
}}"
This diff is collapsed.
Click to expand it.
roles/etcd/handlers/main.yml
+
3
−
0
View file @
cd429d36
...
...
@@ -2,10 +2,13 @@
-
name
:
restart etcd
command
:
/bin/true
notify
:
-
Backup etcd data
-
etcd | reload systemd
-
reload etcd
-
wait for etcd up
-
include
:
backup.yml
-
name
:
etcd | reload systemd
command
:
systemctl daemon-reload
...
...
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