jhampson-dbre / home_assistant

Ansible collection for related Home Assistant roles
MIT License
12 stars 5 forks source link

Backup and restore feature #37

Open berga opened 2 years ago

berga commented 2 years ago

Hi Jared,

did you think about restoring config/secrets/snapshot from a previous installation or backing up before dismantle?

jhampson-dbre commented 2 years ago

Especially for the restore, I think that's something that can be added. Doing a fresh install going from Debian 10 to 11 was tricky to get the backup restored from the command line, so I think that functionality could be useful to include.

jhampson-dbre commented 2 years ago

my notes from restore:

  1. copy backup file to HA server (or skip if file is already on server)
    - hosts: all
    become: true
    tasks:
    - name: copy backup to pi
      copy:
        src: "/mnt/c/Users/jhamp/Downloads/Full Backup 2022-02-12 03_26_00.tar"
        dest: "/usr/share/hassio/backup/Full Backup 2022-02-12 03_26_00.tar"
  2. need to reload backups so it pickups up the new backup file as being available to restore
    root@rpi4-20220121:/usr/share/hassio/backup# ha backups reload
    Command completed successfully.
  3. we need to get the slug of the backup file to be able to restore it
    root@rpi4-20220121:/usr/share/hassio/backup# ha backups list
    backups:
    - content:
    addons:
    - a0d7b954_nodered
    - core_mariadb
    - a0d7b954_vscode
    - core_mosquitto
    - core_check_config
    - cebe7a76_hassio_google_drive_backup
    - a0d7b954_glances
    - 85d0901c_nginx_proxy_waf
    - a0d7b954_zwavejs2mqtt
    folders:
    - homeassistant
    - share
    - addons/local
    - ssl
    - media
    homeassistant: true
    date: "2022-02-12T09:26:01.764980+00:00"
    name: Full Backup 2022-02-12 03:26:00
    protected: true
    size: 111.83
    slug: ffecdc5f
    type: full
  4. now we can issue restore command - https://www.home-assistant.io/common-tasks/os/#creating-backup-using-the-home-assistant-command-line-interface
    ha backups restore ffecdc5f

    not sure if there are any prompts from the restore command.