1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ansible Automation Platform 2.6 コンテナ環境のバックアップ・リストア検証

Posted at

はじめに

Ansible Automation Platform(AAP) 2.6 のコンテナ環境で提供されるバックアップ・リストア機能の動作確認を行いました。

本記事では、PowerVS上のRHEL9.6(ppc64le)環境での実施手順と結果を共有します

以下の流れで実行しています。

  1. バックアップ用テスト定義追加
  2. インベントリー・ファイル作成
  3. バックアップ実行 (ansible-playbook -i ansible.containerized_installer.backup )
  4. バックアップ用テスト定義削除
  5. 取得したバックアップのリストア (ansible-playbook -i inventory_backuptest ansible.containerized_installer.restore)

参考:

想定読者

・AAPをコンテナ環境で運用している方
・Powerアーキテクチャでの検証を探している方


実行環境

S1122 RHEL 9.6 (ppc64le)  (PowerVS 提供イメージを使用)

# LD_SHOW_AUXV=1 /bin/true | grep _PLATFORM
AT_PLATFORM:          power11
AT_BASE_PLATFORM:     power11
# cat /etc/os-release 
NAME="Red Hat Enterprise Linux"
VERSION="9.6 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.6"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.6 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"
BUG_REPORT_URL="https://issues.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.6
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.6"

リソース: 1 CPU, 32GB Memory

1 node 構成 (単体ノードにAAPを導入)


インストールは下記で確認した内容を記載しています。


バックアップ用テスト定義追加

バックアップ用のテスト定義を追加します。

組織に backuptest という名前の定義を追加しています。

test1.png

他にインベントリー、ホスト、テンプレートに作成していたバックアップテスト用定義を作成しました。


インベントリー・ファイル作成

バックアップ・リストアは、インストールと同様に root ユーザー以外での実行です。

$ whoami
ansible

バックアップサイズ削減のため、公式ドキュメントで推奨されているオプションを有効化しました。

インストールの際に使用したインベントリー・ファイルへ use_archive_compression=trueuse_db_compression=true を追加しています。

ここではインベントリー・ファイルは inventory_backuptest というファイル名としました。
IPアドレスとホスト名はマスキングしています。

$ cat inventory_backuptest
# This is the AAP installer inventory file intended for the Container growth deployment topology.
# This inventory file expects to be run from the host where AAP will be installed.
# Please consult the Ansible Automation Platform product documentation about this topology's tested hardware configuration.
# https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform/2.6/html/tested_deployment_models/container-topologies
#
# Please consult the docs if you're unsure what to add
# For all optional variables please consult the included README.md
# or the Ansible Automation Platform documentation:
# https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform/2.6/html/containerized_installation

# This section is for your AAP Gateway host(s)
# -----------------------------------------------------
[automationgateway]
xxx.xx.xxx.xx

# This section is for your AAP Controller host(s)
# -----------------------------------------------------
[automationcontroller]
xxx.xx.xxx.xx

# This section is for your AAP Automation Hub host(s)
# -----------------------------------------------------
[automationhub]
xxx.xx.xxx.xx

# This section is for your AAP EDA Controller host(s)
# -----------------------------------------------------
[automationeda]
xxx.xx.xxx.xx

# This section is for the AAP database
# -----------------------------------------------------
[database]
xxx.xx.xxx.xx

[all:vars]
# Ansible
ansible_connection=local

# Common variables
# https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform/2.6/html/containerized_installation/appendix-inventory-files-vars#ref-general-inventory-variables
# -----------------------------------------------------
postgresql_admin_username=postgres
postgresql_admin_password=xxxxxx

bundle_install=true
# The bundle directory must include /bundle in the path
bundle_dir='{{ lookup("ansible.builtin.env", "PWD") }}/bundle'


redis_mode=standalone

# AAP Gateway
# https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform/2.6/html/containerized_installation/appendix-inventory-files-vars#ref-gateway-variables
# -----------------------------------------------------
gateway_admin_password=xxxxxx
gateway_pg_host=xxx.xx.xxx.xx
gateway_pg_password=xxxxxx

# AAP Controller
# https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform/2.6/html/containerized_installation/appendix-inventory-files-vars#ref-controller-variables
# -----------------------------------------------------
controller_admin_password=xxxxxx
controller_pg_host=xxx.xx.xxx.xx
controller_pg_password=xxxxxx
controller_percent_memory_capacity=0.5

# AAP Automation Hub
# https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform/2.6/html/containerized_installation/appendix-inventory-files-vars#ref-hub-variables
# -----------------------------------------------------
hub_admin_password=xxxxxx
hub_pg_host=xxx.xx.xxx.xx
hub_pg_password=xxxxxx
hub_seed_collections=false

# AAP EDA Controller
# https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform/2.6/html/containerized_installation/appendix-inventory-files-vars#event-driven-ansible-controller
# -----------------------------------------------------
eda_admin_password=xxxxxx
eda_pg_host=xxx.xx.xxx.xx
eda_pg_password=xxxxxx

# Global control of compression for filesystem backup files
use_archive_compression=true

# Component-level control of compression for filesystem backup files
#controller_use_archive_compression=true
#eda_use_archive_compression=true
#gateway_use_archive_compression=true
#hub_use_archive_compression=true
#pcp_use_archive_compression=true
#postgresql_use_archive_compression=true
#receptor_use_archive_compression=true
#redis_use_archive_compression=true

# Global control of compression for database backup files
use_db_compression=true

# Component-level control of compression for database backup files
#controller_use_db_compression=true
#eda_use_db_compression=true
#hub_use_db_compression=true
#gateway_use_db_compression=true

バックアップ実行

ansible-playbook -i inventory_backuptest ansible.containerized_installer.backup でバックアップを実行します。

バックアップ実行ログ

$ time  ansible-playbook -i inventory_backuptest ansible.containerized_installer.backup
[WARNING]: running playbook inside collection ansible.containerized_installer

PLAY [Preflight checks] ****************************************************************************************************************************************

TASK [Gather facts] ********************************************************************************************************************************************
ok: [localhost]

TASK [ansible.containerized_installer.preflight : Ensure registry username and password are provided] **********************************************************
skipping: [localhost]


~ 省略 ~ 


TASK [ansible.containerized_installer.postgresql : Download the postgresql tarball] ****************************************************************************
changed: [xxx.xx.xxx.xx]

PLAY [Clean backup files] **************************************************************************************************************************************

TASK [Remove the backup directory] *****************************************************************************************************************************
changed: [xxx.xx.xxx.xx]

PLAY RECAP *****************************************************************************************************************************************************
xxx.xx.xxx.xx                : ok=48   changed=26   unreachable=0    failed=0    skipped=12   rescued=0    ignored=0
localhost                  : ok=32   changed=1    unreachable=0    failed=0    skipped=56   rescued=0    ignored=0


real	1m19.235s
user	1m9.949s
sys	0m3.197s
$

所要時間およそ 1分20秒でした。

バックアップ実行ディレクトリ直下に backups というディレクトリが作成されます。
compress オプションをつけたため、tar.gz で作成されています。

$ ls -l backups
total 749640
-rw-r--r-- 1 ansible ansible  63609005 Nov 15 19:54 controller_xxx.xx.xxx.xx.tar.gz
-rw-r--r-- 1 ansible ansible   1562601 Nov 15 19:54 eda_xxx.xx.xxx.xx.tar.gz
-rw-r--r-- 1 ansible ansible   1334592 Nov 15 19:55 gateway_xxx.xx.xxx.xx.tar.gz
-rw-r--r-- 1 ansible ansible 697268396 Nov 15 19:55 hub_xxx.xx.xxx.xx.tar.gz
-rw-r--r-- 1 ansible ansible   1282716 Nov 15 19:55 postgresql_xxx.xx.xxx.xx.tar.gz
-rw-r--r-- 1 ansible ansible   1281377 Nov 15 19:55 receptor_xxx.xx.xxx.xx.tar.gz
-rw-r--r-- 1 ansible ansible   1277983 Nov 15 19:55 redis_xxx.xx.xxx.xx.tar.gz
$

バックアップ用テスト定義削除

バックアップテスト用定義を削除し、リストア後にバックアップテスト用定義が戻るかどうかを確認指標とします。

  • 組織で backup定義 を削除

組織.png

他にインベントリー、ホスト、テンプレートに作成していたバックアップ用テスト定義を削除しました。


取得したバックアップのリストア

ansible-playbook -i inventory_backuptest ansible.containerized_installer.restore リストアを実行します。

実行ディレクトリ下の backups ディレクトリのデータが使用されます。

$ ansible-playbook -i inventory_backuptest ansible.containerized_installer.restore
[WARNING]: running playbook inside collection ansible.containerized_installer

PLAY [Preflight checks] ****************************************************************************************************************************************

TASK [Gather facts] ********************************************************************************************************************************************
ok: [localhost]

TASK [ansible.containerized_installer.preflight : Ensure registry username and password are provided] **********************************************************
skipping: [localhost]

TASK [ansible.containerized_installer.preflight : Include database checks] *************************************************************************************
included: /home/ansible/AAP26/collections/ansible_collections/ansible/containerized_installer/roles/preflight/tasks/database.yml for localhost


~ 省略 ~ 



TASK [Remove the backup directory] *****************************************************************************************************************************
changed: [xxx.xx.xxx.xx]

PLAY RECAP *****************************************************************************************************************************************************
xxx.xx.xxx.xx                : ok=348  changed=99   unreachable=0    failed=0    skipped=86   rescued=0    ignored=0
localhost                  : ok=31   changed=0    unreachable=0    failed=0    skipped=56   rescued=0    ignored=0


real	6m35.212s
user	2m38.431s
sys	0m17.879s
$ 

所要時間およそ 6分40秒での実行でした。


リストア後の確認

GUI にログインし、組織、ホスト、インベントリ、テンプレートで、リストア前に削除したバックアップ用定義が戻っていることが確認できました。

組織.png

ホスト.png

インベントリ.png

テンプレート.png

おわりに

用意されているbackup,restore 実行 playbook でエラーなく実行できることが確認できました。

admin パスワードをインストール後に変更しているなどで、inventory ファイルに記載のパスワードと一致しない場合は、リストア後にログインできないといった事象が発生するため、インベントリー・ファイルの記載は実機に合わせることが必要です。

ログイン.png

以上です。

1
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?