How do I automate a recovery plan
Use case
The first recovery plan are usually cumbersome with lots of manual steps. A good recovery plan is highly automated, to enable quick restoration of the system.
When considering this, you have already made the recovery guide. If no, start here for the guidelines.
Automating
Your guide will have some distinct parts, depending on which baseline you have decided upon.
- Setting up host and hypervisor.
- create and setup virtual machines in the hypervisor environment
- orchestrate the virtual machines
setting up host and hypervisor
-
assume that you have a functioning debian host
-
create a script to automate installation of hypervisor.
Go here for a complete install script of vmware workstation on Debian
It includes whatever patcehs are need to make vmware work.
-
set up vmnets
Look into the commandline tools called
vmware-networks
references:
create and setup virtual machines in the hypervisor environment
(untested)
-
Have the base files
Your VMware workstation VMs reside in VMX files. There might be an import for ova files.
-
clone the machines
copy the machines from backup to where you want them
Perhaps
vmrun clone
is relevant -
use
vmrun
The tool
vmrun
has many option. Seevmrun --help
.It is able to start, stop and lots of other things.
orchestrate the virtual machines
-
log into the machine
-
create script to run on the VMs
a) linux: Use a script
The script includes the commands that you otherwise need to type manually,
wget
on is useful.``` #!/bin/sh apt-get install apache wget config cp to somewhere cd /var/www/http git clone website service restart apache ```
b) Junos:
load override
You default image will not have much in terms of config.
A sequence like
``` edit load override scp://<serverip>/config commit ```
This could work well with
archive-sites
-
Use
expect
in bash or paramiko to execute the scriptsA bit on Expect
A bit on paramiko
Remarks
- This is guide work-in-progress