10.2. 복원 프로세스
복원 프로세스는 새 배포를 생성하고 filestore 및 SQL 데이터베이스 인스턴스를 지정된 백업으로 복원합니다.
- 백업에 사용된 동일한 작동 이미지 버전으로 복원해야 합니다.
다음 절차에서는 GCP Marketplace 배포에서 Ansible Automation Platform을 복원하는 방법을 설명합니다.
10.2.1. ansible-on-clouds-ops 컨테이너 이미지 가져오기
절차
기본 배포와 동일한 태그를 사용하여
ansible-on-clouds-ops컨테이너의 Docker 이미지를 가져옵니다.참고docker 이미지를 가져오기 전에 docker를 사용하여 registry.redhat.io에 로그인했는지 확인합니다. 다음 명령을 사용하여 registry.redhat.io에 로그인합니다.
$ docker login registry.redhat.io
레지스트리 로그인에 대한 자세한 내용은 레지스트리 인증을 참조하십시오.
$ export IMAGE=registry.redhat.io/ansible-on-clouds/ansible-on-clouds-ops-rhel9:2.4.20230630 $ docker pull $IMAGE --platform=linux/amd64
10.2.2. 환경 설정
절차
구성 파일을 저장할 폴더를 생성합니다.
$ mkdir command_generator_data
10.2.3. 필요한 권한
스택을 복원하려면 다음과 같은 GCP IAM 권한이 있어야 합니다.
required-roles: Cloud SQL Client Cloud SQL Instance User Compute Instance Admin (v1) Compute Network Admin Editor Logs Writer Secret Manager Secret Accessor Service Account User required-permissions: compute.instances.list compute.networks.create deploymentmanager.deployments.create deploymentmanager.deployments.get deploymentmanager.operations.get file.instances.create file.operations.get iap.tunnelInstances.accessViaIAP secretmanager.secrets.create secretmanager.secrets.delete secretmanager.secrets.get secretmanager.secrets.update secretmanager.versions.add secretmanager.versions.list storage.objects.get storage.objects.list
10.2.4. restore.yml 파일 생성
절차
generator
command_generator_vars명령을 실행하여restore.yml을 생성합니다.참고Linux에서 명령 생성기가 생성한 모든 파일 또는 디렉터리는 기본적으로
root:root에 의해 소유됩니다. 파일과 디렉터리의 소유권을 변경하려면 파일이 생성된 후sudo chmod명령을 실행할 수 있습니다. 자세한 내용은 기술 노트를 참조하십시오.docker run --rm -v $(pwd)/command_generator_data:/data $IMAGE command_generator_vars gcp_restore_deployment --output-data-file /data/restore.yml
명령을 실행하면
$(pwd)/command_generator_data/restore.yml템플릿 파일이 생성됩니다. 이 템플릿 파일은 다음과 유사합니다.=============================================== Playbook: gcp_restore_deployment Description: This playbook is used to restore the Ansible Automation Platform from GCP Marketplace environment from a backup. ----------------------------------------------- This playbook is used to restore the Ansible Automation Platform from GCP Marketplace environment from a backup. For more information regarding backup and restore, visit our official documentation - https://access.redhat.com/documentation/en-us/ansible_on_clouds/2.x/html/red_hat_ansible_automation_platform_from_gcp_marketplace_guide/index ----------------------------------------------- Command generator template: docker run --rm -v <local_data_file_directory>:/data $IMAGE command_generator gcp_restore_deployment --data-file /data/restore.yml
템플릿은 다음과 유사합니다.
gcp_restore_deployment: cloud_credentials_path: deployment_name: extra_vars: backup_name: gcp_bucket_backup_name: gcp_cloud_sql_peering_network: gcp_compute_region: gcp_compute_zone: gcp_controller_internal_ip_address: gcp_existing_vpc: gcp_filestore_ip_range: gcp_hub_internal_ip_address:
10.2.5. restore.yml 파일의 매개변수
새 VPC 네트워크로만 복원할 수 있습니다.
새 VPC의 경우
새 VPC를 사용하여 복원하려면 다음 매개변수를 설정합니다.
-
gcp_existing_vpc는false로 설정해야 합니다.
다음 매개변수를 제거해야 합니다.
-
gcp_filestore_ip_range -
gcp_cloud_sql_peering_network -
gcp_controller_internal_ip_address -
gcp_hub_internal_ip_address
다음 매개변수의 값을 제공합니다.
-
gcp_existing_vpc는false로 설정해야 합니다. -
cloud_credentials_path는 Google Cloud 서비스 계정 자격 증명 파일의 경로입니다. -
deployment_name은 배포를 복원해야 하는 이름입니다. 이 이름으로 새 배포가 생성됩니다. 이 이름의 배포가 존재하지 않아야 합니다. -
backup_name은 버킷의 백업 이름입니다. 이 이름은gcp_backup_deployment또는gcp_backup_list명령을 사용하는 동안 표시됩니다. -
gcp_bucket_backup_name은 백업에 사용한 버킷 이름입니다. -
gcp_compute_region은 백업이 수행된 영역입니다. Deployment Manager에서 Deployments config를 확인하여 검색할 수 있습니다. -
gcp_compute_zone은 백업을 수행한 영역입니다. Deployment Manager에서 Deployments config를 확인하여 검색할 수 있습니다.
기존 VPC의 경우
기존 VPC를 사용하여 복원하려면 위에 표시된 매개변수를 설정해야 합니다.
다음과 같은 추가 매개변수도 설정해야 합니다.
-
gcp_existing_vpc가true로 설정됩니다. -
gcp_filestore_ip_range는 VPC의 무료 ip/29 범위로 설정해야 합니다. 예: 192.168.245.0/29. GCP Marketplace에서 Ansible Automation Platform을 배포할 때 사용되는 기본값으로 192.168.243.0/29를 사용해서는 안 됩니다. -
gcp_cloud_sql_peering_network를 무료/24서브넷으로 설정해야 합니다. 원래 배포 중에 사용되므로 192.168.241.0/24를 사용해서는 안 됩니다. -
gcp_controller_internal_ip_address는 VPC 네트워크에서 사용 가능한 IP로 설정해야 합니다. -
gcp_hub_internal_ip_address는 VPC 네트워크에서 무료 IP로 설정해야 합니다.
10.2.6. restore 명령 실행
$(pwd)/command_generator_data/restore.yml 이 입력되면 명령 생성기를 사용하여 restore 명령을 생성할 수 있습니다.
절차
명령 생성기를 실행합니다.
$ docker run --rm -v $(pwd)/command_generator_data:/data $IMAGE command_generator gcp_restore_deployment --data-file /data/restore.yml
이렇게 하면 필요한 모든 볼륨, 환경 변수 및 매개변수가 포함된 새 명령이 생성됩니다.
생성된 명령은 다음과 유사합니다.
docker run --rm --env PLATFORM=GCP -v <local_credential_file>:/home/runner/.gcp/credentials:ro \ --env ANSIBLE_CONFIG=../gcp-ansible.cfg --env DEPLOYMENT_NAME=<deployment_name> --env GENERATE_INVENTORY=true -\ -env CHECK_GENERATED_INVENTORY=false $IMAGE redhat.ansible_on_clouds.gcp_restore_deployment \ -e 'gcp_service_account_credentials_json_path=/home/runner/.gcp/credentials \ gcp_deployment_name=<deployment_name> gcp_compute_region=<region> gcp_compute_zone=<zone> \ gcp_bucket_backup_name=<bucket> backup_name=<backup_name> gcp_existing_vpc=<existing_vpc>'
생성된 명령을 실행합니다.
$ docker run --rm --env PLATFORM=GCP -v <local_credential_file>:/home/runner/.gcp/credentials:ro \ --env ANSIBLE_CONFIG=../gcp-ansible.cfg $IMAGE redhat.ansible_on_clouds.gcp_restore_deployment \ -e 'gcp_service_account_credentials_json_path=/home/runner/.gcp/credentials \ gcp_deployment_name=<former_deployment_name> gcp_restored_deployment_name=<new_deployment_name> \ gcp_compute_region=<region> gcp_compute_zone=<zone> gcp_bucket_backup_name=<bucket> gcp_existing_vpc=False'
플레이북이 완료되면 출력은 다음과 유사합니다.
TASK [redhat.ansible_on_clouds.standalone_gcp_restore : Display internal IP addresses] *** ok: [localhost] => msg: - 'Hub internal IP: 192.168.240.21' - 'Controller internal IP: 192.168.240.20' PLAY RECAP ********************************************************************* localhost : ok=33 changed=8 unreachable=0 failed=0 skipped=6 rescued=0 ignored=2
10.2.7. 복원 실패
복원 중에 다음과 유사한 메시지가 표시되면 복원을 수동으로 수행해야 하므로 지원팀에 문의해야 합니다.
TASK [redhat.ansible_on_clouds.standalone_gcp_restore : [restore_deployment] Restore awx db] *
fatal: [localhost -> dvernier-restore1-aap-cntrlr-x2c6]: FAILED!