7.6. Playbook の使用
このドキュメントでは、すべてではありませんが、一部の Playbook を説明します。ここでは、Ansible on Clouds デプロイメントから情報を取得するか、情報を確認するために使用されるものを説明します。これらの Playbook はデプロイメントを変更しません。
gcp_aap_health_check
この Playbook は、Ansible アプリケーションが正常かどうかをチェックします。
$ docker run --rm $IMAGE command_generator_vars gcp_aap_health_check
これにより、以下の出力が生成されます。
=============================================== Playbook: gcp_aap_health_check Description: This playbook checks if the deployment is healthy using the Ansible health service. ----------------------------------------------- The health check consists of checking the Ansible Automation Platform from GCP Marketplace environemnt to verify it is healthy. ----------------------------------------------- Command generator template: docker run --rm $IMAGE command_generator gcp_aap_health_check [--ansible-config ansible_config_path>] -d <deployment_name> -c <cloud_credentials_path> --extra-vars 'gcp_compute_region=<gcp_compute_region> gcp_compute_zone=<gcp_compute_zone>' ===============================================
パラメーターを置き換えてこのコマンドを起動すると、起動する新しいコマンドが生成され、次のように出力されます。
... PLAY RECAP ********************************************************************* localhost : ok=29 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
failed がゼロに等しくない場合は、Ansible on Cloud デプロイメントに問題があることを示します。
gcp_add_labels
この Playbook は、デプロイメントにラベルを追加します。
$ docker run --rm $IMAGE command_generator_vars gcp_add_labels
これにより、以下の出力が生成されます。
=============================================== Playbook: gcp_add_labels Description: This playbook adds labels to the deployment. ----------------------------------------------- Add labels to the Ansible Automation Platform from GCP Marketplace deployment. ----------------------------------------------- Command generator template: docker run --rm $IMAGE command_generator gcp_add_labels -d <deployment_name> -c <cloud_credentials_path> --extra-vars 'gcp_compute_region=<gcp_compute_region> gcp_compute_zone=<gcp_compute_zone> gcp_labels=<gcp_labels>' ===============================================
パラメーター gcp_labels は、追加または更新する key=value ペアのコンマ区切りのリストです。たとえば、key1=value1,key2=value2 です。
パラメーターを置き換えてこのコマンドを起動すると、起動する新しいコマンドが生成され、次のように出力されます。
... PLAY RECAP ********************************************************************* localhost : ok=22 changed=2 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
gcp_remove_labels
この Playbook は、デプロイメントからラベルを削除します。
$ docker run --rm $IMAGE command_generator_vars gcp_remove_labels
これにより、以下の出力が生成されます。
=============================================== Playbook: gcp_remove_labels Description: This playbook removes labels from the deployment. ----------------------------------------------- Remove labels from the Ansible Automation Platform from GCP Marketplace deployment. ----------------------------------------------- Command generator template: docker run --rm $IMAGE command_generator gcp_remove_labels -d <deployment_name> -c <cloud_credentials_path> --extra-vars 'gcp_compute_region=<gcp_compute_region> gcp_compute_zone=<gcp_compute_zone> gcp_labels=<gcp_labels>' ===============================================
パラメーター gcp_labels は、削除するキーのコンマ区切りのリストです。たとえば、key1,key2 です。
パラメーターを置き換えてこのコマンドを起動すると、起動する新しいコマンドが生成され、次のように出力されます。
... PLAY RECAP ********************************************************************* localhost : ok=22 changed=2 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
gcp_check_aoc_version
この Playbook は、Ansible on Cloud のバージョンがコマンドジェネレーターコンテナーと同じかどうかを確認します。この確認は、Playbook が呼び出されるたびに行われます。
$ docker run --rm $IMAGE command_generator_vars gcp_check_aoc_version
これにより、以下の出力が生成されます。
=============================================== Playbook: gcp_check_aoc_version Description: Check the operational container version matches the Ansible on Clouds version. ----------------------------------------------- Check the operational container version matches the Ansible on Clouds version. ----------------------------------------------- Command generator template: docker run --rm $IMAGE command_generator gcp_check_aoc_version [--ansible-config ansible_config_path>] -c <cloud_credentials_path> -d <deployment_name> ===============================================
パラメーターを置き換えてこのコマンドを起動すると、起動する新しいコマンドが生成され、次のように出力されます。
...
TASK [redhat.ansible_on_clouds.standalone_check_aoc_version : Verify operational playbook and Ansible on Clouds deployment versions] ***
ok: [localhost] => {
"changed": false,
"msg": "This operation playbook version and the Ansible on Clouds deployment version are identical: 2.4.20230606-00"
}
PLAY RECAP *********************************************************************
localhost : ok=8 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
failed がゼロ以外の場合は、Ansible on Clouds デプロイメントのバージョンが command_generator コンテナーと一致せず、コマンドジェネレーターがそのデプロイメントを管理するには別のバージョンが必要であることを示します。
gcp_get_aoc_version
この Playbook は、Ansible on Clouds デプロイメントのバージョンを取得します。
$ docker run --rm $IMAGE command_generator_vars gcp_get_aoc_version
これにより、以下の出力が生成されます。
=============================================== Playbook: gcp_get_aoc_version Description: Get the current Ansible on Clouds version. ----------------------------------------------- Get the current Ansible on Clouds version. ----------------------------------------------- Command generator template: docker run --rm $IMAGE command_generator gcp_get_aoc_version [--ansible-config ansible_config_path>] -c <cloud_credentials_path> -d <deployment_name> ===============================================
パラメーターを置き換えてこのコマンドを起動すると、起動する新しいコマンドが生成され、次のように出力されます。
...
TASK [Print version] ***********************************************************
ok: [localhost] => {
"msg": "The AOC version is 2.4.20230606-00"
}
PLAY RECAP *********************************************************************
localhost : ok=5 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0gcp_health_check
この Playbook は、ノードと Ansible アプリケーションが正常かどうかをチェックします。
$ docker run --rm $IMAGE command_generator_vars gcp_health_check
これにより、以下の出力が生成されます。
=============================================== Playbook: gcp_health_check Description: This playbook checks if the Ansible Automation Platform from GCP Marketplace deployment is healthy. ----------------------------------------------- The health check consists of checking the Ansible Automation Platform from GCP Marketplace heatlh checks and the health of the monitoring exporter. ----------------------------------------------- Command generator template: docker run --rm $IMAGE command_generator gcp_health_check [--ansible-config ansible_config_path>] -c <cloud_credentials_path> -d <deployment_name> --extra-vars 'gcp_compute_region=<gcp_compute_region> gcp_compute_zone=<gcp_compute_zone>' ===============================================
パラメーターを置き換えてこのコマンドを起動すると、起動する新しいコマンドが生成され、次のように出力されます。
... PLAY RECAP ********************************************************************* localhost : ok=47 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
failed がゼロに等しくない場合は、ノードまたは Ansible on Cloud デプロイメントに問題があることを示します。
gcp_list_deployments
この Playbook にはデプロイメントがリストされています。リージョンとゾーンはオプションです。
$ docker run --rm $IMAGE command_generator_vars gcp_list_deployments
これにより、以下の出力が生成されます。
=============================================== Playbook: gcp_list_deployments Description: This playbook generates a list of available Ansible Automation Platform from GCP Marketplace deployments. ----------------------------------------------- This playbook is used to generate a list of available Ansible Automation Platform from GCP Marketplace deployments. ----------------------------------------------- Command generator template: docker run --rm $IMAGE command_generator gcp_list_deployments -c <cloud_credentials_path> --extra-vars '[gcp_compute_region=<gcp_compute_region>] [gcp_compute_zone=<gcp_compute_zone>]' ===============================================
パラメーターを置き換えてこのコマンドを起動すると、起動する新しいコマンドが生成され、次のように出力されます。
...
TASK [Show deployment list] ****************************************************
ok: [localhost] => {
"msg": [
"Deployment list: ['dep1', 'dep2', 'dep3']"
]
}
PLAY RECAP *********************************************************************
localhost : ok=7 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0gcp_nodes_health_check
この Playbook は、ノードが正常かどうかをチェックします。
$ docker run --rm $IMAGE command_generator_vars gcp_nodes_health_check
これにより、以下の出力が生成されます。
=============================================== Playbook: gcp_nodes_health_check Description: This role runs a health check on a group of nodes in the Ansible Automation Platform from GCP Marketplace deployment ----------------------------------------------- The playbook checks if the Ansible Automation Platform from GCP Marketplace monitoring exporter is up and running. ----------------------------------------------- Command generator template: docker run --rm $IMAGE command_generator gcp_nodes_health_check [--ansible-config ansible_config_path>] -d <deployment_name> -c <cloud_credentials_path> --extra-vars 'check_monitoring=True' ===============================================
パラメーターを置き換えてこのコマンドを起動すると、起動する新しいコマンドが生成され、次のように出力されます。
... PLAY RECAP ********************************************************************* localhost : ok=47 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
failed がゼロに等しくない場合は、デプロイメント内のノードに問題があることを示します。