-
Notifications
You must be signed in to change notification settings - Fork 0
/
restore.yml
30 lines (25 loc) · 912 Bytes
/
restore.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
- name: ETCD Restore Playbook
hosts: etcd_nodes
become: yes
gather_facts: no
tasks:
- name: List available backups in the backup directory
shell: ls /var/lib/etcd/k8s_etcd_backup
register: backups
changed_when: false
- name: Display backup files
debug:
msg: "{{ backups.stdout_lines }}"
- name: Pause for user input
pause:
prompt: "List of available backups is above. Please enter the name of the backup file you want to restore (e.g., etcd-backup-2024-01-09_11:01PM.db.gz)."
register: user_input
run_once: true
- name: Set backup file for all hosts
set_fact:
backup_file: "{{ user_input.user_input }}"
run_once: true
delegate_to: localhost
- name: Execute ETCD Restore Script
shell: /opt/restore_etcd_backup.sh "{{ backup_file }}"
when: backup_file is defined and backup_file != ""