此内容没有您所选择的语言版本。
Appendix C. Understanding the archive_config_inventory.yml file
The archive_config_inventory.yml
file is an example Ansible inventory file that you can use to backup and restore the configurations of Red Hat Hyperconverged Infrastructure for Virtualization cluster.
You can find this file at /etc/ansible/roles/gluster.ansible/playbooks/hc-ansible-deployment/archive_config_inventory.yml
on any hyperconverged host.
There are 2 playbooks archive_config.yml
and backup.yml
. The archive_config.yml
is a wrapper playbook, that in turn imports tasks/backup.yml
.
C.1. Configuration parameters for backup and restore in archive_config_inventory.yml
- hosts
- The backend FQDN of each host in the cluster that you want to back up.
- backup_dir
- The directory in which to store backup files.
- nbde_setup
- Upgrade does not support setting of NBDE, set to false.
- upgrade
- Set to true.
For example:
all: hosts: host1: host2: host3: vars: backup_dir: /archive nbde_setup: false upgrade: true
C.2. Creating the archive_config.yml
playbook file
Create the archive_config.yml
playbook file only if it is not available at the location /etc/ansible/roles/gluster.ansible/playbooks/hc-ansible-deployment
Add the following content to archive_config.yml
file:
--- - import_playbook: tasks/backup.yml tags: backupfiles
C.3. Creating the tasks/backup.yml
playbook file
Create the tasks/backup.yml
playbook file only if it is not available at the location /etc/ansible/roles/gluster.ansible/playbooks/hc-ansible-deployment
Add the following content to the backup.yml
file:
--- - hosts: all tasks: - name: Check if backup dir is already available stat: path: "{{ backup_dir }}" register: result - fail: msg: Backup directory "{{backup_dir}}" exists, remove it and retry when: result.stat.isdir is defined - name: Create temporary backup directory file: path: "{{ backup_dir }}" state: directory - name: Get the hostname shell: uname -n register: hostname - name: Add hostname details to archive shell: echo {{ hostname.stdout }} > {{ backup_dir }}/hostname - name: Dump the IP configuration details shell: ip addr show > {{ backup_dir }}/ipconfig - name: Dump the IPv4 routing information shell: ip route > {{ backup_dir }}/ip4route - name: Dump the IPv6 routing information shell: ip -6 route > {{ backup_dir }}/ip6route - name: Get the disk layout information shell: lsblk > {{ backup_dir }}/lsblk - name: Get the mount information for reference shell: df -Th > {{ backup_dir }}/mount - name: Check for VDO configuration stat: path: /etc/vdoconf.yml register: vdoconfstat - name: Copy VDO configuration, if available shell: cp -a /etc/vdoconf.yml "{{backup_dir}}" when: vdoconfstat.stat.isreg is defined - name: Backup fstab shell: cp -a /etc/fstab "{{backup_dir}}" - name: Backup glusterd config directory shell: cp -a /var/lib/glusterd "{{backup_dir}}" - name: Backup /etc/crypttab, if NBDE is enabled shell: cp -a /etc/crypttab "{{ backup_dir }}" when: nbde_setup is defined and nbde_setup - name: Backup keyfiles used for LUKS decryption shell: cp -a /etc/sd*keyfile "{{ backup_dir }}" when: nbde_setup is defined and nbde_setup - name: Check for the inventory file generated from cockpit stat: path: /etc/ansible/hc_wizard_inventory.yml register: inventory - name: Copy the host inventory file generated from cockpit shell: cp /etc/ansible/hc_wizard_inventory.yml {{ backup_dir }} when: inventory.stat.isreg is defined - name: Create a tar.gz with all the contents archive: path: "{{ backup_dir }}/*" dest: /root/rhvh-node-{{ hostname.stdout }}-backup.tar.gz