RESTORE A CHEF VAULT ITEM
A vault item is made
of two data bags.
Data bag 1 is: VAULTNAME
Data bag 2 is: VAULTNAME_KEYS.
Restore the data bags and you restore the vault item.
Restore just (1) data bag and you break the entire vault so nobody else can use it until you restore the other data bag or delete your first data bag. The general process is:
Data bag 1 is: VAULTNAME
Data bag 2 is: VAULTNAME_KEYS.
Restore the data bags and you restore the vault item.
Restore just (1) data bag and you break the entire vault so nobody else can use it until you restore the other data bag or delete your first data bag. The general process is:
- Make a copy of the chef backup
- cd to the directory corresponding to the organization and vault you want to restore
- run the knife commands to restore the data bags
cd ~/backup_dir/organizations/your-org-dev/data_bags/certs/
knife data bag from file certs root_cert_wrtc_your-orgdev_com.json --config-file ~/.chef/knife.rb
knife data bag from file certs root_cert_wrtc_your-orgdev_com_keys.json --config-file ~/.chef/knife.rb
RESTORE A CHEF CLIENT
The general process
is:
- Install the 'jq' JSON manipulation tool
- Make a copy of the chef backup
- cd to the directory corresponding to the organization you want to restore a client to
- Extract the public key from the backup file
- Run the knife client command to create the client
sudo apt install jq
cd ~/backup_dir/organizations/your-org-dev/clients
jq .public_key .json > client-one.example.com.public_key
sed -i 's/\\n/\n/g' client-one.example.com.public_key
knife client create client-one.example.com --public-key client-one.example.com.public_key
NOTE: There is no obvious way to run 'knife client create' without it popping up an editor
RESTORE A CHEF NODE
The general process
is:
- Make a copy of the chef backup
- cd to the directory corresponding to the organization you want to restore a node to
- Run the knife node command to re-create the node
cd ~/backup_dir/organizations/your-org-dev/nodes
knife node from file EDV_omacneil_1558372161_AWS.fmr.com
No comments:
Post a Comment