搜索

此内容没有您所选择的语言版本。

Appendix C. Understanding the archive_config_inventory.yml file

download PDF

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
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.