diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index bbb7ca3c2..e71730a7d 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -1,11 +1,12 @@ -name: "Run integration tests for the cloud.google collection" +--- +name: Run integration tests for the cloud.google collection on: pull_request: {} push: branches: master env: - GCP_SERVICE_ACCOUNT: "github-ci@ansible-gcp-ci.iam.gserviceaccount.com" - GCP_PROJECT: "ansible-gcp-ci" + GCP_SERVICE_ACCOUNT: github-ci@ansible-gcp-ci.iam.gserviceaccount.com + GCP_PROJECT: ansible-gcp-ci GCP_FOLDER_ID: "542027184392" jobs: integration: @@ -31,7 +32,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: '3.9' # this is the minimum version required for Ansible 2.13 + python-version: "3.9" # this is the minimum version required for Ansible 2.13 - name: Install dependencies run: pip install -r requirements.txt - name: Install ansible-base (${{ matrix.ansible_version }}) @@ -55,15 +56,15 @@ jobs: env: CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }} with: - service_account: "$GCP_SERVICE_ACCOUNT" - credentials_json: "${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }}" + service_account: $GCP_SERVICE_ACCOUNT + credentials_json: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }} - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@v1 - name: Run cleanup - run: | + run: | ./scripts/bootstrap-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT ./scripts/cleanup-project.sh $GCP_PROJECT $GCP_FOLDER_ID # run tests - name: Run integration tests # Add the -vvv flag to print out more output - run: ansible-test integration -v --color --python 3.9 --venv-system-site-packages \ No newline at end of file + run: ansible-test integration -v --color --python 3.9 --venv-system-site-packages diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 664db28bc..eb6ee9c94 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -1,4 +1,5 @@ -name: "Run tests for the cloud.google collection" +--- +name: Run tests for the cloud.google collection on: [pull_request] env: PYTHON_VERSION: "3.9" # minimum version for Ansible 2.14 @@ -58,7 +59,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: "${{ env.PYTHON_VERSION }}" + python-version: ${{ env.PYTHON_VERSION }} - name: Install dependencies run: pip install -r requirements.txt - name: Install test dependencies @@ -66,4 +67,4 @@ jobs: - name: Install ansible-base (${{ matrix.ansible_version }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check - name: Run unit tests - run: ansible-test units -v --color --python "$PYTHON_VERSION" \ No newline at end of file + run: ansible-test units -v --color --python "$PYTHON_VERSION" diff --git a/.github/workflows/automationhub.yml b/.github/workflows/automationhub.yml index 29e126283..d3096147c 100644 --- a/.github/workflows/automationhub.yml +++ b/.github/workflows/automationhub.yml @@ -1,25 +1,25 @@ +--- name: Upload release to Automation Hub on: release: types: [created] - jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ansible - - name: Build and publish - env: - ANSIBLE_AUTOMATION_HUB_API_KEY: ${{ secrets.ANSIBLE_AUTOMATION_HUB_API_KEY }} - run: | - ansible-galaxy collection build . - ansible-galaxy collection publish *.tar.gz --api-key=$ANSIBLE_AUTOMATION_HUB_API_KEY -s=https://cloud.redhat.com/api/automation-hub/ + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.x + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + - name: Build and publish + env: + ANSIBLE_AUTOMATION_HUB_API_KEY: ${{ secrets.ANSIBLE_AUTOMATION_HUB_API_KEY }} + run: | + ansible-galaxy collection build . + ansible-galaxy collection publish *.tar.gz --api-key=$ANSIBLE_AUTOMATION_HUB_API_KEY -s=https://cloud.redhat.com/api/automation-hub/ diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index 8100e1e6f..f4fc7d30a 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -1,15 +1,16 @@ -name: "google.cloud.gcloud" +--- +name: google.cloud.gcloud on: push: paths: - - 'roles/gcloud/**' - - '.github/workflows/gcloud.yml' - - 'molecule/gcloud/**' + - roles/gcloud/** + - .github/workflows/gcloud.yml + - molecule/gcloud/** pull_request: paths: - - 'roles/gcloud/**' - - '.github/workflows/gcloud.yml' - - 'molecule/gcloud/**' + - roles/gcloud/** + - .github/workflows/gcloud.yml + - molecule/gcloud/** jobs: molecule: runs-on: ubuntu-18.04 diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index a58e6a373..01099255e 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -1,4 +1,5 @@ -name: "google.cloud.gcsfuse" +--- +name: google.cloud.gcsfuse on: push: paths: diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 0318edfc4..42d663f32 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -1,25 +1,25 @@ +--- name: Upload release to Galaxy on: release: types: [created] - jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ansible - - name: Build and publish - env: - ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} - run: | - ansible-galaxy collection build . - ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.x + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + - name: Build and publish + env: + ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} + run: | + ansible-galaxy collection build . + ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d82194880..6a71671f6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,7 +21,7 @@ git clone $TARGET_DIR/ansible_collections/google/cloud Then set up your Python virtual environment: ```shell -cd $TARGET_DIR/ansible_collections/google +cd $TARGET_DIR/ansible_collections/google/cloud python3 -m venv venv . ./venv/bin/activate pip3 install -r requirements.txt diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml index e8eb24c91..d7f9cecd7 100644 --- a/changelogs/.plugin-cache.yaml +++ b/changelogs/.plugin-cache.yaml @@ -1,3 +1,4 @@ +--- objects: role: {} plugins: @@ -12,859 +13,859 @@ plugins: gcp_compute: description: Google Cloud Compute Engine inventory source name: gcp_compute - version_added: null + version_added: lookup: {} module: gcp_appengine_firewall_rule: description: Creates a GCP FirewallRule name: gcp_appengine_firewall_rule - namespace: '' - version_added: null + namespace: "" + version_added: gcp_appengine_firewall_rule_info: description: Gather info for GCP FirewallRule name: gcp_appengine_firewall_rule_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigquery_dataset: description: Creates a GCP Dataset name: gcp_bigquery_dataset - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigquery_dataset_info: description: Gather info for GCP Dataset name: gcp_bigquery_dataset_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigquery_table: description: Creates a GCP Table name: gcp_bigquery_table - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigquery_table_info: description: Gather info for GCP Table name: gcp_bigquery_table_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigtable_instance: description: Creates a GCP Instance name: gcp_bigtable_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigtable_instance_info: description: Gather info for GCP Instance name: gcp_bigtable_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudbuild_trigger: description: Creates a GCP Trigger name: gcp_cloudbuild_trigger - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudbuild_trigger_info: description: Gather info for GCP Trigger name: gcp_cloudbuild_trigger_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudfunctions_cloud_function: description: Creates a GCP CloudFunction name: gcp_cloudfunctions_cloud_function - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudfunctions_cloud_function_info: description: Gather info for GCP CloudFunction name: gcp_cloudfunctions_cloud_function_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudscheduler_job: description: Creates a GCP Job name: gcp_cloudscheduler_job - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudscheduler_job_info: description: Gather info for GCP Job name: gcp_cloudscheduler_job_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudtasks_queue: description: Creates a GCP Queue name: gcp_cloudtasks_queue - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudtasks_queue_info: description: Gather info for GCP Queue name: gcp_cloudtasks_queue_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_address: description: Creates a GCP Address name: gcp_compute_address - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_address_info: description: Gather info for GCP Address name: gcp_compute_address_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_autoscaler: description: Creates a GCP Autoscaler name: gcp_compute_autoscaler - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_autoscaler_info: description: Gather info for GCP Autoscaler name: gcp_compute_autoscaler_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_backend_bucket: description: Creates a GCP BackendBucket name: gcp_compute_backend_bucket - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_backend_bucket_info: description: Gather info for GCP BackendBucket name: gcp_compute_backend_bucket_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_backend_service: description: Creates a GCP BackendService name: gcp_compute_backend_service - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_backend_service_info: description: Gather info for GCP BackendService name: gcp_compute_backend_service_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_disk: description: Creates a GCP Disk name: gcp_compute_disk - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_disk_info: description: Gather info for GCP Disk name: gcp_compute_disk_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_external_vpn_gateway: description: Creates a GCP ExternalVpnGateway name: gcp_compute_external_vpn_gateway - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_external_vpn_gateway_info: description: Gather info for GCP ExternalVpnGateway name: gcp_compute_external_vpn_gateway_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_firewall: description: Creates a GCP Firewall name: gcp_compute_firewall - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_firewall_info: description: Gather info for GCP Firewall name: gcp_compute_firewall_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_forwarding_rule: description: Creates a GCP ForwardingRule name: gcp_compute_forwarding_rule - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_forwarding_rule_info: description: Gather info for GCP ForwardingRule name: gcp_compute_forwarding_rule_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_global_address: description: Creates a GCP GlobalAddress name: gcp_compute_global_address - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_global_address_info: description: Gather info for GCP GlobalAddress name: gcp_compute_global_address_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_global_forwarding_rule: description: Creates a GCP GlobalForwardingRule name: gcp_compute_global_forwarding_rule - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_global_forwarding_rule_info: description: Gather info for GCP GlobalForwardingRule name: gcp_compute_global_forwarding_rule_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_health_check: description: Creates a GCP HealthCheck name: gcp_compute_health_check - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_health_check_info: description: Gather info for GCP HealthCheck name: gcp_compute_health_check_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_http_health_check: description: Creates a GCP HttpHealthCheck name: gcp_compute_http_health_check - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_http_health_check_info: description: Gather info for GCP HttpHealthCheck name: gcp_compute_http_health_check_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_https_health_check: description: Creates a GCP HttpsHealthCheck name: gcp_compute_https_health_check - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_https_health_check_info: description: Gather info for GCP HttpsHealthCheck name: gcp_compute_https_health_check_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_image: description: Creates a GCP Image name: gcp_compute_image - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_image_info: description: Gather info for GCP Image name: gcp_compute_image_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance: description: Creates a GCP Instance name: gcp_compute_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_group: description: Creates a GCP InstanceGroup name: gcp_compute_instance_group - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_group_info: description: Gather info for GCP InstanceGroup name: gcp_compute_instance_group_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_group_manager: description: Creates a GCP InstanceGroupManager name: gcp_compute_instance_group_manager - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_group_manager_info: description: Gather info for GCP InstanceGroupManager name: gcp_compute_instance_group_manager_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_info: description: Gather info for GCP Instance name: gcp_compute_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_template: description: Creates a GCP InstanceTemplate name: gcp_compute_instance_template - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_template_info: description: Gather info for GCP InstanceTemplate name: gcp_compute_instance_template_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_interconnect_attachment: description: Creates a GCP InterconnectAttachment name: gcp_compute_interconnect_attachment - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_interconnect_attachment_info: description: Gather info for GCP InterconnectAttachment name: gcp_compute_interconnect_attachment_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_network: description: Creates a GCP Network name: gcp_compute_network - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_network_endpoint_group: description: Creates a GCP NetworkEndpointGroup name: gcp_compute_network_endpoint_group - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_network_endpoint_group_info: description: Gather info for GCP NetworkEndpointGroup name: gcp_compute_network_endpoint_group_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_network_info: description: Gather info for GCP Network name: gcp_compute_network_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_node_group: description: Creates a GCP NodeGroup name: gcp_compute_node_group - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_node_group_info: description: Gather info for GCP NodeGroup name: gcp_compute_node_group_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_node_template: description: Creates a GCP NodeTemplate name: gcp_compute_node_template - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_node_template_info: description: Gather info for GCP NodeTemplate name: gcp_compute_node_template_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_autoscaler: description: Creates a GCP RegionAutoscaler name: gcp_compute_region_autoscaler - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_autoscaler_info: description: Gather info for GCP RegionAutoscaler name: gcp_compute_region_autoscaler_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_backend_service: description: Creates a GCP RegionBackendService name: gcp_compute_region_backend_service - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_backend_service_info: description: Gather info for GCP RegionBackendService name: gcp_compute_region_backend_service_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_disk: description: Creates a GCP RegionDisk name: gcp_compute_region_disk - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_disk_info: description: Gather info for GCP RegionDisk name: gcp_compute_region_disk_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_health_check: description: Creates a GCP RegionHealthCheck name: gcp_compute_region_health_check - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_health_check_info: description: Gather info for GCP RegionHealthCheck name: gcp_compute_region_health_check_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_instance_group_manager: description: Creates a GCP RegionInstanceGroupManager name: gcp_compute_region_instance_group_manager - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_instance_group_manager_info: description: Gather info for GCP RegionInstanceGroupManager name: gcp_compute_region_instance_group_manager_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_target_http_proxy: description: Creates a GCP RegionTargetHttpProxy name: gcp_compute_region_target_http_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_target_http_proxy_info: description: Gather info for GCP RegionTargetHttpProxy name: gcp_compute_region_target_http_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_target_https_proxy: description: Creates a GCP RegionTargetHttpsProxy name: gcp_compute_region_target_https_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_target_https_proxy_info: description: Gather info for GCP RegionTargetHttpsProxy name: gcp_compute_region_target_https_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_url_map: description: Creates a GCP RegionUrlMap name: gcp_compute_region_url_map - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_url_map_info: description: Gather info for GCP RegionUrlMap name: gcp_compute_region_url_map_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_reservation: description: Creates a GCP Reservation name: gcp_compute_reservation - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_reservation_info: description: Gather info for GCP Reservation name: gcp_compute_reservation_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_resource_policy: description: Creates a GCP ResourcePolicy name: gcp_compute_resource_policy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_resource_policy_info: description: Gather info for GCP ResourcePolicy name: gcp_compute_resource_policy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_route: description: Creates a GCP Route name: gcp_compute_route - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_route_info: description: Gather info for GCP Route name: gcp_compute_route_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_router: description: Creates a GCP Router name: gcp_compute_router - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_router_info: description: Gather info for GCP Router name: gcp_compute_router_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_snapshot: description: Creates a GCP Snapshot name: gcp_compute_snapshot - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_snapshot_info: description: Gather info for GCP Snapshot name: gcp_compute_snapshot_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_ssl_certificate: description: Creates a GCP SslCertificate name: gcp_compute_ssl_certificate - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_ssl_certificate_info: description: Gather info for GCP SslCertificate name: gcp_compute_ssl_certificate_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_ssl_policy: description: Creates a GCP SslPolicy name: gcp_compute_ssl_policy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_ssl_policy_info: description: Gather info for GCP SslPolicy name: gcp_compute_ssl_policy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_subnetwork: description: Creates a GCP Subnetwork name: gcp_compute_subnetwork - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_subnetwork_info: description: Gather info for GCP Subnetwork name: gcp_compute_subnetwork_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_http_proxy: description: Creates a GCP TargetHttpProxy name: gcp_compute_target_http_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_http_proxy_info: description: Gather info for GCP TargetHttpProxy name: gcp_compute_target_http_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_https_proxy: description: Creates a GCP TargetHttpsProxy name: gcp_compute_target_https_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_https_proxy_info: description: Gather info for GCP TargetHttpsProxy name: gcp_compute_target_https_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_instance: description: Creates a GCP TargetInstance name: gcp_compute_target_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_instance_info: description: Gather info for GCP TargetInstance name: gcp_compute_target_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_pool: description: Creates a GCP TargetPool name: gcp_compute_target_pool - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_pool_info: description: Gather info for GCP TargetPool name: gcp_compute_target_pool_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_ssl_proxy: description: Creates a GCP TargetSslProxy name: gcp_compute_target_ssl_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_ssl_proxy_info: description: Gather info for GCP TargetSslProxy name: gcp_compute_target_ssl_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_tcp_proxy: description: Creates a GCP TargetTcpProxy name: gcp_compute_target_tcp_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_tcp_proxy_info: description: Gather info for GCP TargetTcpProxy name: gcp_compute_target_tcp_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_vpn_gateway: description: Creates a GCP TargetVpnGateway name: gcp_compute_target_vpn_gateway - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_vpn_gateway_info: description: Gather info for GCP TargetVpnGateway name: gcp_compute_target_vpn_gateway_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_url_map: description: Creates a GCP UrlMap name: gcp_compute_url_map - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_url_map_info: description: Gather info for GCP UrlMap name: gcp_compute_url_map_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_vpn_tunnel: description: Creates a GCP VpnTunnel name: gcp_compute_vpn_tunnel - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_vpn_tunnel_info: description: Gather info for GCP VpnTunnel name: gcp_compute_vpn_tunnel_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_container_cluster: description: Creates a GCP Cluster name: gcp_container_cluster - namespace: '' - version_added: null + namespace: "" + version_added: gcp_container_cluster_info: description: Gather info for GCP Cluster name: gcp_container_cluster_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_container_node_pool: description: Creates a GCP NodePool name: gcp_container_node_pool - namespace: '' - version_added: null + namespace: "" + version_added: gcp_container_node_pool_info: description: Gather info for GCP NodePool name: gcp_container_node_pool_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_dns_managed_zone: description: Creates a GCP ManagedZone name: gcp_dns_managed_zone - namespace: '' - version_added: null + namespace: "" + version_added: gcp_dns_managed_zone_info: description: Gather info for GCP ManagedZone name: gcp_dns_managed_zone_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_dns_resource_record_set: description: Creates a GCP ResourceRecordSet name: gcp_dns_resource_record_set - namespace: '' - version_added: null + namespace: "" + version_added: gcp_dns_resource_record_set_info: description: Gather info for GCP ResourceRecordSet name: gcp_dns_resource_record_set_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_filestore_instance: description: Creates a GCP Instance name: gcp_filestore_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_filestore_instance_info: description: Gather info for GCP Instance name: gcp_filestore_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_iam_role: description: Creates a GCP Role name: gcp_iam_role - namespace: '' - version_added: null + namespace: "" + version_added: gcp_iam_role_info: description: Gather info for GCP Role name: gcp_iam_role_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_iam_service_account: description: Creates a GCP ServiceAccount name: gcp_iam_service_account - namespace: '' - version_added: null + namespace: "" + version_added: gcp_iam_service_account_info: description: Gather info for GCP ServiceAccount name: gcp_iam_service_account_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_iam_service_account_key: description: Creates a GCP ServiceAccountKey name: gcp_iam_service_account_key - namespace: '' - version_added: null + namespace: "" + version_added: gcp_kms_crypto_key: description: Creates a GCP CryptoKey name: gcp_kms_crypto_key - namespace: '' - version_added: null + namespace: "" + version_added: gcp_kms_crypto_key_info: description: Gather info for GCP CryptoKey name: gcp_kms_crypto_key_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_kms_key_ring: description: Creates a GCP KeyRing name: gcp_kms_key_ring - namespace: '' - version_added: null + namespace: "" + version_added: gcp_kms_key_ring_info: description: Gather info for GCP KeyRing name: gcp_kms_key_ring_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_logging_metric: description: Creates a GCP Metric name: gcp_logging_metric - namespace: '' - version_added: null + namespace: "" + version_added: gcp_logging_metric_info: description: Gather info for GCP Metric name: gcp_logging_metric_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_mlengine_model: description: Creates a GCP Model name: gcp_mlengine_model - namespace: '' - version_added: null + namespace: "" + version_added: gcp_mlengine_model_info: description: Gather info for GCP Model name: gcp_mlengine_model_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_mlengine_version: description: Creates a GCP Version name: gcp_mlengine_version - namespace: '' - version_added: null + namespace: "" + version_added: gcp_mlengine_version_info: description: Gather info for GCP Version name: gcp_mlengine_version_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_pubsub_subscription: description: Creates a GCP Subscription name: gcp_pubsub_subscription - namespace: '' - version_added: null + namespace: "" + version_added: gcp_pubsub_subscription_info: description: Gather info for GCP Subscription name: gcp_pubsub_subscription_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_pubsub_topic: description: Creates a GCP Topic name: gcp_pubsub_topic - namespace: '' - version_added: null + namespace: "" + version_added: gcp_pubsub_topic_info: description: Gather info for GCP Topic name: gcp_pubsub_topic_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_redis_instance: description: Creates a GCP Instance name: gcp_redis_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_redis_instance_info: description: Gather info for GCP Instance name: gcp_redis_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_resourcemanager_project: description: Creates a GCP Project name: gcp_resourcemanager_project - namespace: '' - version_added: null + namespace: "" + version_added: gcp_resourcemanager_project_info: description: Gather info for GCP Project name: gcp_resourcemanager_project_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_runtimeconfig_config: description: Creates a GCP Config name: gcp_runtimeconfig_config - namespace: '' - version_added: null + namespace: "" + version_added: gcp_runtimeconfig_config_info: description: Gather info for GCP Config name: gcp_runtimeconfig_config_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_runtimeconfig_variable: description: Creates a GCP Variable name: gcp_runtimeconfig_variable - namespace: '' - version_added: null + namespace: "" + version_added: gcp_runtimeconfig_variable_info: description: Gather info for GCP Variable name: gcp_runtimeconfig_variable_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_serviceusage_service: description: Creates a GCP Service name: gcp_serviceusage_service - namespace: '' - version_added: null + namespace: "" + version_added: gcp_serviceusage_service_info: description: Gather info for GCP Service name: gcp_serviceusage_service_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sourcerepo_repository: description: Creates a GCP Repository name: gcp_sourcerepo_repository - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sourcerepo_repository_info: description: Gather info for GCP Repository name: gcp_sourcerepo_repository_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_spanner_database: description: Creates a GCP Database name: gcp_spanner_database - namespace: '' - version_added: null + namespace: "" + version_added: gcp_spanner_database_info: description: Gather info for GCP Database name: gcp_spanner_database_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_spanner_instance: description: Creates a GCP Instance name: gcp_spanner_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_spanner_instance_info: description: Gather info for GCP Instance name: gcp_spanner_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_database: description: Creates a GCP Database name: gcp_sql_database - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_database_info: description: Gather info for GCP Database name: gcp_sql_database_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_instance: description: Creates a GCP Instance name: gcp_sql_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_instance_info: description: Gather info for GCP Instance name: gcp_sql_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_ssl_cert: description: Creates a GCP SslCert name: gcp_sql_ssl_cert - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_user: description: Creates a GCP User name: gcp_sql_user - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_user_info: description: Gather info for GCP User name: gcp_sql_user_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_storage_bucket: description: Creates a GCP Bucket name: gcp_storage_bucket - namespace: '' - version_added: null + namespace: "" + version_added: gcp_storage_bucket_access_control: description: Creates a GCP BucketAccessControl name: gcp_storage_bucket_access_control - namespace: '' - version_added: null + namespace: "" + version_added: gcp_storage_default_object_acl: description: Creates a GCP DefaultObjectACL name: gcp_storage_default_object_acl - namespace: '' - version_added: null + namespace: "" + version_added: gcp_storage_object: description: Creates a GCP Object name: gcp_storage_object - namespace: '' - version_added: null + namespace: "" + version_added: gcp_tpu_node: description: Creates a GCP Node name: gcp_tpu_node - namespace: '' - version_added: null + namespace: "" + version_added: gcp_tpu_node_info: description: Gather info for GCP Node name: gcp_tpu_node_info - namespace: '' - version_added: null + namespace: "" + version_added: netconf: {} shell: {} strategy: {} diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 09e7657a8..29c7c50ca 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -1,57 +1,52 @@ -ancestor: null +--- +ancestor: releases: 1.1.0: changes: bugfixes: - - Disk has been fixed to send the sourceSnapshot parameter. - - gcp_cloudtasks_queue - was not functional before, and is now functional. - - gcp_compute_* - these resources use the correct selflink (www.googleapis.com) - as the domain, no longer erroneously reporting changes after an execution. - - gcp_compute_backend_service - no longer erroneously reports changes after - an execution for ``capacity_scaler``. - - gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot - use basic-auth. - - gcp_crypto_key - skip_initial_version_creation defaults to the correct value. - - gcp_iam_role - now properly undeletes and recognizes soft deleted roles as - absent. - - gcp_iam_role - update of a role is functional (GitHub - - gcp_spanner_database - recognize a non-existent resource as absent. - - gcp_storage_object - fix for correct version of dependency requirement. + - Disk has been fixed to send the sourceSnapshot parameter. + - gcp_cloudtasks_queue - was not functional before, and is now functional. + - gcp_compute_* - these resources use the correct selflink (www.googleapis.com) as the domain, no longer erroneously reporting changes after an execution. + - gcp_compute_backend_service - no longer erroneously reports changes after an execution for ``capacity_scaler``. + - gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot use basic-auth. + - gcp_crypto_key - skip_initial_version_creation defaults to the correct value. + - gcp_iam_role - now properly undeletes and recognizes soft deleted roles as absent. + - gcp_iam_role - update of a role is functional (GitHub + - gcp_spanner_database - recognize a non-existent resource as absent. + - gcp_storage_object - fix for correct version of dependency requirement. minor_changes: - - GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the - name parameter. + - GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the name parameter. fragments: - - 0001_disk.yml - - bugfixes.yaml - release_date: '2022-12-16' + - "0001_disk.yml" + - bugfixes.yaml + release_date: "2022-12-16" 1.1.1: changes: bugfixes: - - fix collection to work with Python 2.7 + - fix collection to work with Python 2.7 fragments: - - fix-2.7.yml - release_date: '2022-12-16' + - fix-2.7.yml + release_date: "2022-12-16" 1.1.2: changes: bugfixes: - - fix `gcp_compute` no longer being a valid name of the inventory plugin + - fix `gcp_compute` no longer being a valid name of the inventory plugin fragments: - - fix-inventory-plugin.yml - release_date: '2022-12-21' + - fix-inventory-plugin.yml + release_date: "2022-12-21" 1.1.3: changes: bugfixes: - - 'gcp_compute_instance_info: fix incorrect documentation for filter which incorrectly - pointed to the gcloud filter logic rather than the API (fixes #549)' + - "gcp_compute_instance_info: fix incorrect documentation for filter which incorrectly pointed to the gcloud filter logic rather than the API (fixes #549)" fragments: - - gce-changelog.yaml - release_date: '2023-03-04' + - gce-changelog.yaml + release_date: "2023-03-04" 1.2.0: changes: bugfixes: - - Use default service account if `service_account_email` is unset. + - Use default service account if `service_account_email` is unset. minor_changes: - - Add DataPlane V2 Support. - - Add auth support for GCP access tokens (#574). - - Add support for ip_allocation_policy->stack_type. - release_date: '2023-07-07' + - Add DataPlane V2 Support. + - Add auth support for GCP access tokens (#574). + - Add support for ip_allocation_policy->stack_type. + release_date: "2023-07-07" diff --git a/changelogs/config.yaml b/changelogs/config.yaml index 9f7513d99..0b868692f 100644 --- a/changelogs/config.yaml +++ b/changelogs/config.yaml @@ -1,3 +1,4 @@ +--- changelog_filename_template: ../CHANGELOG.rst changelog_filename_version_depth: 0 changes_file: changelog.yaml @@ -11,22 +12,22 @@ prelude_section_name: release_summary prelude_section_title: Release Summary sanitize_changelog: true sections: -- - major_changes - - Major Changes -- - minor_changes - - Minor Changes -- - breaking_changes - - Breaking Changes / Porting Guide -- - deprecated_features - - Deprecated Features -- - removed_features - - Removed Features (previously deprecated) -- - security_fixes - - Security Fixes -- - bugfixes - - Bugfixes -- - known_issues - - Known Issues + - - major_changes + - Major Changes + - - minor_changes + - Minor Changes + - - breaking_changes + - Breaking Changes / Porting Guide + - - deprecated_features + - Deprecated Features + - - removed_features + - Removed Features (previously deprecated) + - - security_fixes + - Security Fixes + - - bugfixes + - Bugfixes + - - known_issues + - Known Issues title: Google.Cloud trivial_section_name: trivial use_fqcn: true diff --git a/changelogs/fragments/app-default-creds.yml b/changelogs/fragments/app-default-creds.yml index 7a02ea280..cacdcc4a4 100644 --- a/changelogs/fragments/app-default-creds.yml +++ b/changelogs/fragments/app-default-creds.yml @@ -1,2 +1,3 @@ +--- minor_changes: - - ansible-test - add support for GCP application default credentials (https://github.com/ansible-collections/google.cloud/issues/359). \ No newline at end of file + - ansible-test - add support for GCP application default credentials (https://github.com/ansible-collections/google.cloud/issues/359). diff --git a/changelogs/fragments/gcp_serviceusage_service.yml b/changelogs/fragments/gcp_serviceusage_service.yml new file mode 100644 index 000000000..e373ec711 --- /dev/null +++ b/changelogs/fragments/gcp_serviceusage_service.yml @@ -0,0 +1,4 @@ +--- +minor_changes: + - gcp_serviceusage_service - added backoff when checking for operation completion. + - gcp_serviceusage_service - use alloyb API for the integration test as spanner conflicts with other tests diff --git a/changelogs/fragments/gcp_sql_ssl_cert.yml b/changelogs/fragments/gcp_sql_ssl_cert.yml new file mode 100644 index 000000000..7e5b0ed9a --- /dev/null +++ b/changelogs/fragments/gcp_sql_ssl_cert.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - gcp_sql_ssl_cert - made sha1_fingerprint optional, which enables resource creation diff --git a/changelogs/fragments/gcp_storage_default_object_acl.yml b/changelogs/fragments/gcp_storage_default_object_acl.yml new file mode 100644 index 000000000..66422049a --- /dev/null +++ b/changelogs/fragments/gcp_storage_default_object_acl.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - gcp_storage_default_object_acl - removed non-existent fields; the resource is not usable. diff --git a/changelogs/fragments/upgrade-versions.yml b/changelogs/fragments/upgrade-versions.yml new file mode 100644 index 000000000..1c850cf1a --- /dev/null +++ b/changelogs/fragments/upgrade-versions.yml @@ -0,0 +1,6 @@ +--- +minor_changes: + - ansible - 2.14.0 is now the minimum version supported + - anisble-test - integration tests are now run against 2.14.0 and 2.15.0 + - ansible-lint - upgraded to 6.22 + - ansible-lint - fixed over a thousand reported errors diff --git a/galaxy.yml b/galaxy.yml index b53950d7b..e6e50a447 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,3 +1,4 @@ +--- ### REQUIRED # The namespace of the collection. This can be a company/brand/organization or product namespace under which all @@ -9,7 +10,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: "1.2.0" +version: 1.2.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md @@ -17,9 +18,8 @@ readme: README.md # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) # @nicks:irc/im.site#channel' authors: -- Google -- Google - + - Google + - Google ### OPTIONAL but strongly recommended @@ -29,7 +29,7 @@ description: The Google Cloud Platform collection. # Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only # accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' license: -- GPL-2.0-or-later + - GPL-2.0-or-later # The path to the license file for the collection. This path is relative to the root of the collection. This key is # mutually exclusive with 'license' @@ -38,11 +38,11 @@ license: # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character # requirements as 'namespace' and 'name' tags: - - cloud - - gcsfuse - - stackdriver - - logging - - monitoring + - cloud + - gcsfuse + - stackdriver + - logging + - monitoring # Collections that this collection requires to be installed for it to be usable. The key of the dict is the # collection label 'namespace.name'. The value is a version range diff --git a/meta/runtime.yml b/meta/runtime.yml index 4ed2cf6c7..ef3467047 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: '>=2.14.0' +requires_ansible: ">=2.14.0" action_groups: gcp: diff --git a/molecule/gcloud/converge.yml b/molecule/gcloud/converge.yml index 869474587..7382caebc 100644 --- a/molecule/gcloud/converge.yml +++ b/molecule/gcloud/converge.yml @@ -14,13 +14,13 @@ ansible.builtin.file: path: /etc/systemd/system/containerd.service.d state: directory - mode: 0755 + mode: "0755" when: ansible_service_mgr == "systemd" - name: Override file for containerd ansible.builtin.copy: src: files/override.conf dest: /etc/systemd/system/containerd.service.d/override.conf - mode: 0644 + mode: "0644" when: ansible_service_mgr == "systemd" roles: - role: google.cloud.gcloud diff --git a/molecule/gcloud/molecule.yml b/molecule/gcloud/molecule.yml index 7b7ab5473..0bb3e5d55 100644 --- a/molecule/gcloud/molecule.yml +++ b/molecule/gcloud/molecule.yml @@ -11,13 +11,13 @@ platforms: - name: instance image: ubuntu:18.04 privileged: true - ansible.builtin.command: "/lib/systemd/systemd" + ansible.builtin.command: /lib/systemd/systemd volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: instance image: debian:9 privileged: true - ansible.builtin.command: "/lib/systemd/systemd" + ansible.builtin.command: /lib/systemd/systemd volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro provisioner: diff --git a/molecule/gcloud/verify.yml b/molecule/gcloud/verify.yml index 86afba4ff..6e148b149 100644 --- a/molecule/gcloud/verify.yml +++ b/molecule/gcloud/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - ansible.builtin.assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/molecule/gcsfuse/molecule.yml b/molecule/gcsfuse/molecule.yml index 7b7ab5473..0bb3e5d55 100644 --- a/molecule/gcsfuse/molecule.yml +++ b/molecule/gcsfuse/molecule.yml @@ -11,13 +11,13 @@ platforms: - name: instance image: ubuntu:18.04 privileged: true - ansible.builtin.command: "/lib/systemd/systemd" + ansible.builtin.command: /lib/systemd/systemd volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: instance image: debian:9 privileged: true - ansible.builtin.command: "/lib/systemd/systemd" + ansible.builtin.command: /lib/systemd/systemd volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro provisioner: diff --git a/molecule/gcsfuse/verify.yml b/molecule/gcsfuse/verify.yml index 86afba4ff..6e148b149 100644 --- a/molecule/gcsfuse/verify.yml +++ b/molecule/gcsfuse/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - ansible.builtin.assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/plugins/modules/gcp_serviceusage_service.py b/plugins/modules/gcp_serviceusage_service.py index 49e803e00..58e26c6ca 100644 --- a/plugins/modules/gcp_serviceusage_service.py +++ b/plugins/modules/gcp_serviceusage_service.py @@ -382,9 +382,13 @@ def wait_for_operation(module, response): def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) + sleep_time = 1.0 while not status: raise_if_errors(op_result, ['error'], module) - time.sleep(1.0) + time.sleep(sleep_time) + sleep_time *= 2 + if sleep_time > 10.0: + sleep_time = 10.0 op_result = fetch_resource(module, op_uri, False) status = navigate_hash(op_result, ['done']) return op_result diff --git a/plugins/modules/gcp_sql_ssl_cert.py b/plugins/modules/gcp_sql_ssl_cert.py index b08eede9f..ff4022b56 100644 --- a/plugins/modules/gcp_sql_ssl_cert.py +++ b/plugins/modules/gcp_sql_ssl_cert.py @@ -88,7 +88,10 @@ sha1_fingerprint: description: - The SHA-1 of the certificate. - required: true + type: str + private_key: + description: + - The private key associated with the certificate. type: str project: description: @@ -198,6 +201,11 @@ - The SHA-1 of the certificate. returned: success type: str +privateKey: + description: + - The private key associated with the certificate. + returned: success + type: str ''' ################################################################################ @@ -225,7 +233,8 @@ def main(): create_time=dict(type='str'), expiration_time=dict(type='str'), instance=dict(required=True, type='dict'), - sha1_fingerprint=dict(required=True, type='str'), + sha1_fingerprint=dict(type='str'), + private_key=dict(type='str'), ) ) @@ -262,12 +271,11 @@ def main(): def create(module, link, kind): auth = GcpSession(module, 'sql') - return wait_for_operation(module, auth.post(link, resource_to_request(module))) + return wait_for_create_operation(module, auth.post(link, resource_to_request(module))) def update(module, link, kind): - auth = GcpSession(module, 'sql') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="SQL certificates cannot be modified") def delete(module, link, kind): @@ -298,7 +306,7 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')} + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name'), 'sha1_fingerprint': module.params['sha1_fingerprint']} return "https://sqladmin.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}".format(**res) @@ -367,6 +375,31 @@ def async_op_url(module, extra_data=None): return url.format(**combined) +# The create response includes the certificate, but it's not usable until +# the operation completes. The create response is also the only place the +# private key is available, so return the newly created resource directly. +def wait_for_create_operation(module, response): + op_result = return_if_object(module, response, 'sql#operation') + if op_result is None: + return {} + status = navigate_hash(op_result, ['operation', 'status']) + wait_done = wait_for_create_completion(status, op_result, module) + res = navigate_hash(op_result, ['clientCert', 'certInfo']) + res.update({'privateKey': navigate_hash(op_result, ['clientCert', 'certPrivateKey'])}) + return res + + +def wait_for_create_completion(status, op_result, module): + op_id = navigate_hash(op_result, ['operation', 'name']) + op_uri = async_op_url(module, {'op_id': op_id}) + while status != 'DONE': + raise_if_errors(op_result, ['error', 'errors'], module) + time.sleep(1.0) + op_result = fetch_resource(module, op_uri, 'sql#operation', False) + status = navigate_hash(op_result, ['status']) + return op_result + + def wait_for_operation(module, response): op_result = return_if_object(module, response, 'sql#operation') if op_result is None: diff --git a/plugins/modules/gcp_storage_default_object_acl.py b/plugins/modules/gcp_storage_default_object_acl.py index abcf2c9a7..5bfea2f74 100644 --- a/plugins/modules/gcp_storage_default_object_acl.py +++ b/plugins/modules/gcp_storage_default_object_acl.py @@ -60,11 +60,6 @@ bucket: description: - The name of the bucket. - - 'This field represents a link to a Bucket resource in GCP. It can be specified - in two ways. First, you can place a dictionary with key ''name'' and value of - your resource''s name Alternatively, you can add `register: name-of-resource` - to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource - }}"' required: true type: dict entity: @@ -75,11 +70,6 @@ * project-team-{{projectId}} * allUsers * allAuthenticatedUsers .' required: true type: str - object: - description: - - The name of the object, if applied to an object. - required: false - type: str role: description: - The access permission for the entity. @@ -195,21 +185,6 @@ - The ID for the entity. returned: success type: str -generation: - description: - - The content generation of the object, if applied to an object. - returned: success - type: int -id: - description: - - The ID of the access-control entry. - returned: success - type: str -object: - description: - - The name of the object, if applied to an object. - returned: success - type: str projectTeam: description: - The project team associated with the entity. @@ -271,10 +246,7 @@ def main(): state = module.params['state'] kind = 'storage#objectAccessControl' - if module.params['id']: - fetch = fetch_resource(module, self_link(module), kind) - else: - fetch = {} + fetch = fetch_resource(module, self_link(module), kind) changed = False if fetch: @@ -393,9 +365,6 @@ def response_to_hash(module, response): u'email': response.get(u'email'), u'entity': response.get(u'entity'), u'entityId': response.get(u'entityId'), - u'generation': response.get(u'generation'), - u'id': response.get(u'id'), - u'object': response.get(u'object'), u'projectTeam': DefaultObjectACLProjectteam(response.get(u'projectTeam', {}), module).from_response(), u'role': response.get(u'role'), } diff --git a/roles/gcloud/tasks/archive/archive_install.yml b/roles/gcloud/tasks/archive/archive_install.yml index 8f6a52aeb..5f0623066 100644 --- a/roles/gcloud/tasks/archive/archive_install.yml +++ b/roles/gcloud/tasks/archive/archive_install.yml @@ -2,20 +2,20 @@ - name: Gcloud | Archive | Ensure temp path exists ansible.builtin.file: path: "{{ gcloud_archive_path }}" - state: "directory" + state: directory mode: "0755" - name: Gcloud | Archive | Extract Cloud SDK archive ansible.builtin.unarchive: src: "{{ gcloud_archive_url }}" dest: "{{ gcloud_archive_path }}" - remote_src: yes + remote_src: true creates: "{{ gcloud_library_path }}" - name: Gcloud | Archive | Link binaries to /usr/bin (like package install) ansible.builtin.file: src: "{{ gcloud_library_path }}/bin/{{ item }}" - dest: "/usr/bin/{{ item }}" + dest: /usr/bin/{{ item }} state: link loop: - bq diff --git a/roles/gcloud/tasks/archive/command_completion.yml b/roles/gcloud/tasks/archive/command_completion.yml index d457c09d0..277210125 100644 --- a/roles/gcloud/tasks/archive/command_completion.yml +++ b/roles/gcloud/tasks/archive/command_completion.yml @@ -2,7 +2,7 @@ # task file to configure bash completion for gcloud - name: Gcloud | Archive | Debian | Ensure bash completion is installed ansible.builtin.apt: - name: "bash-completion" + name: bash-completion register: task_result until: task_result is success retries: 10 @@ -25,7 +25,7 @@ owner: root group: root state: directory - mode: 0755 + mode: "0755" - name: Gcloud | Archive | Link binaries to /usr/bin (like package install) ansible.builtin.file: diff --git a/roles/gcloud/tasks/archive/main.yml b/roles/gcloud/tasks/archive/main.yml index 989c89ba9..49eb87298 100644 --- a/roles/gcloud/tasks/archive/main.yml +++ b/roles/gcloud/tasks/archive/main.yml @@ -7,7 +7,7 @@ - name: Gcloud | Archive | Get gcloud_status ansible.builtin.debug: - var: "gcloud_status" + var: gcloud_status - name: Gcloud | Archive | Set installed version if installation exists when: gcloud_status.stat.exists @@ -30,11 +30,10 @@ {{ gcloud_installed_version }} is already installed. - name: Gcloud | Archive | Start installation - when: gcloud_installed_version is undefined or - gcloud_version is version(gcloud_installed_version, '>') + when: gcloud_installed_version is undefined or gcloud_version is version(gcloud_installed_version, '>') ansible.builtin.include_tasks: archive_install.yml -- name: Gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301 +- name: Gcloud | Debian | Install the google-cloud-sdk additional components # noqa no-changed-when ansible.builtin.command: gcloud components install {{ item }} register: gcloud_install_comp_status changed_when: "'All components are up to date.' not in gcloud_install_comp_status.stderr_lines" diff --git a/roles/gcloud/tasks/main.yml b/roles/gcloud/tasks/main.yml index bdbd347a2..c7b646d7e 100644 --- a/roles/gcloud/tasks/main.yml +++ b/roles/gcloud/tasks/main.yml @@ -1,15 +1,14 @@ --- - - name: Gcloud | Load Distro and OS specific variables ansible.builtin.include_vars: "{{ lookup('first_found', params) }}" vars: params: files: - - "os/{{ ansible_distribution | lower }}.yml" - - "os/{{ ansible_os_family | lower }}.yml" + - os/{{ ansible_distribution | lower }}.yml + - os/{{ ansible_os_family | lower }}.yml - main.yml paths: - - 'vars' + - vars - name: Gcloud | Install the google-cloud-sdk from {{ gcloud_install_type }} ansible.builtin.include_tasks: "{{ gcloud_install_type }}/main.yml" diff --git a/roles/gcloud/tasks/package/debian.yml b/roles/gcloud/tasks/package/debian.yml index 6b0bf707a..726c79ee6 100644 --- a/roles/gcloud/tasks/package/debian.yml +++ b/roles/gcloud/tasks/package/debian.yml @@ -7,13 +7,13 @@ - name: Gcloud | Debian | Add the gcloud repository ansible.builtin.apt_repository: - repo: "deb {{ gcloud_apt_url }} {{ gcloud_apt_repo }} main" + repo: deb {{ gcloud_apt_url }} {{ gcloud_apt_repo }} main state: present filename: google-cloud-sdk - name: Gcloud | Debian | Install the google-cloud-sdk package ansible.builtin.apt: - name: "google-cloud-sdk" + name: google-cloud-sdk update_cache: "yes" register: task_result until: task_result is success @@ -22,7 +22,7 @@ - name: Gcloud | Debian | Install the google-cloud-sdk additional components ansible.builtin.apt: - name: "google-cloud-sdk-{{ item }}" + name: google-cloud-sdk-{{ item }} update_cache: "yes" register: task_result until: task_result is success diff --git a/roles/gcloud/tasks/package/redhat.yml b/roles/gcloud/tasks/package/redhat.yml index 50cdac5a1..8917561a2 100644 --- a/roles/gcloud/tasks/package/redhat.yml +++ b/roles/gcloud/tasks/package/redhat.yml @@ -4,16 +4,16 @@ name: google-cloud-sdk description: Google Cloud SDK baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64 - enabled: yes - gpgcheck: yes - repo_gpgcheck: yes + enabled: true + gpgcheck: true + repo_gpgcheck: true gpgkey: - https://packages.cloud.google.com/yum/doc/yum-key.gpg - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg - name: Gcloud | RHEL | Install the google-cloud-sdk package ansible.builtin.yum: - name: "google-cloud-sdk" + name: google-cloud-sdk update_cache: "yes" register: task_result until: task_result is success @@ -22,7 +22,7 @@ - name: Gcloud | Debian | Install the google-cloud-sdk additional components ansible.builtin.yum: - name: "google-cloud-sdk-{{ item }}" + name: google-cloud-sdk-{{ item }} update_cache: "yes" register: task_result until: task_result is success diff --git a/roles/gcp_http_lb/README.md b/roles/gcp_http_lb/README.md index 901de6e1a..89cbf69ae 100644 --- a/roles/gcp_http_lb/README.md +++ b/roles/gcp_http_lb/README.md @@ -14,8 +14,8 @@ Role Variables ``` gcp_http_lb_backend: the selflink for the backend that this load balancer will be supporting - gcp_project: the name of your gcp project - service_account_file: the path to your service account JSON file + gcp_http_lb_gcp_project: the name of your gcp project + gcp_http_lb_service_account_file: the path to your service account JSON file ``` Example Playbook diff --git a/roles/gcp_http_lb/defaults/main.yml b/roles/gcp_http_lb/defaults/main.yml index f705f01df..11f0870b2 100644 --- a/roles/gcp_http_lb/defaults/main.yml +++ b/roles/gcp_http_lb/defaults/main.yml @@ -2,13 +2,13 @@ # defaults file for gcp-http-lb gcp_http_lb_state: present gcp_http_lb_cdn: true -gcp_http_lb_name_prefix: 'gcp' +gcp_http_lb_name_prefix: gcp # Name schemes for resources being created -gcp_http_lb_globaladdress: "{{gcp_lb_name_prefix}}-globaladdress" -gcp_http_lb_instancegroup: "{{gcp_lb_name_prefix}}-instancegroup" -gcp_http_lb_healthcheck: "{{gcp_lb_name_prefix}}-healthcheck" -gcp_http_lb_backendservice: "{{gcp_lb_name_prefix}}-backendservice" -gcp_http_lb_urlmap: "{{gcp_lb_name_prefix}}-urlmap" -gcp_http_lb_httpproxy: "{{gcp_lb_name_prefix}}-httpproxy" -gcp_http_lb_forwardingrule: "{{gcp_lb_name_prefix}}-forwardingrule" +gcp_http_lb_globaladdress: "{{ gcp_lb_name_prefix }}-globaladdress" +gcp_http_lb_instancegroup: "{{ gcp_lb_name_prefix }}-instancegroup" +gcp_http_lb_healthcheck: "{{ gcp_lb_name_prefix }}-healthcheck" +gcp_http_lb_backendservice: "{{ gcp_lb_name_prefix }}-backendservice" +gcp_http_lb_urlmap: "{{ gcp_lb_name_prefix }}-urlmap" +gcp_http_lb_httpproxy: "{{ gcp_lb_name_prefix }}-httpproxy" +gcp_http_lb_forwardingrule: "{{ gcp_lb_name_prefix }}-forwardingrule" diff --git a/roles/gcp_http_lb/meta/main.yml b/roles/gcp_http_lb/meta/main.yml index 9ee910409..98cccc5cf 100644 --- a/roles/gcp_http_lb/meta/main.yml +++ b/roles/gcp_http_lb/meta/main.yml @@ -1,3 +1,4 @@ +--- galaxy_info: author: googlecloudplatform description: Create a HTTP Load Balancer on GCP @@ -16,7 +17,7 @@ galaxy_info: # - CC-BY license: GPLv3 - min_ansible_version: 2.7 + min_ansible_version: "2.7" # If this a Container Enabled role, provide the minimum Ansible Container version. # min_ansible_container_version: @@ -47,12 +48,12 @@ galaxy_info: # - 99.99 galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. +# List tags for your role here, one per line. A tag is a keyword that describes +# and categorizes the role. Users find roles by searching for tags. Be sure to +# remove the '[]' above, if you add tags to this list. +# +# NOTE: A tag is limited to a single word comprised of alphanumeric characters. +# Maximum 20 tags per role. dependencies: [] # List your role dependencies here, one per line. Be sure to remove the '[]' above, diff --git a/roles/gcp_http_lb/tasks/main.yml b/roles/gcp_http_lb/tasks/main.yml index 8ed8f4d36..67826df41 100644 --- a/roles/gcp_http_lb/tasks/main.yml +++ b/roles/gcp_http_lb/tasks/main.yml @@ -1,65 +1,65 @@ --- -- name: create a global address for the load balancer. - gcp_compute_global_address: - name: "{{ gcp_http_lb_globaladdress }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" +- name: Create a global address for the load balancer. + google.cloud.gcp_compute_global_address: + name: "{{ gcp_http_lb_globaladdress }}" + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: globaladdress -- name: create a http health check to verify lb working - gcp_compute_http_health_check: - name: "{{ gcp_http_lb_healthcheck }}" - healthy_threshold: 10 - port: 80 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" +- name: Create a http health check to verify lb working + google.cloud.gcp_compute_http_health_check: + name: "{{ gcp_http_lb_healthcheck }}" + healthy_threshold: 10 + port: 80 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: "{{ gcp_http_lb_backendservice }}" - backends: +- name: Create a backend service + google.cloud.gcp_compute_backend_service: + name: "{{ gcp_http_lb_backendservice }}" + backends: - group: "{{ gcp_http_lb_backend.selfLink }}" - health_checks: + health_checks: - "{{ healthcheck.selfLink }}" - enable_cdn: "{{ gcp_http_lb_cdn }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" + enable_cdn: "{{ gcp_http_lb_cdn }}" + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: backendservice -- name: create a url map - gcp_compute_url_map: - name: "{{ gcp_http_lb_urlmap }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" +- name: Create a url map + google.cloud.gcp_compute_url_map: + name: "{{ gcp_http_lb_urlmap }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: urlmap -- name: create a target http proxy - gcp_compute_target_http_proxy: - name: "{{ gcp_http_lb_httpproxy }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" +- name: Create a target http proxy + google.cloud.gcp_compute_target_http_proxy: + name: "{{ gcp_http_lb_httpproxy }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: httpproxy -- name: create a global forwarding rule - gcp_compute_global_forwarding_rule: - name: "{{ gcp_http_lb_forwardingrule }}" - ip_address: "{{ globaladdress.address }}" - load_balancing_scheme: "EXTERNAL" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" +- name: Create a global forwarding rule + google.cloud.gcp_compute_global_forwarding_rule: + name: "{{ gcp_http_lb_forwardingrule }}" + ip_address: "{{ globaladdress.address }}" + load_balancing_scheme: EXTERNAL + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: result diff --git a/roles/gcp_http_lb/tests/test.yml b/roles/gcp_http_lb/tests/test.yml index 341c7a4ed..6f659ef21 100644 --- a/roles/gcp_http_lb/tests/test.yml +++ b/roles/gcp_http_lb/tests/test.yml @@ -1,5 +1,6 @@ --- -- hosts: localhost +- name: Test gcp_http_lb role + hosts: localhost remote_user: root roles: - gcp_http_lb diff --git a/roles/gcp_http_lb/vars/main.yml b/roles/gcp_http_lb/vars/main.yml index ca9443f6f..f78469c95 100644 --- a/roles/gcp_http_lb/vars/main.yml +++ b/roles/gcp_http_lb/vars/main.yml @@ -1,12 +1,12 @@ --- # vars file for gcp-http-lb -vars: - # The backend this LB will be supporting. This will typically be a Instance Group: - # example: projects/sample-project/zones/us-central1-c/instanceGroups/sample-instance-group - gcp_http_lb_backend: your-backend - # The name of your GCP project - gcp_project: your-project - # The kind of authentication you will use (serviceaccount is recommended) - auth_kind: serviceaccount - # The path to your service account file (if using the serviceaccount auth kind) - service_account_file: path-to-service-account-file + +# The backend this LB will be supporting. This will typically be a Instance Group: +# example: projects/sample-project/zones/us-central1-c/instanceGroups/sample-instance-group +gcp_http_lb_backend: your-backend +# The name of your GCP project +gcp_http_lb_gcp_project: your-project +# The kind of authentication you will use (serviceaccount is recommended) +gcp_http_lb_auth_kind: serviceaccount +# The path to your service account file (if using the serviceaccount auth kind) +gcp_http_lb_service_account_file: path-to-service-account-file diff --git a/roles/gcsfuse/tasks/debian.yml b/roles/gcsfuse/tasks/debian.yml index 941f3bd42..ecd698f92 100644 --- a/roles/gcsfuse/tasks/debian.yml +++ b/roles/gcsfuse/tasks/debian.yml @@ -1,7 +1,7 @@ --- - name: Gcsfuse | Ensure gpg is installed ansible.builtin.apt: - name: "gnupg" + name: gnupg register: task_result until: task_result is success retries: 10 @@ -20,7 +20,7 @@ - name: Gcsfuse | Install gcsfuse ansible.builtin.apt: - name: "gcsfuse" + name: gcsfuse update_cache: "yes" register: task_result until: task_result is success diff --git a/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml b/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml index 63f4b0a56..ba66644fc 100644 --- a/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml +++ b/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml @@ -1,2 +1,2 @@ --- -resource_name: "{{ resource_prefix }}" \ No newline at end of file +resource_name: "{{ resource_prefix }}" diff --git a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml index af2774e41..a38d9a7f2 100644 --- a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a firewall rule +- name: Delete a firewall rule google.cloud.gcp_appengine_firewall_rule: priority: 1000 source_range: 10.0.0.0 @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a firewall rule +- name: Create a firewall rule google.cloud.gcp_appengine_firewall_rule: priority: 1000 source_range: 10.0.0.0 @@ -33,24 +33,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall_rule was created +- name: Verify that firewall_rule was created google.cloud.gcp_appengine_firewall_rule_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length >= 1 # ---------------------------------------------------------------------------- -- name: create a firewall rule that already exists +- name: Create a firewall rule that already exists google.cloud.gcp_appengine_firewall_rule: priority: 1000 source_range: 10.0.0.0 @@ -60,12 +60,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a firewall rule +- name: Delete a firewall rule google.cloud.gcp_appengine_firewall_rule: priority: 1000 source_range: 10.0.0.0 @@ -75,26 +75,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall_rule was deleted +- name: Verify that firewall_rule was deleted google.cloud.gcp_appengine_firewall_rule_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: # there is a default firewall rule that cannot be # deleted, so the length should be 1. - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: delete a firewall rule that does not exist +- name: Delete a firewall rule that does not exist google.cloud.gcp_appengine_firewall_rule: priority: 1000 source_range: 10.0.0.0 @@ -104,7 +104,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml +++ b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml b/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml index 64d8e605c..71484a34d 100644 --- a/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml +++ b/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a dataset +- name: Delete a dataset google.cloud.gcp_bigquery_dataset: name: my_example_dataset dataset_reference: @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a dataset +- name: Create a dataset google.cloud.gcp_bigquery_dataset: name: my_example_dataset dataset_reference: @@ -33,24 +33,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that dataset was created +- name: Verify that dataset was created google.cloud.gcp_bigquery_dataset_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/bigquery + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/bigquery register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='datasetReference') | map(attribute='datasetId') | select("match", ".*my_example_dataset.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a dataset that already exists +- name: Create a dataset that already exists google.cloud.gcp_bigquery_dataset: name: my_example_dataset dataset_reference: @@ -60,12 +60,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a dataset +- name: Delete a dataset google.cloud.gcp_bigquery_dataset: name: my_example_dataset dataset_reference: @@ -75,24 +75,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that dataset was deleted +- name: Verify that dataset was deleted google.cloud.gcp_bigquery_dataset_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/bigquery + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/bigquery register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='datasetReference') | map(attribute='datasetId') | select("match", ".*my_example_dataset.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a dataset that does not exist +- name: Delete a dataset that does not exist google.cloud.gcp_bigquery_dataset: name: my_example_dataset dataset_reference: @@ -102,7 +102,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_bigquery_dataset/tasks/main.yml b/tests/integration/targets/gcp_bigquery_dataset/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_bigquery_dataset/tasks/main.yml +++ b/tests/integration/targets/gcp_bigquery_dataset/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml b/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml index c8b84097b..1e42d655d 100644 --- a/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml +++ b/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a dataset +- name: Create a dataset google.cloud.gcp_bigquery_dataset: name: example_dataset dataset_reference: @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: dataset -- name: delete a table +- name: Delete a table google.cloud.gcp_bigquery_table: name: example_table dataset: example_dataset @@ -36,7 +36,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a table +- name: Create a table google.cloud.gcp_bigquery_table: name: example_table dataset: example_dataset @@ -49,25 +49,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that table was created +- name: Verify that table was created google.cloud.gcp_bigquery_table_info: - dataset: example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/bigquery + dataset: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/bigquery register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='tableReference') | map(attribute='tableId') | select("match", ".*example_table.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a table that already exists +- name: Create a table that already exists google.cloud.gcp_bigquery_table: name: example_table dataset: example_dataset @@ -80,12 +80,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a table +- name: Delete a table google.cloud.gcp_bigquery_table: name: example_table dataset: example_dataset @@ -98,25 +98,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that table was deleted +- name: Verify that table was deleted google.cloud.gcp_bigquery_table_info: - dataset: example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/bigquery + dataset: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/bigquery register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='tableReference') | map(attribute='tableId') | select("match", ".*example_table.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a table that does not exist +- name: Delete a table that does not exist google.cloud.gcp_bigquery_table: name: example_table dataset: example_dataset @@ -129,14 +129,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a dataset +- name: Delete a dataset google.cloud.gcp_bigquery_dataset: name: example_dataset dataset_reference: diff --git a/tests/integration/targets/gcp_bigquery_table/tasks/main.yml b/tests/integration/targets/gcp_bigquery_table/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_bigquery_table/tasks/main.yml +++ b/tests/integration/targets/gcp_bigquery_table/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml b/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml index e5cf02b06..7406950d1 100644 --- a/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml @@ -13,107 +13,107 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a instance +- name: Delete a instance google.cloud.gcp_bigtable_instance: name: my-instance display_name: My Test Cluster clusters: - - name: mycluster - location: projects/{{ gcp_project }}/locations/us-central1-a - serve_nodes: 1 + - name: mycluster + location: projects/{{ gcp_project }}/locations/us-central1-a + serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_bigtable_instance: name: my-instance display_name: My Test Cluster clusters: - - name: mycluster - location: projects/{{ gcp_project }}/locations/us-central1-a - serve_nodes: 1 + - name: mycluster + location: projects/{{ gcp_project }}/locations/us-central1-a + serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_bigtable_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*my-instance.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_bigtable_instance: name: my-instance display_name: My Test Cluster clusters: - - name: mycluster - location: projects/{{ gcp_project }}/locations/us-central1-a - serve_nodes: 1 + - name: mycluster + location: projects/{{ gcp_project }}/locations/us-central1-a + serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_bigtable_instance: name: my-instance display_name: My Test Cluster clusters: - - name: mycluster - location: projects/{{ gcp_project }}/locations/us-central1-a - serve_nodes: 1 + - name: mycluster + location: projects/{{ gcp_project }}/locations/us-central1-a + serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_bigtable_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*my-instance.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_bigtable_instance: name: my-instance display_name: My Test Cluster clusters: - - name: mycluster - location: projects/{{ gcp_project }}/locations/us-central1-a - serve_nodes: 1 + - name: mycluster + location: projects/{{ gcp_project }}/locations/us-central1-a + serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_bigtable_instance/tasks/main.yml b/tests/integration/targets/gcp_bigtable_instance/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_bigtable_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_bigtable_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml b/tests/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml index aa87a2a8e..aa65c31f5 100644 --- a/tests/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml +++ b/tests/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml @@ -1,3 +1,3 @@ --- # defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml index e803c4c9e..da43b2154 100644 --- a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml +++ b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml @@ -13,57 +13,57 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a cloud function +- name: Delete a cloud function google.cloud.gcp_cloudfunctions_cloud_function: name: "{{ resource_name }}" location: us-central1 entry_point: helloGET source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip - trigger_http: 'true' + trigger_http: "true" project: "{{ gcp_project }}" - runtime: "python310" + runtime: python310 auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a cloud function +- name: Create a cloud function google.cloud.gcp_cloudfunctions_cloud_function: name: "{{ resource_name }}" location: us-central1 entry_point: helloGET source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip - trigger_http: 'true' + trigger_http: "true" project: "{{ gcp_project }}" - runtime: "python310" + runtime: python310 auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that cloud_function was created +- name: Verify that cloud_function was created google.cloud.gcp_cloudfunctions_cloud_function_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a cloud function that already exists +- name: Create a cloud function that already exists google.cloud.gcp_cloudfunctions_cloud_function: name: "{{ resource_name }}" location: us-central1 entry_point: helloGET source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip - trigger_http: 'true' + trigger_http: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" # runtime is not sent as it is optional for @@ -72,54 +72,54 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a cloud function +- name: Delete a cloud function google.cloud.gcp_cloudfunctions_cloud_function: name: "{{ resource_name }}" location: us-central1 entry_point: helloGET source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip - trigger_http: 'true' + trigger_http: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that cloud_function was deleted +- name: Verify that cloud_function was deleted google.cloud.gcp_cloudfunctions_cloud_function_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a cloud function that does not exist +- name: Delete a cloud function that does not exist google.cloud.gcp_cloudfunctions_cloud_function: name: "{{ resource_name }}" location: us-central1 entry_point: helloGET source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip - trigger_http: 'true' + trigger_http: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/main.yml b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/main.yml +++ b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml b/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml index 078bd2bb1..917e323a0 100644 --- a/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml +++ b/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a job +- name: Delete a job google.cloud.gcp_cloudscheduler_job: name: job region: us-central1 @@ -27,13 +27,13 @@ service: web version: prod instance: my-instance-001 - relative_uri: "/ping" + relative_uri: /ping project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a job +- name: Create a job google.cloud.gcp_cloudscheduler_job: name: job region: us-central1 @@ -47,31 +47,31 @@ service: web version: prod instance: my-instance-001 - relative_uri: "/ping" + relative_uri: /ping project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that job was created +- name: Verify that job was created google.cloud.gcp_cloudscheduler_job_info: - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*job.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a job that already exists +- name: Create a job that already exists google.cloud.gcp_cloudscheduler_job: name: job region: us-central1 @@ -85,18 +85,18 @@ service: web version: prod instance: my-instance-001 - relative_uri: "/ping" + relative_uri: /ping project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a job +- name: Delete a job google.cloud.gcp_cloudscheduler_job: name: job region: us-central1 @@ -110,31 +110,31 @@ service: web version: prod instance: my-instance-001 - relative_uri: "/ping" + relative_uri: /ping project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that job was deleted +- name: Verify that job was deleted google.cloud.gcp_cloudscheduler_job_info: - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*job.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a job that does not exist +- name: Delete a job that does not exist google.cloud.gcp_cloudscheduler_job: name: job region: us-central1 @@ -148,13 +148,13 @@ service: web version: prod instance: my-instance-001 - relative_uri: "/ping" + relative_uri: /ping project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_cloudscheduler_job/tasks/main.yml b/tests/integration/targets/gcp_cloudscheduler_job/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_cloudscheduler_job/tasks/main.yml +++ b/tests/integration/targets/gcp_cloudscheduler_job/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml b/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml index 2fa585c21..6e1f70f22 100644 --- a/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml +++ b/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a queue +- name: Delete a queue google.cloud.gcp_cloudtasks_queue: name: "{{ resource_name }}" location: us-central1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a queue +- name: Create a queue google.cloud.gcp_cloudtasks_queue: name: "{{ resource_name }}" location: us-central1 @@ -31,25 +31,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that queue was created +- name: Verify that queue was created google.cloud.gcp_cloudtasks_queue_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a queue that already exists +- name: Create a queue that already exists google.cloud.gcp_cloudtasks_queue: name: "{{ resource_name }}" location: us-central1 @@ -58,12 +58,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a queue +- name: Delete a queue google.cloud.gcp_cloudtasks_queue: name: "{{ resource_name }}" location: us-central1 @@ -72,25 +72,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that queue was deleted +- name: Verify that queue was deleted google.cloud.gcp_cloudtasks_queue_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a queue that does not exist +- name: Delete a queue that does not exist google.cloud.gcp_cloudtasks_queue: name: "{{ resource_name }}" location: us-central1 @@ -99,7 +99,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_cloudtasks_queue/tasks/main.yml b/tests/integration/targets/gcp_cloudtasks_queue/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_cloudtasks_queue/tasks/main.yml +++ b/tests/integration/targets/gcp_cloudtasks_queue/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_address/tasks/autogen.yml b/tests/integration/targets/gcp_compute_address/tasks/autogen.yml index 5fdd5d504..b4e9634dd 100644 --- a/tests/integration/targets/gcp_compute_address/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_address/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: test-address1 region: us-west1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: test-address1 region: us-west1 @@ -31,27 +31,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that address was created +- name: Verify that address was created google.cloud.gcp_compute_address_info: - filters: - - name = test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a address that already exists +- name: Create a address that already exists google.cloud.gcp_compute_address: name: test-address1 region: us-west1 @@ -60,12 +60,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: test-address1 region: us-west1 @@ -74,27 +74,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that address was deleted +- name: Verify that address was deleted google.cloud.gcp_compute_address_info: - filters: - - name = test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a address that does not exist +- name: Delete a address that does not exist google.cloud.gcp_compute_address: name: test-address1 region: us-west1 @@ -103,7 +103,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_address/tasks/main.yml b/tests/integration/targets/gcp_compute_address/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_address/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_address/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml b/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml index 79b05de20..4e1ad7687 100644 --- a/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -31,28 +31,28 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a instance template +- name: Create a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate -- name: create a instance group manager +- name: Create a instance group manager google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -64,7 +64,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: igm -- name: delete a autoscaler +- name: Delete a autoscaler google.cloud.gcp_compute_autoscaler: name: "{{ resource_name }}" zone: us-central1-a @@ -74,13 +74,13 @@ min_num_replicas: 1 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 + utilization_target: !!float "0.5" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a autoscaler +- name: Create a autoscaler google.cloud.gcp_compute_autoscaler: name: "{{ resource_name }}" zone: us-central1-a @@ -90,33 +90,33 @@ min_num_replicas: 1 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 + utilization_target: !!float "0.5" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that autoscaler was created +- name: Verify that autoscaler was created google.cloud.gcp_compute_autoscaler_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a autoscaler that already exists +- name: Create a autoscaler that already exists google.cloud.gcp_compute_autoscaler: name: "{{ resource_name }}" zone: us-central1-a @@ -126,18 +126,18 @@ min_num_replicas: 1 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 + utilization_target: !!float "0.5" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a autoscaler +- name: Delete a autoscaler google.cloud.gcp_compute_autoscaler: name: "{{ resource_name }}" zone: us-central1-a @@ -147,33 +147,33 @@ min_num_replicas: 1 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 + utilization_target: !!float "0.5" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that autoscaler was deleted +- name: Verify that autoscaler was deleted google.cloud.gcp_compute_autoscaler_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a autoscaler that does not exist +- name: Delete a autoscaler that does not exist google.cloud.gcp_compute_autoscaler: name: "{{ resource_name }}" zone: us-central1-a @@ -183,20 +183,20 @@ min_num_replicas: 1 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 + utilization_target: !!float "0.5" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance group manager +- name: Delete a instance group manager google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -209,29 +209,29 @@ state: absent register: igm ignore_errors: true -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -241,7 +241,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_autoscaler/tasks/main.yml b/tests/integration/targets/gcp_compute_autoscaler/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_autoscaler/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_autoscaler/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml b/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml index 018a74971..c54b02276 100644 --- a/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a bucket +- name: Create a bucket google.cloud.gcp_storage_bucket: name: bucket-backendbucket project: "{{ gcp_project }}" @@ -21,112 +21,112 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: bucket -- name: delete a backend bucket +- name: Delete a backend bucket google.cloud.gcp_compute_backend_bucket: name: "{{ resource_name }}" bucket_name: "{{ bucket.name }}" description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a backend bucket +- name: Create a backend bucket google.cloud.gcp_compute_backend_bucket: name: "{{ resource_name }}" bucket_name: "{{ bucket.name }}" description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that backend_bucket was created +- name: Verify that backend_bucket was created google.cloud.gcp_compute_backend_bucket_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a backend bucket that already exists +- name: Create a backend bucket that already exists google.cloud.gcp_compute_backend_bucket: name: "{{ resource_name }}" bucket_name: "{{ bucket.name }}" description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a backend bucket +- name: Delete a backend bucket google.cloud.gcp_compute_backend_bucket: name: "{{ resource_name }}" bucket_name: "{{ bucket.name }}" description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that backend_bucket was deleted +- name: Verify that backend_bucket was deleted google.cloud.gcp_compute_backend_bucket_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a backend bucket that does not exist +- name: Delete a backend bucket that does not exist google.cloud.gcp_compute_backend_bucket: name: "{{ resource_name }}" bucket_name: "{{ bucket.name }}" description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a bucket +- name: Delete a bucket google.cloud.gcp_storage_bucket: name: bucket-backendbucket project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_backend_bucket/tasks/main.yml b/tests/integration/targets/gcp_compute_backend_bucket/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_backend_bucket/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_backend_bucket/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml b/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml index 38de23f78..011a5d4cf 100644 --- a/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-backendservice zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-backendservice healthy_threshold: 10 @@ -34,122 +34,122 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: "{{ resource_name }}" backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: "{{ resource_name }}" backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that backend_service was created +- name: Verify that backend_service was created google.cloud.gcp_compute_backend_service_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a backend service that already exists +- name: Create a backend service that already exists google.cloud.gcp_compute_backend_service: name: "{{ resource_name }}" backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: "{{ resource_name }}" backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that backend_service was deleted +- name: Verify that backend_service was deleted google.cloud.gcp_compute_backend_service_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a backend service that does not exist +- name: Delete a backend service that does not exist google.cloud.gcp_compute_backend_service: name: "{{ resource_name }}" backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-backendservice healthy_threshold: 10 @@ -162,7 +162,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-backendservice zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_backend_service/tasks/main.yml b/tests/integration/targets/gcp_compute_backend_service/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_backend_service/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_backend_service/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml b/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml index 79ef475f7..963797247 100644 --- a/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: "{{ resource_name }}" size_gb: 50 @@ -25,7 +25,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a disk +- name: Create a disk google.cloud.gcp_compute_disk: name: "{{ resource_name }}" size_gb: 50 @@ -37,27 +37,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that disk was created +- name: Verify that disk was created google.cloud.gcp_compute_disk_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a disk that already exists +- name: Create a disk that already exists google.cloud.gcp_compute_disk: name: "{{ resource_name }}" size_gb: 50 @@ -69,12 +69,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: "{{ resource_name }}" size_gb: 50 @@ -86,27 +86,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that disk was deleted +- name: Verify that disk was deleted google.cloud.gcp_compute_disk_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a disk that does not exist +- name: Delete a disk that does not exist google.cloud.gcp_compute_disk: name: "{{ resource_name }}" size_gb: 50 @@ -118,7 +118,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_disk/tasks/main.yml b/tests/integration/targets/gcp_compute_disk/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_disk/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_disk/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml index 91c87db8b..f6fd6da77 100644 --- a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml @@ -13,115 +13,115 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a external vpn gateway +- name: Delete a external vpn gateway google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT description: An externaly managed VPN gateway interfaces: - - id: 0 - ip_address: 8.8.8.8 + - id: 0 + ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a external vpn gateway +- name: Create a external vpn gateway google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT description: An externalyl managed VPN gateway interfaces: - - id: 0 - ip_address: 8.8.8.8 + - id: 0 + ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that external_vpn_gateway was created +- name: Verify that external_vpn_gateway was created google.cloud.gcp_compute_external_vpn_gateway_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a external vpn gateway that already exists +- name: Create a external vpn gateway that already exists google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT description: An externalyl managed VPN gateway interfaces: - - id: 0 - ip_address: 8.8.8.8 + - id: 0 + ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a external vpn gateway +- name: Delete a external vpn gateway google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT description: An externalyl managed VPN gateway interfaces: - - id: 0 - ip_address: 8.8.8.8 + - id: 0 + ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that external_vpn_gateway was deleted +- name: Verify that external_vpn_gateway was deleted google.cloud.gcp_compute_external_vpn_gateway_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a external vpn gateway that does not exist +- name: Delete a external vpn gateway that does not exist google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT description: An externalyl managed VPN gateway interfaces: - - id: 0 - ip_address: 8.8.8.8 + - id: 0 + ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/main.yml b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml b/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml index 04393dbb7..bf51839d3 100644 --- a/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml @@ -13,135 +13,135 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a firewall +- name: Delete a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a firewall +- name: Create a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall was created +- name: Verify that firewall was created google.cloud.gcp_compute_firewall_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a firewall that already exists +- name: Create a firewall that already exists google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a firewall +- name: Delete a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall was deleted +- name: Verify that firewall was deleted google.cloud.gcp_compute_firewall_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a firewall that does not exist +- name: Delete a firewall that does not exist google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_firewall/tasks/main.yml b/tests/integration/targets/gcp_compute_firewall/tasks/main.yml index 3cfb1cb12..b26677370 100644 --- a/tests/integration/targets/gcp_compute_firewall/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_firewall/tasks/main.yml @@ -1,3 +1,5 @@ --- -- include_tasks: update.yml -- include_tasks: autogen.yml +- name: Update test + ansible.builtin.include_tasks: update.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_firewall/tasks/update.yml b/tests/integration/targets/gcp_compute_firewall/tasks/update.yml index 0eda28338..3a2f73a9b 100644 --- a/tests/integration/targets/gcp_compute_firewall/tasks/update.yml +++ b/tests/integration/targets/gcp_compute_firewall/tasks/update.yml @@ -26,154 +26,154 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a firewall +- name: Delete a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a firewall +- name: Create a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall was created +- name: Verify that firewall was created google.cloud.gcp_compute_firewall_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: update the firewall +- name: Update the firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '55' + - ip_protocol: tcp + ports: + - "55" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: check firewall was updated. +- name: Check firewall was updated. google.cloud.gcp_compute_firewall_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 -- name: verify that update succeeded - assert: +- name: Verify that update succeeded + ansible.builtin.assert: that: - results['resources'][0]['allowed'][0]['ports'][0] == '55' #---------------------------------------------------------- -- name: delete a firewall +- name: Delete a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall was deleted +- name: Verify that firewall was deleted google.cloud.gcp_compute_firewall_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a firewall that does not exist +- name: Delete a firewall that does not exist google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml index ebde3dd76..c26206fe7 100644 --- a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-forwardingrule region: us-west1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a target pool +- name: Create a target pool google.cloud.gcp_compute_target_pool: name: targetpool-forwardingrule region: us-west1 @@ -31,7 +31,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: targetpool -- name: delete a forwarding rule +- name: Delete a forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 @@ -44,7 +44,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a forwarding rule +- name: Create a forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 @@ -57,27 +57,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that forwarding_rule was created +- name: Verify that forwarding_rule was created google.cloud.gcp_compute_forwarding_rule_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a forwarding rule that already exists +- name: Create a forwarding rule that already exists google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 @@ -90,12 +90,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a forwarding rule +- name: Delete a forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 @@ -108,27 +108,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that forwarding_rule was deleted +- name: Verify that forwarding_rule was deleted google.cloud.gcp_compute_forwarding_rule_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a forwarding rule that does not exist +- name: Delete a forwarding rule that does not exist google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 @@ -141,14 +141,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a target pool +- name: Delete a target pool google.cloud.gcp_compute_target_pool: name: targetpool-forwardingrule region: us-west1 @@ -158,7 +158,7 @@ state: absent register: targetpool ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-forwardingrule region: us-west1 diff --git a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml b/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml index 4276aa638..3333e3f51 100644 --- a/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a global address +- name: Delete a global address google.cloud.gcp_compute_global_address: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a global address +- name: Create a global address google.cloud.gcp_compute_global_address: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -29,26 +29,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that global_address was created +- name: Verify that global_address was created google.cloud.gcp_compute_global_address_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a global address that already exists +- name: Create a global address that already exists google.cloud.gcp_compute_global_address: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -56,12 +56,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a global address +- name: Delete a global address google.cloud.gcp_compute_global_address: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -69,26 +69,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that global_address was deleted +- name: Verify that global_address was deleted google.cloud.gcp_compute_global_address_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a global address that does not exist +- name: Delete a global address that does not exist google.cloud.gcp_compute_global_address: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -96,7 +96,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_global_address/tasks/main.yml b/tests/integration/targets/gcp_compute_global_address/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_global_address/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_global_address/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml b/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml index d6df59d1b..93bab3afe 100644 --- a/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a global address +- name: Create a global address google.cloud.gcp_compute_global_address: name: globaladdress-globalforwardingrule project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: globaladdress -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-globalforwardingrule zone: us-central1-a @@ -30,7 +30,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-globalforwardingrule healthy_threshold: 10 @@ -42,20 +42,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-globalforwardingrule backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: create a URL map +- name: Create a URL map google.cloud.gcp_compute_url_map: name: urlmap-globalforwardingrule default_service: "{{ backendservice }}" @@ -64,7 +64,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap -- name: create a target HTTP proxy +- name: Create a target HTTP proxy google.cloud.gcp_compute_target_http_proxy: name: targethttpproxy-globalforwardingrule url_map: "{{ urlmap }}" @@ -73,7 +73,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: httpproxy -- name: delete a global forwarding rule +- name: Delete a global forwarding rule google.cloud.gcp_compute_global_forwarding_rule: name: "{{ resource_name }}" ip_address: "{{ globaladdress.address }}" @@ -85,7 +85,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a global forwarding rule +- name: Create a global forwarding rule google.cloud.gcp_compute_global_forwarding_rule: name: "{{ resource_name }}" ip_address: "{{ globaladdress.address }}" @@ -97,26 +97,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that global_forwarding_rule was created +- name: Verify that global_forwarding_rule was created google.cloud.gcp_compute_global_forwarding_rule_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a global forwarding rule that already exists +- name: Create a global forwarding rule that already exists google.cloud.gcp_compute_global_forwarding_rule: name: "{{ resource_name }}" ip_address: "{{ globaladdress.address }}" @@ -128,12 +128,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a global forwarding rule +- name: Delete a global forwarding rule google.cloud.gcp_compute_global_forwarding_rule: name: "{{ resource_name }}" ip_address: "{{ globaladdress.address }}" @@ -145,26 +145,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that global_forwarding_rule was deleted +- name: Verify that global_forwarding_rule was deleted google.cloud.gcp_compute_global_forwarding_rule_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a global forwarding rule that does not exist +- name: Delete a global forwarding rule that does not exist google.cloud.gcp_compute_global_forwarding_rule: name: "{{ resource_name }}" ip_address: "{{ globaladdress.address }}" @@ -176,14 +176,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a target HTTP proxy +- name: Delete a target HTTP proxy google.cloud.gcp_compute_target_http_proxy: name: targethttpproxy-globalforwardingrule url_map: "{{ urlmap }}" @@ -193,7 +193,7 @@ state: absent register: httpproxy ignore_errors: true -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_url_map: name: urlmap-globalforwardingrule default_service: "{{ backendservice }}" @@ -203,21 +203,21 @@ state: absent register: urlmap ignore_errors: true -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-globalforwardingrule backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-globalforwardingrule healthy_threshold: 10 @@ -230,7 +230,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-globalforwardingrule zone: us-central1-a @@ -240,7 +240,7 @@ state: absent register: instancegroup ignore_errors: true -- name: delete a global address +- name: Delete a global address google.cloud.gcp_compute_global_address: name: globaladdress-globalforwardingrule project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml b/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml index b4bc37404..d529ec687 100644 --- a/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a health check +- name: Delete a health check google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -29,7 +29,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a health check +- name: Create a health check google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -45,26 +45,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that health_check was created +- name: Verify that health_check was created google.cloud.gcp_compute_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a health check that already exists +- name: Create a health check that already exists google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -80,12 +80,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a health check +- name: Delete a health check google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -101,26 +101,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that health_check was deleted +- name: Verify that health_check was deleted google.cloud.gcp_compute_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a health check that does not exist +- name: Delete a health check that does not exist google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -136,7 +136,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_health_check/tasks/main.yml b/tests/integration/targets/gcp_compute_health_check/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_health_check/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_health_check/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml index 5f25a06dc..1ff3b89da 100644 --- a/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -25,7 +25,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -37,26 +37,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that http_health_check was created +- name: Verify that http_health_check was created google.cloud.gcp_compute_http_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a HTTP health check that already exists +- name: Create a HTTP health check that already exists google.cloud.gcp_compute_http_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -68,12 +68,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -85,26 +85,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that http_health_check was deleted +- name: Verify that http_health_check was deleted google.cloud.gcp_compute_http_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a HTTP health check that does not exist +- name: Delete a HTTP health check that does not exist google.cloud.gcp_compute_http_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -116,7 +116,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_http_health_check/tasks/main.yml b/tests/integration/targets/gcp_compute_http_health_check/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_http_health_check/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_http_health_check/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml index ebb89d61a..c79968c03 100644 --- a/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a HTTPS health check +- name: Delete a HTTPS health check google.cloud.gcp_compute_https_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -25,7 +25,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a HTTPS health check +- name: Create a HTTPS health check google.cloud.gcp_compute_https_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -37,26 +37,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that https_health_check was created +- name: Verify that https_health_check was created google.cloud.gcp_compute_https_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a HTTPS health check that already exists +- name: Create a HTTPS health check that already exists google.cloud.gcp_compute_https_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -68,12 +68,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a HTTPS health check +- name: Delete a HTTPS health check google.cloud.gcp_compute_https_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -85,26 +85,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that https_health_check was deleted +- name: Verify that https_health_check was deleted google.cloud.gcp_compute_https_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a HTTPS health check that does not exist +- name: Delete a HTTPS health check that does not exist google.cloud.gcp_compute_https_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -116,7 +116,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_https_health_check/tasks/main.yml b/tests/integration/targets/gcp_compute_https_health_check/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_https_health_check/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_https_health_check/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_image/tasks/autogen.yml b/tests/integration/targets/gcp_compute_image/tasks/autogen.yml index 89c5fef4d..e44f01021 100644 --- a/tests/integration/targets/gcp_compute_image/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_image/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a disk +- name: Create a disk google.cloud.gcp_compute_disk: name: disk-image zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk -- name: delete a image +- name: Delete a image google.cloud.gcp_compute_image: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -31,7 +31,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a image +- name: Create a image google.cloud.gcp_compute_image: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -40,26 +40,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that image was created +- name: Verify that image was created google.cloud.gcp_compute_image_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a image that already exists +- name: Create a image that already exists google.cloud.gcp_compute_image: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -68,12 +68,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a image +- name: Delete a image google.cloud.gcp_compute_image: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -82,26 +82,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that image was deleted +- name: Verify that image was deleted google.cloud.gcp_compute_image_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a image that does not exist +- name: Delete a image that does not exist google.cloud.gcp_compute_image: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -110,14 +110,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: disk-image zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_image/tasks/main.yml b/tests/integration/targets/gcp_compute_image/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_image/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_image/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml index 02d95cc97..fbec1e16d 100644 --- a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a disk +- name: Create a disk google.cloud.gcp_compute_disk: name: "{{ resource_prefix }}" size_gb: 50 @@ -24,7 +24,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: "{{ resource_prefix }}" project: "{{ gcp_project }}" @@ -33,7 +33,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instance region: us-central1 @@ -42,204 +42,204 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: delete a instance +- name: Delete a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_compute_instance_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_compute_instance_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instance region: us-central1 @@ -249,7 +249,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: "{{ resource_prefix }}" project: "{{ gcp_project }}" @@ -259,7 +259,7 @@ state: absent register: network ignore_errors: true -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: "{{ resource_prefix }}" size_gb: 50 diff --git a/tests/integration/targets/gcp_compute_instance/tasks/main.yml b/tests/integration/targets/gcp_compute_instance/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml index c13b4a5e9..340c8ca0c 100644 --- a/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancegroup project: "{{ gcp_project }}" @@ -22,12 +22,12 @@ auto_create_subnetworks: true state: present register: network -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: "{{ resource_name }}" named_ports: - - name: ansible - port: 1234 + - name: ansible + port: 1234 network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -35,12 +35,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: "{{ resource_name }}" named_ports: - - name: ansible - port: 1234 + - name: ansible + port: 1234 network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -48,32 +48,32 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_group was created +- name: Verify that instance_group was created google.cloud.gcp_compute_instance_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance group that already exists +- name: Create a instance group that already exists google.cloud.gcp_compute_instance_group: name: "{{ resource_name }}" named_ports: - - name: ansible - port: 1234 + - name: ansible + port: 1234 network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -81,17 +81,17 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: "{{ resource_name }}" named_ports: - - name: ansible - port: 1234 + - name: ansible + port: 1234 network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -99,32 +99,32 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_group was deleted +- name: Verify that instance_group was deleted google.cloud.gcp_compute_instance_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance group that does not exist +- name: Delete a instance group that does not exist google.cloud.gcp_compute_instance_group: name: "{{ resource_name }}" named_ports: - - name: ansible - port: 1234 + - name: ansible + port: 1234 network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -132,14 +132,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancegroup project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_instance_group/tasks/main.yml b/tests/integration/targets/gcp_compute_instance_group/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_instance_group/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_instance_group/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml index be3c227a1..a60441e21 100644 --- a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-west1 @@ -31,28 +31,28 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a instance template +- name: Create a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate -- name: delete a instance group manager +- name: Delete a instance group manager google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -64,7 +64,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance group manager +- name: Create a instance group manager google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -76,27 +76,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_group_manager was created +- name: Verify that instance_group_manager was created google.cloud.gcp_compute_instance_group_manager_info: - filters: - - name = {{ resource_name }} - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance group manager that already exists +- name: Create a instance group manager that already exists google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -108,12 +108,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance group manager +- name: Delete a instance group manager google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -125,27 +125,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_group_manager was deleted +- name: Verify that instance_group_manager was deleted google.cloud.gcp_compute_instance_group_manager_info: - filters: - - name = {{ resource_name }} - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance group manager that does not exist +- name: Delete a instance group manager that does not exist google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -157,36 +157,36 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-west1 @@ -196,7 +196,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml index 6cb8d64f0..72fb80983 100644 --- a/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-west1 @@ -31,162 +31,162 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance template +- name: Create a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_template was created +- name: Verify that instance_template was created google.cloud.gcp_compute_instance_template_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance template that already exists +- name: Create a instance template that already exists google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_template was deleted +- name: Verify that instance_template was deleted google.cloud.gcp_compute_instance_template_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance template that does not exist +- name: Delete a instance template that does not exist google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-west1 @@ -196,7 +196,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_instance_template/tasks/main.yml b/tests/integration/targets/gcp_compute_instance_template/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_instance_template/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_instance_template/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml b/tests/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml index aa87a2a8e..aa65c31f5 100644 --- a/tests/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml +++ b/tests/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml @@ -1,3 +1,3 @@ --- # defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/tests/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml b/tests/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml index aa87a2a8e..aa65c31f5 100644 --- a/tests/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml +++ b/tests/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml @@ -1,3 +1,3 @@ --- # defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/tests/integration/targets/gcp_compute_network/tasks/autogen.yml b/tests/integration/targets/gcp_compute_network/tasks/autogen.yml index 9219386f5..b887e2b17 100644 --- a/tests/integration/targets/gcp_compute_network/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_network/tasks/autogen.yml @@ -13,95 +13,95 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that network was created +- name: Verify that network was created google.cloud.gcp_compute_network_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a network that already exists +- name: Create a network that already exists google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that network was deleted +- name: Verify that network was deleted google.cloud.gcp_compute_network_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a network that does not exist +- name: Delete a network that does not exist google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_network/tasks/main.yml b/tests/integration/targets/gcp_compute_network/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_network/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_network/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml b/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml index a613f09ef..81f46d271 100644 --- a/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml @@ -13,16 +13,16 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'false' + auto_create_subnetworks: "false" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: network -- name: create a subnetwork +- name: Create a subnetwork google.cloud.gcp_compute_subnetwork: name: "{{ resource_name }}" ip_cidr_range: 10.0.0.0/16 @@ -33,7 +33,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: subnetwork -- name: delete a network endpoint group +- name: Delete a network endpoint group google.cloud.gcp_compute_network_endpoint_group: name: "{{ resource_name }}" network: "{{ network }}" @@ -45,7 +45,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a network endpoint group +- name: Create a network endpoint group google.cloud.gcp_compute_network_endpoint_group: name: "{{ resource_name }}" network: "{{ network }}" @@ -57,27 +57,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that network_endpoint_group was created +- name: Verify that network_endpoint_group was created google.cloud.gcp_compute_network_endpoint_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a network endpoint group that already exists +- name: Create a network endpoint group that already exists google.cloud.gcp_compute_network_endpoint_group: name: "{{ resource_name }}" network: "{{ network }}" @@ -89,12 +89,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a network endpoint group +- name: Delete a network endpoint group google.cloud.gcp_compute_network_endpoint_group: name: "{{ resource_name }}" network: "{{ network }}" @@ -106,27 +106,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that network_endpoint_group was deleted +- name: Verify that network_endpoint_group was deleted google.cloud.gcp_compute_network_endpoint_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a network endpoint group that does not exist +- name: Delete a network endpoint group that does not exist google.cloud.gcp_compute_network_endpoint_group: name: "{{ resource_name }}" network: "{{ network }}" @@ -138,14 +138,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a subnetwork +- name: Delete a subnetwork google.cloud.gcp_compute_subnetwork: name: "{{ resource_name }}" ip_cidr_range: 10.0.0.0/16 @@ -157,10 +157,10 @@ state: absent register: subnetwork ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'false' + auto_create_subnetworks: "false" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" diff --git a/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/main.yml b/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml b/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml index 4b55d9706..25d46afa3 100644 --- a/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a node template +- name: Create a node template google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: node_template -- name: delete a node group +- name: Delete a node group google.cloud.gcp_compute_node_group: name: "{{ resource_name }}" zone: us-central1-a @@ -35,7 +35,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a node group +- name: Create a node group google.cloud.gcp_compute_node_group: name: "{{ resource_name }}" zone: us-central1-a @@ -47,27 +47,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_group was created +- name: Verify that node_group was created google.cloud.gcp_compute_node_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a node group that already exists +- name: Create a node group that already exists google.cloud.gcp_compute_node_group: name: "{{ resource_name }}" zone: us-central1-a @@ -79,12 +79,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a node group +- name: Delete a node group google.cloud.gcp_compute_node_group: name: "{{ resource_name }}" zone: us-central1-a @@ -96,27 +96,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_group was deleted +- name: Verify that node_group was deleted google.cloud.gcp_compute_node_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a node group that does not exist +- name: Delete a node group that does not exist google.cloud.gcp_compute_node_group: name: "{{ resource_name }}" zone: us-central1-a @@ -128,14 +128,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a node template +- name: Delete a node template google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 diff --git a/tests/integration/targets/gcp_compute_node_group/tasks/main.yml b/tests/integration/targets/gcp_compute_node_group/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_node_group/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_node_group/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml b/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml index 8297027fb..f21ce6366 100644 --- a/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a node template +- name: Delete a node template google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a node template +- name: Create a node template google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -33,27 +33,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_template was created +- name: Verify that node_template was created google.cloud.gcp_compute_node_template_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a node template that already exists +- name: Create a node template that already exists google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -63,12 +63,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a node template +- name: Delete a node template google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -78,27 +78,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_template was deleted +- name: Verify that node_template was deleted google.cloud.gcp_compute_node_template_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a node template that does not exist +- name: Delete a node template that does not exist google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -108,7 +108,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_node_template/tasks/main.yml b/tests/integration/targets/gcp_compute_node_template/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_node_template/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_node_template/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml index 933c110b8..5a986a9f8 100644 --- a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -31,28 +31,28 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a instance template +- name: Create a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate -- name: create a region instance group manager +- name: Create a region instance group manager google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -64,7 +64,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: igrm -- name: delete a region autoscaler +- name: Delete a region autoscaler google.cloud.gcp_compute_region_autoscaler: name: my-region-autoscaler region: us-central1 @@ -73,14 +73,14 @@ max_num_replicas: 5 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 - target: "{{igrm.selfLink}}" + utilization_target: !!float "0.5" + target: "{{ igrm.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region autoscaler +- name: Create a region autoscaler google.cloud.gcp_compute_region_autoscaler: name: my-region-autoscaler region: us-central1 @@ -89,34 +89,34 @@ max_num_replicas: 5 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 - target: "{{igrm.selfLink}}" + utilization_target: !!float "0.5" + target: "{{ igrm.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_autoscaler was created +- name: Verify that region_autoscaler was created google.cloud.gcp_compute_region_autoscaler_info: - filters: - - name = my-region-autoscaler - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = my-region-autoscaler + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region autoscaler that already exists +- name: Create a region autoscaler that already exists google.cloud.gcp_compute_region_autoscaler: name: my-region-autoscaler region: us-central1 @@ -125,19 +125,19 @@ max_num_replicas: 5 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 - target: "{{igrm.selfLink}}" + utilization_target: !!float "0.5" + target: "{{ igrm.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region autoscaler +- name: Delete a region autoscaler google.cloud.gcp_compute_region_autoscaler: name: my-region-autoscaler region: us-central1 @@ -146,34 +146,34 @@ max_num_replicas: 5 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 - target: "{{igrm.selfLink}}" + utilization_target: !!float "0.5" + target: "{{ igrm.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_autoscaler was deleted +- name: Verify that region_autoscaler was deleted google.cloud.gcp_compute_region_autoscaler_info: - filters: - - name = my-region-autoscaler - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = my-region-autoscaler + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region autoscaler that does not exist +- name: Delete a region autoscaler that does not exist google.cloud.gcp_compute_region_autoscaler: name: my-region-autoscaler region: us-central1 @@ -182,21 +182,21 @@ max_num_replicas: 5 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 - target: "{{igrm.selfLink}}" + utilization_target: !!float "0.5" + target: "{{ igrm.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a region instance group manager +- name: Delete a region instance group manager google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -209,29 +209,29 @@ state: absent register: igrm ignore_errors: true -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -241,7 +241,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/main.yml b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml index cd3e21ebd..beb644a7b 100644 --- a/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a health check +- name: Create a health check google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -26,12 +26,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: delete a region backend service +- name: Delete a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" connection_draining: draining_timeout_sec: 10 session_affinity: CLIENT_IP @@ -40,12 +40,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region backend service +- name: Create a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" connection_draining: draining_timeout_sec: 10 session_affinity: CLIENT_IP @@ -54,32 +54,32 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_backend_service was created +- name: Verify that region_backend_service was created google.cloud.gcp_compute_region_backend_service_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region backend service that already exists +- name: Create a region backend service that already exists google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" connection_draining: draining_timeout_sec: 10 session_affinity: CLIENT_IP @@ -88,17 +88,17 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region backend service +- name: Delete a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" connection_draining: draining_timeout_sec: 10 session_affinity: CLIENT_IP @@ -107,32 +107,32 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_backend_service was deleted +- name: Verify that region_backend_service was deleted google.cloud.gcp_compute_region_backend_service_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region backend service that does not exist +- name: Delete a region backend service that does not exist google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" connection_draining: draining_timeout_sec: 10 session_affinity: CLIENT_IP @@ -141,14 +141,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a health check +- name: Delete a health check google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP diff --git a/tests/integration/targets/gcp_compute_region_backend_service/tasks/main.yml b/tests/integration/targets/gcp_compute_region_backend_service/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_region_backend_service/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_backend_service/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml index 8e30419ff..1b04a50d8 100644 --- a/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a region disk +- name: Delete a region disk google.cloud.gcp_compute_region_disk: name: "{{ resource_name }}" size_gb: 500 @@ -21,14 +21,14 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region disk +- name: Create a region disk google.cloud.gcp_compute_region_disk: name: "{{ resource_name }}" size_gb: 500 @@ -36,34 +36,34 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_disk was created +- name: Verify that region_disk was created google.cloud.gcp_compute_region_disk_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region disk that already exists +- name: Create a region disk that already exists google.cloud.gcp_compute_region_disk: name: "{{ resource_name }}" size_gb: 500 @@ -71,19 +71,19 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region disk +- name: Delete a region disk google.cloud.gcp_compute_region_disk: name: "{{ resource_name }}" size_gb: 500 @@ -91,34 +91,34 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_disk was deleted +- name: Verify that region_disk was deleted google.cloud.gcp_compute_region_disk_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region disk that does not exist +- name: Delete a region disk that does not exist google.cloud.gcp_compute_region_disk: name: "{{ resource_name }}" size_gb: 500 @@ -126,14 +126,14 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_region_disk/tasks/main.yml b/tests/integration/targets/gcp_compute_region_disk/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_region_disk/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_disk/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml index 268eda112..badcfb842 100644 --- a/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a region health check +- name: Delete a region health check google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: TCP @@ -30,7 +30,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region health check +- name: Create a region health check google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: TCP @@ -47,27 +47,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_health_check was created +- name: Verify that region_health_check was created google.cloud.gcp_compute_region_health_check_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region health check that already exists +- name: Create a region health check that already exists google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: TCP @@ -84,12 +84,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region health check +- name: Delete a region health check google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: TCP @@ -106,27 +106,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_health_check was deleted +- name: Verify that region_health_check was deleted google.cloud.gcp_compute_region_health_check_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region health check that does not exist +- name: Delete a region health check that does not exist google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: TCP @@ -143,7 +143,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_region_health_check/tasks/main.yml b/tests/integration/targets/gcp_compute_region_health_check/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_region_health_check/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_health_check/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml index 1a8b07a95..e60646420 100644 --- a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -31,28 +31,28 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a instance template +- name: Create a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate -- name: delete a region instance group manager +- name: Delete a region instance group manager google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -64,7 +64,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region instance group manager +- name: Create a region instance group manager google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -76,27 +76,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_instance_group_manager was created +- name: Verify that region_instance_group_manager was created google.cloud.gcp_compute_region_instance_group_manager_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region instance group manager that already exists +- name: Create a region instance group manager that already exists google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -108,12 +108,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region instance group manager +- name: Delete a region instance group manager google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -125,27 +125,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_instance_group_manager was deleted +- name: Verify that region_instance_group_manager was deleted google.cloud.gcp_compute_region_instance_group_manager_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region instance group manager that does not exist +- name: Delete a region instance group manager that does not exist google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -157,36 +157,36 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -196,7 +196,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/main.yml b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml index 88ff1e4c9..9c1da53dc 100644 --- a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml @@ -13,19 +13,19 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpproxy region: us-central1 - enable_cdn: 'true' + enable_cdn: "true" protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - load_balancing_scheme: "EXTERNAL" + load_balancing_scheme: EXTERNAL state: present register: backendservice -- name: create a URL map +- name: Create a URL map google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpproxy region: us-central1 @@ -35,7 +35,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap -- name: delete a region target HTTP proxy +- name: Delete a region target HTTP proxy google.cloud.gcp_compute_region_target_http_proxy: name: "{{ resource_name }}" region: us-central1 @@ -45,7 +45,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region target HTTP proxy +- name: Create a region target HTTP proxy google.cloud.gcp_compute_region_target_http_proxy: name: "{{ resource_name }}" region: us-central1 @@ -55,27 +55,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_target_http_proxy was created +- name: Verify that region_target_http_proxy was created google.cloud.gcp_compute_region_target_http_proxy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region target HTTP proxy that already exists +- name: Create a region target HTTP proxy that already exists google.cloud.gcp_compute_region_target_http_proxy: name: "{{ resource_name }}" region: us-central1 @@ -85,12 +85,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region target HTTP proxy +- name: Delete a region target HTTP proxy google.cloud.gcp_compute_region_target_http_proxy: name: "{{ resource_name }}" region: us-central1 @@ -100,27 +100,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_target_http_proxy was deleted +- name: Verify that region_target_http_proxy was deleted google.cloud.gcp_compute_region_target_http_proxy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region target HTTP proxy that does not exist +- name: Delete a region target HTTP proxy that does not exist google.cloud.gcp_compute_region_target_http_proxy: name: "{{ resource_name }}" region: us-central1 @@ -130,14 +130,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpproxy region: us-central1 @@ -146,16 +146,16 @@ auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent - ignore_errors: true -- name: delete a backend service + ignore_errors: true # noqa: ignore-errors +- name: Delete a backend service google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpproxy region: us-central1 - enable_cdn: 'true' + enable_cdn: "true" protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - load_balancing_scheme: "EXTERNAL" + load_balancing_scheme: EXTERNAL state: present - ignore_errors: true \ No newline at end of file + ignore_errors: true # noqa: ignore-errors diff --git a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml index 89e91e40a..ac02c562a 100644 --- a/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpsproxy zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a region health check +- name: Create a region health check google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: HTTPS @@ -35,20 +35,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a region backend service +- name: Create a region backend service google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpsproxy region: us-central1 backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" healthchecks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: create a region URL map +- name: Create a region URL map google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpsproxy region: us-central1 @@ -58,7 +58,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap -- name: create a SSL certificate +- name: Create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targethttpsproxy description: A certificate for testing. Do not use this certificate in production @@ -91,119 +91,119 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: sslcert -- name: delete a region target HTTPS proxy +- name: Delete a region target HTTPS proxy google.cloud.gcp_compute_region_target_https_proxy: name: "{{ resource_name }}" region: us-central1 ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region target HTTPS proxy +- name: Create a region target HTTPS proxy google.cloud.gcp_compute_region_target_https_proxy: name: "{{ resource_name }}" region: us-central1 ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_target_https_proxy was created +- name: Verify that region_target_https_proxy was created google.cloud.gcp_compute_region_target_https_proxy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region target HTTPS proxy that already exists +- name: Create a region target HTTPS proxy that already exists google.cloud.gcp_compute_region_target_https_proxy: name: "{{ resource_name }}" region: us-central1 ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region target HTTPS proxy +- name: Delete a region target HTTPS proxy google.cloud.gcp_compute_region_target_https_proxy: name: "{{ resource_name }}" region: us-central1 ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_target_https_proxy was deleted +- name: Verify that region_target_https_proxy was deleted google.cloud.gcp_compute_region_target_https_proxy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region target HTTPS proxy that does not exist +- name: Delete a region target HTTPS proxy that does not exist google.cloud.gcp_compute_region_target_https_proxy: name: "{{ resource_name }}" region: us-central1 ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a SSL certificate +- name: Delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targethttpsproxy description: A certificate for testing. Do not use this certificate in production @@ -237,7 +237,7 @@ state: absent register: sslcert ignore_errors: true -- name: delete a region URL map +- name: Delete a region URL map google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpsproxy region: us-central1 @@ -248,21 +248,21 @@ state: absent register: urlmap ignore_errors: true -- name: delete a region backend service +- name: Delete a region backend service google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpsproxy region: us-central1 backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" healthchecks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true -- name: delete a region health check +- name: Delete a region health check google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: HTTPS @@ -276,7 +276,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpsproxy zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml index 06ccec0db..1cbfae962 100644 --- a/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a region backend service +- name: Create a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 @@ -21,10 +21,10 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - load_balancing_scheme: "EXTERNAL" + load_balancing_scheme: EXTERNAL state: present register: backendservice -- name: delete a region URL map +- name: Delete a region URL map google.cloud.gcp_compute_region_url_map: name: "{{ resource_name }}" region: us-central1 @@ -34,7 +34,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region URL map +- name: Create a region URL map google.cloud.gcp_compute_region_url_map: name: "{{ resource_name }}" region: us-central1 @@ -44,27 +44,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_url_map was created +- name: Verify that region_url_map was created google.cloud.gcp_compute_region_url_map_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region URL map that already exists +- name: Create a region URL map that already exists google.cloud.gcp_compute_region_url_map: name: "{{ resource_name }}" region: us-central1 @@ -74,12 +74,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region URL map +- name: Delete a region URL map google.cloud.gcp_compute_region_url_map: name: "{{ resource_name }}" region: us-central1 @@ -89,27 +89,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_url_map was deleted +- name: Verify that region_url_map was deleted google.cloud.gcp_compute_region_url_map_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region URL map that does not exist +- name: Delete a region URL map that does not exist google.cloud.gcp_compute_region_url_map: name: "{{ resource_name }}" region: us-central1 @@ -119,14 +119,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a region backend service +- name: Delete a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 @@ -134,7 +134,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - load_balancing_scheme: "EXTERNAL" + load_balancing_scheme: EXTERNAL state: absent register: backendservice - ignore_errors: true \ No newline at end of file + ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_region_url_map/tasks/main.yml b/tests/integration/targets/gcp_compute_region_url_map/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_region_url_map/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_url_map/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml b/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml index 145f37831..7663bf5bc 100644 --- a/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a reservation +- name: Delete a reservation google.cloud.gcp_compute_reservation: name: "{{ resource_name }}" zone: us-central1-a @@ -27,7 +27,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a reservation +- name: Create a reservation google.cloud.gcp_compute_reservation: name: "{{ resource_name }}" zone: us-central1-a @@ -41,27 +41,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that reservation was created +- name: Verify that reservation was created google.cloud.gcp_compute_reservation_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a reservation that already exists +- name: Create a reservation that already exists google.cloud.gcp_compute_reservation: name: "{{ resource_name }}" zone: us-central1-a @@ -75,12 +75,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a reservation +- name: Delete a reservation google.cloud.gcp_compute_reservation: name: "{{ resource_name }}" zone: us-central1-a @@ -94,27 +94,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that reservation was deleted +- name: Verify that reservation was deleted google.cloud.gcp_compute_reservation_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a reservation that does not exist +- name: Delete a reservation that does not exist google.cloud.gcp_compute_reservation: name: "{{ resource_name }}" zone: us-central1-a @@ -128,7 +128,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_reservation/tasks/main.yml b/tests/integration/targets/gcp_compute_reservation/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_reservation/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_reservation/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml index 161e7a88b..86647db0a 100644 --- a/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a resource policy +- name: Delete a resource policy google.cloud.gcp_compute_resource_policy: name: "{{ resource_name }}" region: us-central1 @@ -21,13 +21,13 @@ schedule: daily_schedule: days_in_cycle: 1 - start_time: '04:00' + start_time: "04:00" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a resource policy +- name: Create a resource policy google.cloud.gcp_compute_resource_policy: name: "{{ resource_name }}" region: us-central1 @@ -35,33 +35,33 @@ schedule: daily_schedule: days_in_cycle: 1 - start_time: '04:00' + start_time: "04:00" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that resource_policy was created +- name: Verify that resource_policy was created google.cloud.gcp_compute_resource_policy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a resource policy that already exists +- name: Create a resource policy that already exists google.cloud.gcp_compute_resource_policy: name: "{{ resource_name }}" region: us-central1 @@ -69,18 +69,18 @@ schedule: daily_schedule: days_in_cycle: 1 - start_time: '04:00' + start_time: "04:00" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a resource policy +- name: Delete a resource policy google.cloud.gcp_compute_resource_policy: name: "{{ resource_name }}" region: us-central1 @@ -88,33 +88,33 @@ schedule: daily_schedule: days_in_cycle: 1 - start_time: '04:00' + start_time: "04:00" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that resource_policy was deleted +- name: Verify that resource_policy was deleted google.cloud.gcp_compute_resource_policy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a resource policy that does not exist +- name: Delete a resource policy that does not exist google.cloud.gcp_compute_resource_policy: name: "{{ resource_name }}" region: us-central1 @@ -122,13 +122,13 @@ schedule: daily_schedule: days_in_cycle: 1 - start_time: '04:00' + start_time: "04:00" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_resource_policy/tasks/main.yml b/tests/integration/targets/gcp_compute_resource_policy/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_resource_policy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_resource_policy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_route/tasks/autogen.yml b/tests/integration/targets/gcp_compute_route/tasks/autogen.yml index aab6cd944..347c503c4 100644 --- a/tests/integration/targets/gcp_compute_route/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_route/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-route project: "{{ gcp_project }}" @@ -22,146 +22,146 @@ auto_create_subnetworks: true state: present register: network -- name: delete a route +- name: Delete a route google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/24 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - databases + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a route +- name: Create a route google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/24 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - databases + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that route was created +- name: Verify that route was created google.cloud.gcp_compute_route_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a route that already exists +- name: Create a route that already exists google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/24 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - databases + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false # --- -- name: update a route +- name: Update a route google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/28 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - foobar + - backends + - foobar project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true #---------------------------------------------------------- -- name: delete a route +- name: Delete a route google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/24 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - databases + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that route was deleted +- name: Verify that route was deleted google.cloud.gcp_compute_route_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a route that does not exist +- name: Delete a route that does not exist google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/24 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - databases + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-route project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_route/tasks/main.yml b/tests/integration/targets/gcp_compute_route/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_route/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_route/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_router/tasks/autogen.yml b/tests/integration/targets/gcp_compute_router/tasks/autogen.yml index 6003e7854..07acc6937 100644 --- a/tests/integration/targets/gcp_compute_router/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_router/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-router project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: delete a router +- name: Delete a router google.cloud.gcp_compute_router: name: "{{ resource_name }}" network: "{{ network }}" @@ -30,17 +30,17 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a router +- name: Create a router google.cloud.gcp_compute_router: name: "{{ resource_name }}" network: "{{ network }}" @@ -48,37 +48,37 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that router was created +- name: Verify that router was created google.cloud.gcp_compute_router_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a router that already exists +- name: Create a router that already exists google.cloud.gcp_compute_router: name: "{{ resource_name }}" network: "{{ network }}" @@ -86,22 +86,22 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a router +- name: Delete a router google.cloud.gcp_compute_router: name: "{{ resource_name }}" network: "{{ network }}" @@ -109,37 +109,37 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that router was deleted +- name: Verify that router was deleted google.cloud.gcp_compute_router_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a router that does not exist +- name: Delete a router that does not exist google.cloud.gcp_compute_router: name: "{{ resource_name }}" network: "{{ network }}" @@ -147,24 +147,24 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-router project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_router/tasks/main.yml b/tests/integration/targets/gcp_compute_router/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_router/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_router/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml b/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml index ffbdb2418..435284e08 100644 --- a/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a disk +- name: Create a disk google.cloud.gcp_compute_disk: name: disk-snapshot zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk -- name: delete a snapshot +- name: Delete a snapshot google.cloud.gcp_compute_snapshot: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -34,7 +34,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a snapshot +- name: Create a snapshot google.cloud.gcp_compute_snapshot: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -46,26 +46,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that snapshot was created +- name: Verify that snapshot was created google.cloud.gcp_compute_snapshot_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a snapshot that already exists +- name: Create a snapshot that already exists google.cloud.gcp_compute_snapshot: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -77,12 +77,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a snapshot +- name: Delete a snapshot google.cloud.gcp_compute_snapshot: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -94,26 +94,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that snapshot was deleted +- name: Verify that snapshot was deleted google.cloud.gcp_compute_snapshot_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a snapshot that does not exist +- name: Delete a snapshot that does not exist google.cloud.gcp_compute_snapshot: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -125,14 +125,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: disk-snapshot zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_snapshot/tasks/main.yml b/tests/integration/targets/gcp_compute_snapshot/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_snapshot/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_snapshot/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml index 871715c1d..9d36683db 100644 --- a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a SSL certificate +- name: Delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production @@ -46,7 +46,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a SSL certificate +- name: Create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production @@ -79,26 +79,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that ssl_certificate was created +- name: Verify that ssl_certificate was created google.cloud.gcp_compute_ssl_certificate_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a SSL certificate that already exists +- name: Create a SSL certificate that already exists google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production @@ -131,12 +131,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a SSL certificate +- name: Delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production @@ -169,26 +169,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that ssl_certificate was deleted +- name: Verify that ssl_certificate was deleted google.cloud.gcp_compute_ssl_certificate_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a SSL certificate that does not exist +- name: Delete a SSL certificate that does not exist google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production @@ -221,7 +221,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml index 551af9aea..adbba9f34 100644 --- a/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml @@ -13,115 +13,115 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a SSL policy +- name: Delete a SSL policy google.cloud.gcp_compute_ssl_policy: name: "{{ resource_name }}" profile: CUSTOM min_tls_version: TLS_1_2 custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a SSL policy +- name: Create a SSL policy google.cloud.gcp_compute_ssl_policy: name: "{{ resource_name }}" profile: CUSTOM min_tls_version: TLS_1_2 custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that ssl_policy was created +- name: Verify that ssl_policy was created google.cloud.gcp_compute_ssl_policy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a SSL policy that already exists +- name: Create a SSL policy that already exists google.cloud.gcp_compute_ssl_policy: name: "{{ resource_name }}" profile: CUSTOM min_tls_version: TLS_1_2 custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a SSL policy +- name: Delete a SSL policy google.cloud.gcp_compute_ssl_policy: name: "{{ resource_name }}" profile: CUSTOM min_tls_version: TLS_1_2 custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that ssl_policy was deleted +- name: Verify that ssl_policy was deleted google.cloud.gcp_compute_ssl_policy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a SSL policy that does not exist +- name: Delete a SSL policy that does not exist google.cloud.gcp_compute_ssl_policy: name: "{{ resource_name }}" profile: CUSTOM min_tls_version: TLS_1_2 custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_ssl_policy/tasks/main.yml b/tests/integration/targets/gcp_compute_ssl_policy/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_ssl_policy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_ssl_policy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml b/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml index 74917a3ec..6849ccac7 100644 --- a/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml @@ -13,16 +13,16 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-subnetwork - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: network -- name: delete a subnetwork +- name: Delete a subnetwork google.cloud.gcp_compute_subnetwork: name: ansiblenet region: us-west1 @@ -33,7 +33,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a subnetwork +- name: Create a subnetwork google.cloud.gcp_compute_subnetwork: name: ansiblenet region: us-west1 @@ -44,27 +44,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that subnetwork was created +- name: Verify that subnetwork was created google.cloud.gcp_compute_subnetwork_info: - filters: - - name = ansiblenet - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = ansiblenet + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a subnetwork that already exists +- name: Create a subnetwork that already exists google.cloud.gcp_compute_subnetwork: name: ansiblenet region: us-west1 @@ -75,12 +75,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a subnetwork +- name: Delete a subnetwork google.cloud.gcp_compute_subnetwork: name: ansiblenet region: us-west1 @@ -91,27 +91,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that subnetwork was deleted +- name: Verify that subnetwork was deleted google.cloud.gcp_compute_subnetwork_info: - filters: - - name = ansiblenet - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = ansiblenet + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a subnetwork that does not exist +- name: Delete a subnetwork that does not exist google.cloud.gcp_compute_subnetwork: name: ansiblenet region: us-west1 @@ -122,17 +122,17 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-subnetwork - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" diff --git a/tests/integration/targets/gcp_compute_subnetwork/tasks/main.yml b/tests/integration/targets/gcp_compute_subnetwork/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_subnetwork/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_subnetwork/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml index a64c03a39..1c48c9db7 100644 --- a/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpproxy zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-targethttpproxy healthy_threshold: 10 @@ -34,20 +34,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targethttpproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: create a URL map +- name: Create a URL map google.cloud.gcp_compute_url_map: name: urlmap-targethttpproxy default_service: "{{ backendservice }}" @@ -56,7 +56,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap -- name: delete a target HTTP proxy +- name: Delete a target HTTP proxy google.cloud.gcp_compute_target_http_proxy: name: "{{ resource_name }}" url_map: "{{ urlmap }}" @@ -65,7 +65,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target HTTP proxy +- name: Create a target HTTP proxy google.cloud.gcp_compute_target_http_proxy: name: "{{ resource_name }}" url_map: "{{ urlmap }}" @@ -74,26 +74,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_http_proxy was created +- name: Verify that target_http_proxy was created google.cloud.gcp_compute_target_http_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target HTTP proxy that already exists +- name: Create a target HTTP proxy that already exists google.cloud.gcp_compute_target_http_proxy: name: "{{ resource_name }}" url_map: "{{ urlmap }}" @@ -102,12 +102,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target HTTP proxy +- name: Delete a target HTTP proxy google.cloud.gcp_compute_target_http_proxy: name: "{{ resource_name }}" url_map: "{{ urlmap }}" @@ -116,26 +116,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_http_proxy was deleted +- name: Verify that target_http_proxy was deleted google.cloud.gcp_compute_target_http_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target HTTP proxy that does not exist +- name: Delete a target HTTP proxy that does not exist google.cloud.gcp_compute_target_http_proxy: name: "{{ resource_name }}" url_map: "{{ urlmap }}" @@ -144,14 +144,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_url_map: name: urlmap-targethttpproxy default_service: "{{ backendservice }}" @@ -161,21 +161,21 @@ state: absent register: urlmap ignore_errors: true -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targethttpproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-targethttpproxy healthy_threshold: 10 @@ -188,7 +188,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpproxy zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml index 62500b43d..5731d0870 100644 --- a/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpsproxy zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-targethttpsproxy healthy_threshold: 10 @@ -34,20 +34,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targethttpsproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: create a URL map +- name: Create a URL map google.cloud.gcp_compute_url_map: name: urlmap-targethttpsproxy default_service: "{{ backendservice }}" @@ -56,7 +56,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap -- name: create a SSL certificate +- name: Create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targethttpsproxy description: A certificate for testing. Do not use this certificate in production @@ -89,112 +89,112 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: sslcert -- name: delete a target HTTPS proxy +- name: Delete a target HTTPS proxy google.cloud.gcp_compute_target_https_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target HTTPS proxy +- name: Create a target HTTPS proxy google.cloud.gcp_compute_target_https_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_https_proxy was created +- name: Verify that target_https_proxy was created google.cloud.gcp_compute_target_https_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target HTTPS proxy that already exists +- name: Create a target HTTPS proxy that already exists google.cloud.gcp_compute_target_https_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target HTTPS proxy +- name: Delete a target HTTPS proxy google.cloud.gcp_compute_target_https_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_https_proxy was deleted +- name: Verify that target_https_proxy was deleted google.cloud.gcp_compute_target_https_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target HTTPS proxy that does not exist +- name: Delete a target HTTPS proxy that does not exist google.cloud.gcp_compute_target_https_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a SSL certificate +- name: Delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targethttpsproxy description: A certificate for testing. Do not use this certificate in production @@ -228,7 +228,7 @@ state: absent register: sslcert ignore_errors: true -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_url_map: name: urlmap-targethttpsproxy default_service: "{{ backendservice }}" @@ -238,21 +238,21 @@ state: absent register: urlmap ignore_errors: true -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targethttpsproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-targethttpsproxy healthy_threshold: 10 @@ -265,7 +265,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpsproxy zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml index 6f55e0dd1..74a01f61b 100644 --- a/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instance project: "{{ gcp_project }}" @@ -22,26 +22,26 @@ auto_create_subnetworks: true state: present register: network -- name: create a instance +- name: Create a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts labels: environment: production network_interfaces: - - network: "{{ network }}" + - network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance -- name: delete a target instance +- name: Delete a target instance google.cloud.gcp_compute_target_instance: name: target instance: "{{ instance }}" @@ -51,7 +51,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target instance +- name: Create a target instance google.cloud.gcp_compute_target_instance: name: target instance: "{{ instance }}" @@ -61,27 +61,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_instance was created +- name: Verify that target_instance was created google.cloud.gcp_compute_target_instance_info: - filters: - - name = target - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = target + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target instance that already exists +- name: Create a target instance that already exists google.cloud.gcp_compute_target_instance: name: target instance: "{{ instance }}" @@ -91,12 +91,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target instance +- name: Delete a target instance google.cloud.gcp_compute_target_instance: name: target instance: "{{ instance }}" @@ -106,27 +106,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_instance was deleted +- name: Verify that target_instance was deleted google.cloud.gcp_compute_target_instance_info: - filters: - - name = target - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = target + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target instance that does not exist +- name: Delete a target instance that does not exist google.cloud.gcp_compute_target_instance: name: target instance: "{{ instance }}" @@ -136,26 +136,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance +- name: Delete a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts labels: environment: production network_interfaces: - - network: "{{ network }}" + - network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -163,7 +163,7 @@ state: absent register: instance ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instance project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_target_instance/tasks/main.yml b/tests/integration/targets/gcp_compute_target_instance/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_target_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml index 712ea705d..59a46d210 100644 --- a/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a target pool +- name: Delete a target pool google.cloud.gcp_compute_target_pool: name: "{{ resource_name }}" region: us-west1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target pool +- name: Create a target pool google.cloud.gcp_compute_target_pool: name: "{{ resource_name }}" region: us-west1 @@ -31,27 +31,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_pool was created +- name: Verify that target_pool was created google.cloud.gcp_compute_target_pool_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target pool that already exists +- name: Create a target pool that already exists google.cloud.gcp_compute_target_pool: name: "{{ resource_name }}" region: us-west1 @@ -60,12 +60,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target pool +- name: Delete a target pool google.cloud.gcp_compute_target_pool: name: "{{ resource_name }}" region: us-west1 @@ -74,27 +74,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_pool was deleted +- name: Verify that target_pool was deleted google.cloud.gcp_compute_target_pool_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target pool that does not exist +- name: Delete a target pool that does not exist google.cloud.gcp_compute_target_pool: name: "{{ resource_name }}" region: us-west1 @@ -103,7 +103,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_target_pool/tasks/main.yml b/tests/integration/targets/gcp_compute_target_pool/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_target_pool/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_pool/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml index fad23db6d..6142ec918 100644 --- a/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targetsslproxy zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a health check +- name: Create a health check google.cloud.gcp_compute_health_check: name: healthcheck-targetsslproxy type: TCP @@ -38,20 +38,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targetsslproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" protocol: SSL project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: create a SSL certificate +- name: Create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targetsslproxy description: A certificate for testing. Do not use this certificate in production @@ -84,112 +84,112 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: sslcert -- name: delete a target SSL proxy +- name: Delete a target SSL proxy google.cloud.gcp_compute_target_ssl_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target SSL proxy +- name: Create a target SSL proxy google.cloud.gcp_compute_target_ssl_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_ssl_proxy was created +- name: Verify that target_ssl_proxy was created google.cloud.gcp_compute_target_ssl_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target SSL proxy that already exists +- name: Create a target SSL proxy that already exists google.cloud.gcp_compute_target_ssl_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target SSL proxy +- name: Delete a target SSL proxy google.cloud.gcp_compute_target_ssl_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_ssl_proxy was deleted +- name: Verify that target_ssl_proxy was deleted google.cloud.gcp_compute_target_ssl_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target SSL proxy that does not exist +- name: Delete a target SSL proxy that does not exist google.cloud.gcp_compute_target_ssl_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a SSL certificate +- name: Delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targetsslproxy description: A certificate for testing. Do not use this certificate in production @@ -223,13 +223,13 @@ state: absent register: sslcert ignore_errors: true -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targetsslproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" protocol: SSL project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -237,7 +237,7 @@ state: absent register: backendservice ignore_errors: true -- name: delete a health check +- name: Delete a health check google.cloud.gcp_compute_health_check: name: healthcheck-targetsslproxy type: TCP @@ -254,7 +254,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targetsslproxy zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml index 47844d01d..82e3e5513 100644 --- a/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targettcpproxy zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a health check +- name: Create a health check google.cloud.gcp_compute_health_check: name: healthcheck-targettcpproxy type: TCP @@ -38,20 +38,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targettcpproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" protocol: TCP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: delete a target TCP proxy +- name: Delete a target TCP proxy google.cloud.gcp_compute_target_tcp_proxy: name: "{{ resource_name }}" proxy_header: PROXY_V1 @@ -61,7 +61,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target TCP proxy +- name: Create a target TCP proxy google.cloud.gcp_compute_target_tcp_proxy: name: "{{ resource_name }}" proxy_header: PROXY_V1 @@ -71,26 +71,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_tcp_proxy was created +- name: Verify that target_tcp_proxy was created google.cloud.gcp_compute_target_tcp_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target TCP proxy that already exists +- name: Create a target TCP proxy that already exists google.cloud.gcp_compute_target_tcp_proxy: name: "{{ resource_name }}" proxy_header: PROXY_V1 @@ -100,12 +100,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target TCP proxy +- name: Delete a target TCP proxy google.cloud.gcp_compute_target_tcp_proxy: name: "{{ resource_name }}" proxy_header: PROXY_V1 @@ -115,26 +115,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_tcp_proxy was deleted +- name: Verify that target_tcp_proxy was deleted google.cloud.gcp_compute_target_tcp_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target TCP proxy that does not exist +- name: Delete a target TCP proxy that does not exist google.cloud.gcp_compute_target_tcp_proxy: name: "{{ resource_name }}" proxy_header: PROXY_V1 @@ -144,20 +144,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targettcpproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" protocol: TCP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -165,7 +165,7 @@ state: absent register: backendservice ignore_errors: true -- name: delete a health check +- name: Delete a health check google.cloud.gcp_compute_health_check: name: healthcheck-targettcpproxy type: TCP @@ -182,7 +182,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targettcpproxy zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml index a23158d2b..a14a14937 100644 --- a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-vpngateway region: us-west1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-vpngateway project: "{{ gcp_project }}" @@ -31,7 +31,7 @@ auto_create_subnetworks: true state: present register: network -- name: delete a target vpn gateway +- name: Delete a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: "{{ resource_name }}" region: us-west1 @@ -41,7 +41,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target vpn gateway +- name: Create a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: "{{ resource_name }}" region: us-west1 @@ -51,27 +51,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_vpn_gateway was created +- name: Verify that target_vpn_gateway was created google.cloud.gcp_compute_target_vpn_gateway_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target vpn gateway that already exists +- name: Create a target vpn gateway that already exists google.cloud.gcp_compute_target_vpn_gateway: name: "{{ resource_name }}" region: us-west1 @@ -81,12 +81,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target vpn gateway +- name: Delete a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: "{{ resource_name }}" region: us-west1 @@ -96,27 +96,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_vpn_gateway was deleted +- name: Verify that target_vpn_gateway was deleted google.cloud.gcp_compute_target_vpn_gateway_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target vpn gateway that does not exist +- name: Delete a target vpn gateway that does not exist google.cloud.gcp_compute_target_vpn_gateway: name: "{{ resource_name }}" region: us-west1 @@ -126,14 +126,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-vpngateway project: "{{ gcp_project }}" @@ -143,7 +143,7 @@ state: absent register: network ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-vpngateway region: us-west1 diff --git a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml b/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml index 68b8fe492..ead14fef0 100644 --- a/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-urlmap zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-urlmap healthy_threshold: 10 @@ -34,20 +34,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-urlmap backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_url_map: name: "{{ resource_name }}" default_service: "{{ backendservice }}" @@ -56,7 +56,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a URL map +- name: Create a URL map google.cloud.gcp_compute_url_map: name: "{{ resource_name }}" default_service: "{{ backendservice }}" @@ -65,26 +65,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that url_map was created +- name: Verify that url_map was created google.cloud.gcp_compute_url_map_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a URL map that already exists +- name: Create a URL map that already exists google.cloud.gcp_compute_url_map: name: "{{ resource_name }}" default_service: "{{ backendservice }}" @@ -93,12 +93,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_url_map: name: "{{ resource_name }}" default_service: "{{ backendservice }}" @@ -107,26 +107,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that url_map was deleted +- name: Verify that url_map was deleted google.cloud.gcp_compute_url_map_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a URL map that does not exist +- name: Delete a URL map that does not exist google.cloud.gcp_compute_url_map: name: "{{ resource_name }}" default_service: "{{ backendservice }}" @@ -135,28 +135,28 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-urlmap backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-urlmap healthy_threshold: 10 @@ -169,7 +169,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-urlmap zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_url_map/tasks/main.yml b/tests/integration/targets/gcp_compute_url_map/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_url_map/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_url_map/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml index 7f86903a3..79d4e0550 100644 --- a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address region: us-central1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a forward address +- name: Create a forward address google.cloud.gcp_compute_address: name: address-forwardingrule region: us-central1 @@ -31,7 +31,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address_forwardingrule -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-vpn-tunnel project: "{{ gcp_project }}" @@ -40,7 +40,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a disk +- name: Create a disk google.cloud.gcp_compute_disk: name: "{{ resource_prefix }}" size_gb: 50 @@ -51,36 +51,36 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk -- name: create a instance +- name: Create a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: create a router +- name: Create a router google.cloud.gcp_compute_router: name: router-vpn-tunnel network: "{{ network }}" @@ -88,17 +88,17 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: router -- name: create a target vpn gateway +- name: Create a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: gateway-vpn-tunnel region: us-central1 @@ -108,7 +108,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: gateway -- name: create a forwarding rule +- name: Create a forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-central1 @@ -120,7 +120,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: create a UDP-500 forwarding rule +- name: Create a UDP-500 forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}-udp" region: us-central1 @@ -133,7 +133,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: create a UDP-4500 forwarding rule +- name: Create a UDP-4500 forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}-udp-4500" region: us-central1 @@ -146,7 +146,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: delete a vpn tunnel +- name: Delete a vpn tunnel google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-central1 @@ -156,10 +156,10 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - peer_ip: "{{address.address}}" + peer_ip: "{{ address.address }}" state: absent #---------------------------------------------------------- -- name: create a vpn tunnel +- name: Create a vpn tunnel google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-central1 @@ -169,100 +169,100 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - peer_ip: "{{address.address}}" + peer_ip: "{{ address.address }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that vpn_tunnel was created +- name: Verify that vpn_tunnel was created google.cloud.gcp_compute_vpn_tunnel_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a vpn tunnel that already exists +- name: Create a vpn tunnel that already exists google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" - peer_ip: "{{address.address}}" + peer_ip: "{{ address.address }}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a vpn tunnel +- name: Delete a vpn tunnel google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" - peer_ip: "{{address.address}}" + peer_ip: "{{ address.address }}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that vpn_tunnel was deleted +- name: Verify that vpn_tunnel was deleted google.cloud.gcp_compute_vpn_tunnel_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a vpn tunnel that does not exist +- name: Delete a vpn tunnel that does not exist google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" - peer_ip: "{{address.address}}" + peer_ip: "{{ address.address }}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown -- name: delete a UDP-4500 forwarding rule +- name: Delete a UDP-4500 forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}-udp-4500" region: us-central1 @@ -276,7 +276,7 @@ state: absent ignore_errors: true register: result -- name: delete a UDP forwarding rule +- name: Delete a UDP forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}-udp" region: us-central1 @@ -290,13 +290,13 @@ state: absent ignore_errors: true register: result -- name: delete a forwarding rule +- name: Delete a forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-central1 target: "{{ gateway.selfLink }}" ip_protocol: ESP - ip_address: "104.197.5.203" + ip_address: 104.197.5.203 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" @@ -304,7 +304,7 @@ ignore_errors: true register: result # If errors happen, don't crash the playbook! -- name: delete a target vpn gateway +- name: Delete a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: gateway-vpn-tunnel region: us-central1 @@ -315,7 +315,7 @@ state: absent register: gateway ignore_errors: true -- name: delete a router +- name: Delete a router google.cloud.gcp_compute_router: name: router-vpn-tunnel network: "{{ network }}" @@ -323,10 +323,10 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -334,35 +334,35 @@ state: absent register: router ignore_errors: true -- name: delete a instance +- name: Delete a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: "{{ resource_prefix }}" size_gb: 50 @@ -374,7 +374,7 @@ state: absent register: disk ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-vpn-tunnel project: "{{ gcp_project }}" @@ -384,7 +384,7 @@ state: absent register: network ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address region: us-central1 @@ -393,4 +393,4 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address - ignore_errors: true \ No newline at end of file + ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml b/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml index 244369636..4a845eac0 100644 --- a/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml +++ b/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a cluster +- name: Delete a cluster google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 @@ -22,11 +22,11 @@ disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "serviceaccount" + auth_kind: serviceaccount service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a cluster +- name: Create a cluster google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 @@ -35,29 +35,29 @@ disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "serviceaccount" + auth_kind: serviceaccount service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that cluster was created +- name: Verify that cluster was created google.cloud.gcp_container_cluster_info: - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "serviceaccount" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: serviceaccount + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'my-cluster' in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a cluster that already exists +- name: Create a cluster that already exists google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 @@ -66,16 +66,16 @@ disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "serviceaccount" + auth_kind: serviceaccount service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a cluster +- name: Delete a cluster google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 @@ -84,29 +84,29 @@ disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "serviceaccount" + auth_kind: serviceaccount service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that cluster was deleted +- name: Verify that cluster was deleted google.cloud.gcp_container_cluster_info: - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'my-cluster' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a cluster that does not exist +- name: Delete a cluster that does not exist google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 @@ -115,11 +115,11 @@ disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "serviceaccount" + auth_kind: serviceaccount service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_container_cluster/tasks/main.yml b/tests/integration/targets/gcp_container_cluster/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/tests/integration/targets/gcp_container_cluster/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml b/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml index f3f5849fe..ae04f3049 100644 --- a/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml +++ b/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a cluster +- name: Create a cluster google.cloud.gcp_container_cluster: name: cluster-nodepool initial_node_count: 4 @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: cluster -- name: delete a node pool +- name: Delete a node pool google.cloud.gcp_container_node_pool: name: my-pool initial_node_count: 4 @@ -34,7 +34,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a node pool +- name: Create a node pool google.cloud.gcp_container_node_pool: name: my-pool initial_node_count: 4 @@ -45,26 +45,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_pool was created +- name: Verify that node_pool was created google.cloud.gcp_container_node_pool_info: - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'my-pool' in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a node pool that already exists +- name: Create a node pool that already exists google.cloud.gcp_container_node_pool: name: my-pool initial_node_count: 4 @@ -75,12 +75,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a node pool +- name: Delete a node pool google.cloud.gcp_container_node_pool: name: my-pool initial_node_count: 4 @@ -91,26 +91,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_pool was deleted +- name: Verify that node_pool was deleted google.cloud.gcp_container_node_pool_info: - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'my-pool' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a node pool that does not exist +- name: Delete a node pool that does not exist google.cloud.gcp_container_node_pool: name: my-pool initial_node_count: 4 @@ -121,14 +121,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a cluster +- name: Delete a cluster google.cloud.gcp_container_cluster: name: cluster-nodepool initial_node_count: 4 diff --git a/tests/integration/targets/gcp_container_node_pool/tasks/main.yml b/tests/integration/targets/gcp_container_node_pool/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/tests/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml b/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml index 70d72cc15..2e7b2bfbe 100644 --- a/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml +++ b/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a managed zone +- name: Delete a managed zone google.cloud.gcp_dns_managed_zone: name: "{{ resource_name }}" dns_name: test.somewild2.example.com. @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a managed zone +- name: Create a managed zone google.cloud.gcp_dns_managed_zone: name: "{{ resource_name }}" dns_name: test.somewild2.example.com. @@ -33,25 +33,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that managed_zone was created +- name: Verify that managed_zone was created google.cloud.gcp_dns_managed_zone_info: - dns_name: test.somewild2.example.com. - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite + dns_name: test.somewild2.example.com. + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a managed zone that already exists +- name: Create a managed zone that already exists google.cloud.gcp_dns_managed_zone: name: "{{ resource_name }}" dns_name: test.somewild2.example.com. @@ -61,12 +61,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a managed zone +- name: Delete a managed zone google.cloud.gcp_dns_managed_zone: name: "{{ resource_name }}" dns_name: test.somewild2.example.com. @@ -76,25 +76,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that managed_zone was deleted +- name: Verify that managed_zone was deleted google.cloud.gcp_dns_managed_zone_info: - dns_name: test.somewild2.example.com. - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite + dns_name: test.somewild2.example.com. + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a managed zone that does not exist +- name: Delete a managed zone that does not exist google.cloud.gcp_dns_managed_zone: name: "{{ resource_name }}" dns_name: test.somewild2.example.com. @@ -104,7 +104,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_dns_managed_zone/tasks/main.yml b/tests/integration/targets/gcp_dns_managed_zone/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_dns_managed_zone/tasks/main.yml +++ b/tests/integration/targets/gcp_dns_managed_zone/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml b/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml index b446727f5..67fe3e328 100644 --- a/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml +++ b/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a managed zone +- name: Create a managed zone google.cloud.gcp_dns_managed_zone: name: managedzone-rrs dns_name: testzone-4.com. @@ -23,125 +23,125 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: managed_zone -- name: delete a resource record set +- name: Delete a resource record set google.cloud.gcp_dns_resource_record_set: name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" type: A ttl: 600 target: - - 10.1.2.3 - - 40.5.6.7 + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a resource record set +- name: Create a resource record set google.cloud.gcp_dns_resource_record_set: name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" type: A ttl: 600 target: - - 10.1.2.3 - - 40.5.6.7 + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that resource_record_set was created +- name: Verify that resource_record_set was created google.cloud.gcp_dns_resource_record_set_info: - managed_zone: "{{ managed_zone }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite + managed_zone: "{{ managed_zone }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'www.testzone-4.com.'in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a resource record set that already exists +- name: Create a resource record set that already exists google.cloud.gcp_dns_resource_record_set: name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" type: A ttl: 600 target: - - 10.1.2.3 - - 40.5.6.7 + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a resource record set +- name: Delete a resource record set google.cloud.gcp_dns_resource_record_set: name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" type: A ttl: 600 target: - - 10.1.2.3 - - 40.5.6.7 + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that resource_record_set was deleted +- name: Verify that resource_record_set was deleted google.cloud.gcp_dns_resource_record_set_info: - managed_zone: "{{ managed_zone }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite + managed_zone: "{{ managed_zone }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'www.testzone-4.com.'not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a resource record set that does not exist +- name: Delete a resource record set that does not exist google.cloud.gcp_dns_resource_record_set: name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" type: A ttl: 600 target: - - 10.1.2.3 - - 40.5.6.7 + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a managed zone +- name: Delete a managed zone google.cloud.gcp_dns_managed_zone: name: managedzone-rrs dns_name: testzone-4.com. diff --git a/tests/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/tests/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/tests/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml b/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml index 4a4769d9b..20a7bde7c 100644 --- a/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml @@ -13,133 +13,133 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a instance +- name: Delete a instance google.cloud.gcp_filestore_instance: name: "{{ resource_name }}" zone: us-central1-b tier: PREMIUM file_shares: - - capacity_gb: 2660 - name: share1 + - capacity_gb: 2660 + name: share1 networks: - - network: default - modes: - - MODE_IPV4 + - network: default + modes: + - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_filestore_instance: name: "{{ resource_name }}" zone: us-central1-b tier: PREMIUM file_shares: - - capacity_gb: 2660 - name: share1 + - capacity_gb: 2660 + name: share1 networks: - - network: default - modes: - - MODE_IPV4 + - network: default + modes: + - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_filestore_instance_info: - zone: us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + zone: us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_filestore_instance: name: "{{ resource_name }}" zone: us-central1-b tier: PREMIUM file_shares: - - capacity_gb: 2660 - name: share1 + - capacity_gb: 2660 + name: share1 networks: - - network: default - modes: - - MODE_IPV4 + - network: default + modes: + - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_filestore_instance: name: "{{ resource_name }}" zone: us-central1-b tier: PREMIUM file_shares: - - capacity_gb: 2660 - name: share1 + - capacity_gb: 2660 + name: share1 networks: - - network: default - modes: - - MODE_IPV4 + - network: default + modes: + - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_filestore_instance_info: - zone: us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + zone: us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_filestore_instance: name: "{{ resource_name }}" zone: us-central1-b tier: PREMIUM file_shares: - - capacity_gb: 2660 - name: share1 + - capacity_gb: 2660 + name: share1 networks: - - network: default - modes: - - MODE_IPV4 + - network: default + modes: + - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_filestore_instance/tasks/main.yml b/tests/integration/targets/gcp_filestore_instance/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_filestore_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_filestore_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_iam_role/tasks/autogen.yml b/tests/integration/targets/gcp_iam_role/tasks/autogen.yml index d75420310..d4afe3579 100644 --- a/tests/integration/targets/gcp_iam_role/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_role/tasks/autogen.yml @@ -13,136 +13,136 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a role +- name: Delete a role google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a role +- name: Create a role google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that role was created +- name: Verify that role was created google.cloud.gcp_iam_role_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/iam + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/iam register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30].replace('-', '_') }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a role that already exists +- name: Create a role that already exists google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false # ---------------------------------------------------------------------------- -- name: modify an IAM role that already exists +- name: Modify an IAM role that already exists google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - storage.buckets.get - - storage.buckets.list - - storage.objects.get - - storage.objects.list + - storage.buckets.get + - storage.buckets.list + - storage.objects.get + - storage.objects.list project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true #---------------------------------------------------------- -- name: delete a role +- name: Delete a role google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that role was deleted +- name: Verify that role was deleted google.cloud.gcp_iam_role_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/iam + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/iam register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30].replace('-', '_') }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a role that does not exist +- name: Delete a role that does not exist google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_iam_role/tasks/main.yml b/tests/integration/targets/gcp_iam_role/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_iam_role/tasks/main.yml +++ b/tests/integration/targets/gcp_iam_role/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml index ec14f7840..9a4106dc8 100644 --- a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a service account +- name: Delete a service account google.cloud.gcp_iam_service_account: name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a service account +- name: Create a service account google.cloud.gcp_iam_service_account: name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key @@ -31,24 +31,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that service_account was created +- name: Verify that service_account was created google.cloud.gcp_iam_service_account_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/iam + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/iam register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 1 + - results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") + | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a service account that already exists +- name: Create a service account that already exists google.cloud.gcp_iam_service_account: name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key @@ -57,12 +58,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a service account +- name: Delete a service account google.cloud.gcp_iam_service_account: name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key @@ -71,24 +72,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that service_account was deleted +- name: Verify that service_account was deleted google.cloud.gcp_iam_service_account_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/iam + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/iam register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 0 + - results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") + | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a service account that does not exist +- name: Delete a service account that does not exist google.cloud.gcp_iam_service_account: name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key @@ -97,7 +99,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_iam_service_account/tasks/main.yml b/tests/integration/targets/gcp_iam_service_account/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_iam_service_account/tasks/main.yml +++ b/tests/integration/targets/gcp_iam_service_account/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_iam_service_account_key/defaults/main.yml b/tests/integration/targets/gcp_iam_service_account_key/defaults/main.yml index aa87a2a8e..aa65c31f5 100644 --- a/tests/integration/targets/gcp_iam_service_account_key/defaults/main.yml +++ b/tests/integration/targets/gcp_iam_service_account_key/defaults/main.yml @@ -1,3 +1,3 @@ --- # defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml b/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml index dd7ed17b3..0e270778a 100644 --- a/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml +++ b/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml @@ -13,8 +13,8 @@ --- # Pre-test setup -- name: create a key ring - gcp_kms_key_ring: +- name: Create a key ring + google.cloud.gcp_kms_key_ring: name: key-key-ring location: us-central1 project: "{{ gcp_project }}" @@ -22,8 +22,8 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: keyring -- name: delete a crypto key - gcp_kms_crypto_key: +- name: Delete a crypto key + google.cloud.gcp_kms_crypto_key: name: "{{ resource_name }}" key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring project: "{{ gcp_project }}" @@ -31,8 +31,8 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a crypto key - gcp_kms_crypto_key: +- name: Create a crypto key + google.cloud.gcp_kms_crypto_key: name: "{{ resource_name }}" key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring project: "{{ gcp_project }}" @@ -40,26 +40,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that crypto_key was created - gcp_kms_crypto_key_info: - key_ring: "projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudkms +- name: Verify that crypto_key was created + google.cloud.gcp_kms_crypto_key_info: + key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudkms register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a crypto key that already exists - gcp_kms_crypto_key: +- name: Create a crypto key that already exists + google.cloud.gcp_kms_crypto_key: name: "{{ resource_name }}" key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring project: "{{ gcp_project }}" @@ -67,7 +67,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_kms_crypto_key/tasks/main.yml b/tests/integration/targets/gcp_kms_crypto_key/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_kms_crypto_key/tasks/main.yml +++ b/tests/integration/targets/gcp_kms_crypto_key/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml b/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml index 0c52609df..b0af43c17 100644 --- a/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml +++ b/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml @@ -1,3 +1,4 @@ +--- # Copyright 2019 Google Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +13,8 @@ # limitations under the License. # Pre-test setup -- name: delete a key ring - gcp_kms_key_ring: +- name: Delete a key ring + google.cloud.gcp_kms_key_ring: name: "{{ resource_name }}" location: us-central1 project: "{{ gcp_project }}" @@ -21,8 +22,8 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a key ring - gcp_kms_key_ring: +- name: Create a key ring + google.cloud.gcp_kms_key_ring: name: "{{ resource_name }}" location: us-central1 project: "{{ gcp_project }}" @@ -30,26 +31,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that key_ring was created - gcp_kms_key_ring_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudkms +- name: Verify that key_ring was created + google.cloud.gcp_kms_key_ring_info: + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudkms register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a key ring that already exists - gcp_kms_key_ring: +- name: Create a key ring that already exists + google.cloud.gcp_kms_key_ring: name: "{{ resource_name }}" location: us-central1 project: "{{ gcp_project }}" @@ -57,7 +58,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_kms_key_ring/tasks/main.yml b/tests/integration/targets/gcp_kms_key_ring/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_kms_key_ring/tasks/main.yml +++ b/tests/integration/targets/gcp_kms_key_ring/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml b/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml index 8d0f6c0f8..90a77b05c 100644 --- a/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml +++ b/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml @@ -13,18 +13,18 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a metric +- name: Delete a metric google.cloud.gcp_logging_metric: name: "{{ resource_name }}" filter: resource.type=gae_app AND severity>=ERROR metric_descriptor: metric_kind: DELTA value_type: DISTRIBUTION - unit: '1' + unit: "1" labels: - - key: mass - value_type: STRING - description: amount of matter + - key: mass + value_type: STRING + description: amount of matter value_extractor: EXTRACT(jsonPayload.request) label_extractors: mass: EXTRACT(jsonPayload.request) @@ -38,18 +38,18 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a metric +- name: Create a metric google.cloud.gcp_logging_metric: name: "{{ resource_name }}" filter: resource.type=gae_app AND severity>=ERROR metric_descriptor: metric_kind: DELTA value_type: DISTRIBUTION - unit: '1' + unit: "1" labels: - - key: mass - value_type: STRING - description: amount of matter + - key: mass + value_type: STRING + description: amount of matter value_extractor: EXTRACT(jsonPayload.request) label_extractors: mass: EXTRACT(jsonPayload.request) @@ -63,35 +63,35 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that metric was created +- name: Verify that metric was created google.cloud.gcp_logging_metric_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a metric that already exists +- name: Create a metric that already exists google.cloud.gcp_logging_metric: name: "{{ resource_name }}" filter: resource.type=gae_app AND severity>=ERROR metric_descriptor: metric_kind: DELTA value_type: DISTRIBUTION - unit: '1' + unit: "1" labels: - - key: mass - value_type: STRING - description: amount of matter + - key: mass + value_type: STRING + description: amount of matter value_extractor: EXTRACT(jsonPayload.request) label_extractors: mass: EXTRACT(jsonPayload.request) @@ -105,23 +105,23 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a metric +- name: Delete a metric google.cloud.gcp_logging_metric: name: "{{ resource_name }}" filter: resource.type=gae_app AND severity>=ERROR metric_descriptor: metric_kind: DELTA value_type: DISTRIBUTION - unit: '1' + unit: "1" labels: - - key: mass - value_type: STRING - description: amount of matter + - key: mass + value_type: STRING + description: amount of matter value_extractor: EXTRACT(jsonPayload.request) label_extractors: mass: EXTRACT(jsonPayload.request) @@ -135,35 +135,35 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that metric was deleted +- name: Verify that metric was deleted google.cloud.gcp_logging_metric_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a metric that does not exist +- name: Delete a metric that does not exist google.cloud.gcp_logging_metric: name: "{{ resource_name }}" filter: resource.type=gae_app AND severity>=ERROR metric_descriptor: metric_kind: DELTA value_type: DISTRIBUTION - unit: '1' + unit: "1" labels: - - key: mass - value_type: STRING - description: amount of matter + - key: mass + value_type: STRING + description: amount of matter value_extractor: EXTRACT(jsonPayload.request) label_extractors: mass: EXTRACT(jsonPayload.request) @@ -177,7 +177,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_logging_metric/tasks/main.yml b/tests/integration/targets/gcp_logging_metric/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_logging_metric/tasks/main.yml +++ b/tests/integration/targets/gcp_logging_metric/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml b/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml index 1f115aa1e..619a49c1c 100644 --- a/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml +++ b/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml @@ -13,101 +13,101 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a model +- name: Delete a model google.cloud.gcp_mlengine_model: name: "{{ resource_name | replace('-', '_') }}" description: My model regions: - - us-central1 + - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a model +- name: Create a model google.cloud.gcp_mlengine_model: name: "{{ resource_name | replace('-', '_') }}" description: My model regions: - - us-central1 + - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that model was created +- name: Verify that model was created google.cloud.gcp_mlengine_model_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a model that already exists +- name: Create a model that already exists google.cloud.gcp_mlengine_model: name: "{{ resource_name | replace('-', '_') }}" description: My model regions: - - us-central1 + - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a model +- name: Delete a model google.cloud.gcp_mlengine_model: name: "{{ resource_name | replace('-', '_') }}" description: My model regions: - - us-central1 + - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that model was deleted +- name: Verify that model was deleted google.cloud.gcp_mlengine_model_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a model that does not exist +- name: Delete a model that does not exist google.cloud.gcp_mlengine_model: name: "{{ resource_name | replace('-', '_') }}" description: My model regions: - - us-central1 + - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_mlengine_model/tasks/main.yml b/tests/integration/targets/gcp_mlengine_model/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_mlengine_model/tasks/main.yml +++ b/tests/integration/targets/gcp_mlengine_model/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml b/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml index fc0bff274..d68bad0bc 100644 --- a/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml +++ b/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml @@ -13,140 +13,140 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a model +- name: Create a model google.cloud.gcp_mlengine_model: name: model_version description: My model regions: - - us-central1 - online_prediction_logging: 'true' - online_prediction_console_logging: 'true' + - us-central1 + online_prediction_logging: "true" + online_prediction_console_logging: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: model -- name: delete a version +- name: Delete a version google.cloud.gcp_mlengine_version: name: "{{ resource_name | replace('-', '_') }}" model: "{{ model }}" runtime_version: 1.13 python_version: 3.5 - is_default: 'true' + is_default: "true" deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a version +- name: Create a version google.cloud.gcp_mlengine_version: name: "{{ resource_name | replace('-', '_') }}" model: "{{ model }}" runtime_version: 1.13 python_version: 3.5 - is_default: 'true' + is_default: "true" deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that version was created +- name: Verify that version was created google.cloud.gcp_mlengine_version_info: - model: "{{ model }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + model: "{{ model }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a version that already exists +- name: Create a version that already exists google.cloud.gcp_mlengine_version: name: "{{ resource_name | replace('-', '_') }}" model: "{{ model }}" runtime_version: 1.13 python_version: 3.5 - is_default: 'true' + is_default: "true" deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a version +- name: Delete a version google.cloud.gcp_mlengine_version: name: "{{ resource_name | replace('-', '_') }}" model: "{{ model }}" runtime_version: 1.13 python_version: 3.5 - is_default: 'true' + is_default: "true" deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that version was deleted +- name: Verify that version was deleted google.cloud.gcp_mlengine_version_info: - model: "{{ model }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + model: "{{ model }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a version that does not exist +- name: Delete a version that does not exist google.cloud.gcp_mlengine_version: name: "{{ resource_name | replace('-', '_') }}" model: "{{ model }}" runtime_version: 1.13 python_version: 3.5 - is_default: 'true' + is_default: "true" deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a model +- name: Delete a model google.cloud.gcp_mlengine_model: name: model_version description: My model regions: - - us-central1 - online_prediction_logging: 'true' - online_prediction_console_logging: 'true' + - us-central1 + online_prediction_logging: "true" + online_prediction_console_logging: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" diff --git a/tests/integration/targets/gcp_mlengine_version/tasks/main.yml b/tests/integration/targets/gcp_mlengine_version/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_mlengine_version/tasks/main.yml +++ b/tests/integration/targets/gcp_mlengine_version/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml b/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml index 5aa60eef1..ca78eb436 100644 --- a/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml +++ b/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a topic +- name: Create a topic google.cloud.gcp_pubsub_topic: name: topic-subscription project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: topic -- name: delete a subscription +- name: Delete a subscription google.cloud.gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" @@ -31,7 +31,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a subscription +- name: Create a subscription google.cloud.gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" @@ -41,24 +41,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that subscription was created +- name: Verify that subscription was created google.cloud.gcp_pubsub_subscription_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/pubsub + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "\"{{resource_name}}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - "\"{{ resource_name }}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a subscription that already exists +- name: Create a subscription that already exists google.cloud.gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" @@ -68,12 +68,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a subscription +- name: Delete a subscription google.cloud.gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" @@ -83,24 +83,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that subscription was deleted +- name: Verify that subscription was deleted google.cloud.gcp_pubsub_subscription_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/pubsub + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "\"{{resource_name}}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - "\"{{ resource_name }}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a subscription that does not exist +- name: Delete a subscription that does not exist google.cloud.gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" @@ -110,14 +110,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a topic +- name: Delete a topic google.cloud.gcp_pubsub_topic: name: topic-subscription project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_pubsub_subscription/tasks/main.yml b/tests/integration/targets/gcp_pubsub_subscription/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_pubsub_subscription/tasks/main.yml +++ b/tests/integration/targets/gcp_pubsub_subscription/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml b/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml index 4e5d4382d..0c0dbdc96 100644 --- a/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml +++ b/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a topic +- name: Delete a topic google.cloud.gcp_pubsub_topic: name: test-topic1 project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a topic +- name: Create a topic google.cloud.gcp_pubsub_topic: name: test-topic1 project: "{{ gcp_project }}" @@ -29,24 +29,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that topic was created +- name: Verify that topic was created google.cloud.gcp_pubsub_topic_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/pubsub + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'test-topic1' in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a topic that already exists +- name: Create a topic that already exists google.cloud.gcp_pubsub_topic: name: test-topic1 project: "{{ gcp_project }}" @@ -54,12 +54,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a topic +- name: Delete a topic google.cloud.gcp_pubsub_topic: name: test-topic1 project: "{{ gcp_project }}" @@ -67,24 +67,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that topic was deleted +- name: Verify that topic was deleted google.cloud.gcp_pubsub_topic_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/pubsub + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'test-topic1' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a topic that does not exist +- name: Delete a topic that does not exist google.cloud.gcp_pubsub_topic: name: test-topic1 project: "{{ gcp_project }}" @@ -92,7 +92,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_pubsub_topic/tasks/main.yml b/tests/integration/targets/gcp_pubsub_topic/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_pubsub_topic/tasks/main.yml +++ b/tests/integration/targets/gcp_pubsub_topic/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml b/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml index 1155fbd34..cea48d6b8 100644 --- a/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instance project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: delete a instance +- name: Delete a instance google.cloud.gcp_redis_instance: name: instance37 tier: STANDARD_HA @@ -40,7 +40,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_redis_instance: name: instance37 tier: STANDARD_HA @@ -58,25 +58,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_redis_instance_info: - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*instance37.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_redis_instance: name: instance37 tier: STANDARD_HA @@ -94,12 +94,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_redis_instance: name: instance37 tier: STANDARD_HA @@ -117,25 +117,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_redis_instance_info: - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*instance37.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_redis_instance: name: instance37 tier: STANDARD_HA @@ -153,14 +153,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instance project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_redis_instance/tasks/main.yml b/tests/integration/targets/gcp_redis_instance/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_redis_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_redis_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml index 0c92900c3..5545d0edc 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml +++ b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a project +- name: Delete a project google.cloud.gcp_resourcemanager_project: name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" @@ -24,7 +24,7 @@ id: "{{ gcp_folder_id }}" state: absent #---------------------------------------------------------- -- name: create a project +- name: Create a project google.cloud.gcp_resourcemanager_project: name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" @@ -35,29 +35,30 @@ id: "{{ gcp_folder_id }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true - name: Pause for 2 minutes for project to appear ansible.builtin.pause: minutes: 2 -- name: verify that project was created +- name: Verify that project was created google.cloud.gcp_resourcemanager_project_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - # choose 1000 projects so iterate past the deleted ones. - page_size: 1000 - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + # choose 1000 projects so iterate past the deleted ones. + page_size: 1000 + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | selectattr("lifecycleState", "equalto", "ACTIVE") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") | list | length == 1 + - results['resources'] | selectattr("lifecycleState", "equalto", "ACTIVE") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") | list + | length == 1 # ---------------------------------------------------------------------------- -- name: create a project that already exists +- name: Create a project that already exists google.cloud.gcp_resourcemanager_project: name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" @@ -68,12 +69,12 @@ id: "{{ gcp_folder_id }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a project +- name: Delete a project google.cloud.gcp_resourcemanager_project: name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" @@ -84,29 +85,30 @@ id: "{{ gcp_folder_id }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true - name: Pause for 2 minutes for project to appear ansible.builtin.pause: minutes: 2 -- name: verify that project was deleted +- name: Verify that project was deleted google.cloud.gcp_resourcemanager_project_info: - project: "{{ resource_prefix[0:30] }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - # choose 1000 projects so iterate past the deleted ones. - page_size: 1000 - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ resource_prefix[0:30] }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + # choose 1000 projects so iterate past the deleted ones. + page_size: 1000 + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | selectattr("lifecycleState", "equalto", "DELETE_REQUESTED") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") | list | length == 1 + - results['resources'] | selectattr("lifecycleState", "equalto", "DELETE_REQUESTED") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") + | list | length == 1 # ---------------------------------------------------------------------------- -- name: delete a project that does not exist +- name: Delete a project that does not exist google.cloud.gcp_resourcemanager_project: name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" @@ -117,7 +119,7 @@ id: "{{ gcp_folder_id }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_resourcemanager_project/tasks/main.yml b/tests/integration/targets/gcp_resourcemanager_project/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/tasks/main.yml +++ b/tests/integration/targets/gcp_resourcemanager_project/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml b/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml index 08bba39b7..3eebf1be3 100644 --- a/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml +++ b/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a config +- name: Delete a config google.cloud.gcp_runtimeconfig_config: name: "{{ resource_name }}" description: My config @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a config +- name: Create a config google.cloud.gcp_runtimeconfig_config: name: "{{ resource_name }}" description: My config @@ -31,24 +31,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that config was created +- name: Verify that config was created google.cloud.gcp_runtimeconfig_config_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudruntimeconfig + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudruntimeconfig register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a config that already exists +- name: Create a config that already exists google.cloud.gcp_runtimeconfig_config: name: "{{ resource_name }}" description: My config @@ -57,12 +57,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a config +- name: Delete a config google.cloud.gcp_runtimeconfig_config: name: "{{ resource_name }}" description: My config @@ -71,24 +71,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that config was deleted +- name: Verify that config was deleted google.cloud.gcp_runtimeconfig_config_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudruntimeconfig + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudruntimeconfig register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a config that does not exist +- name: Delete a config that does not exist google.cloud.gcp_runtimeconfig_config: name: "{{ resource_name }}" description: My config @@ -97,7 +97,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_runtimeconfig_config/tasks/main.yml b/tests/integration/targets/gcp_runtimeconfig_config/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_runtimeconfig_config/tasks/main.yml +++ b/tests/integration/targets/gcp_runtimeconfig_config/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml b/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml index 5ea7d80e6..4a790dcee 100644 --- a/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml +++ b/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a config +- name: Create a config google.cloud.gcp_runtimeconfig_config: name: my-config description: My config @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: config -- name: delete a variable +- name: Delete a variable google.cloud.gcp_runtimeconfig_variable: name: prod-variables/hostname config: my-config @@ -32,7 +32,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a variable +- name: Create a variable google.cloud.gcp_runtimeconfig_variable: name: prod-variables/hostname config: my-config @@ -42,25 +42,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that variable was created +- name: Verify that variable was created google.cloud.gcp_runtimeconfig_variable_info: - config: my-config - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudruntimeconfig + config: my-config + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudruntimeconfig register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*prod-variables/hostname.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a variable that already exists +- name: Create a variable that already exists google.cloud.gcp_runtimeconfig_variable: name: prod-variables/hostname config: my-config @@ -70,12 +70,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a variable +- name: Delete a variable google.cloud.gcp_runtimeconfig_variable: name: prod-variables/hostname config: my-config @@ -85,25 +85,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that variable was deleted +- name: Verify that variable was deleted google.cloud.gcp_runtimeconfig_variable_info: - config: my-config - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudruntimeconfig + config: my-config + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudruntimeconfig register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*prod-variables/hostname.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a variable that does not exist +- name: Delete a variable that does not exist google.cloud.gcp_runtimeconfig_variable: name: prod-variables/hostname config: my-config @@ -113,14 +113,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a config +- name: Delete a config google.cloud.gcp_runtimeconfig_config: name: my-config description: My config diff --git a/tests/integration/targets/gcp_runtimeconfig_variable/tasks/main.yml b/tests/integration/targets/gcp_runtimeconfig_variable/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_runtimeconfig_variable/tasks/main.yml +++ b/tests/integration/targets/gcp_runtimeconfig_variable/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_serviceusage_service/aliases b/tests/integration/targets/gcp_serviceusage_service/aliases index 9812f019c..26507c23c 100644 --- a/tests/integration/targets/gcp_serviceusage_service/aliases +++ b/tests/integration/targets/gcp_serviceusage_service/aliases @@ -1,2 +1 @@ cloud/gcp -unsupported diff --git a/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml b/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml index c5f7f1e83..666da8f6b 100644 --- a/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml @@ -13,62 +13,62 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a service +- name: Delete a service google.cloud.gcp_serviceusage_service: - name: spanner.googleapis.com + name: alloydb.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a service +- name: Create a service google.cloud.gcp_serviceusage_service: - name: spanner.googleapis.com + name: alloydb.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that service was created +- name: Verify that service was created google.cloud.gcp_serviceusage_service_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "'{{ (results['resources'] | selectattr('name', 'search', 'spanner.googleapis.com') | list | first).state }}' == 'ENABLED'" + - "'{{ (results['resources'] | selectattr('name', 'search', 'alloydb.googleapis.com') | list | first).state }}' == 'ENABLED'" # ---------------------------------------------------------------------------- -- name: create a service that already exists +- name: Create a service that already exists google.cloud.gcp_serviceusage_service: - name: spanner.googleapis.com + name: alloydb.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a service +- name: Delete a service google.cloud.gcp_serviceusage_service: - name: spanner.googleapis.com + name: alloydb.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # TODO(@toumorokoshi): investigate if the pause helps @@ -76,28 +76,28 @@ # - name: Pause for 1 minute to keep from hitting quota limit # ansible.builtin.pause: # minutes: 1 -- name: verify that service was deleted +- name: Verify that service was deleted google.cloud.gcp_serviceusage_service_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "'{{ (results['resources'] | selectattr('name', 'search', 'spanner.googleapis.com') | list | first).state }}' == 'DISABLED'" + - "'{{ (results['resources'] | selectattr('name', 'search', 'alloydb.googleapis.com') | list | first).state }}' == 'DISABLED'" # ---------------------------------------------------------------------------- -- name: delete a service that does not exist +- name: Delete a service that does not exist google.cloud.gcp_serviceusage_service: - name: spanner.googleapis.com + name: alloydb.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_serviceusage_service/tasks/main.yml b/tests/integration/targets/gcp_serviceusage_service/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_serviceusage_service/tasks/main.yml +++ b/tests/integration/targets/gcp_serviceusage_service/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml b/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml index da4942a15..0bc805810 100644 --- a/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a repository +- name: Delete a repository google.cloud.gcp_sourcerepo_repository: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a repository +- name: Create a repository google.cloud.gcp_sourcerepo_repository: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -29,24 +29,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that repository was created +- name: Verify that repository was created google.cloud.gcp_sourcerepo_repository_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a repository that already exists +- name: Create a repository that already exists google.cloud.gcp_sourcerepo_repository: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -54,12 +54,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a repository +- name: Delete a repository google.cloud.gcp_sourcerepo_repository: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -67,24 +67,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that repository was deleted +- name: Verify that repository was deleted google.cloud.gcp_sourcerepo_repository_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a repository that does not exist +- name: Delete a repository that does not exist google.cloud.gcp_sourcerepo_repository: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -92,7 +92,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_sourcerepo_repository/tasks/main.yml b/tests/integration/targets/gcp_sourcerepo_repository/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_sourcerepo_repository/tasks/main.yml +++ b/tests/integration/targets/gcp_sourcerepo_repository/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml b/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml index a3d8678d5..a3aa4cca2 100644 --- a/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance +- name: Create a instance google.cloud.gcp_spanner_instance: name: instance-database display_name: My Spanner Instance @@ -26,7 +26,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance -- name: delete a database +- name: Delete a database google.cloud.gcp_spanner_database: name: webstore instance: "{{ instance }}" @@ -35,7 +35,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a database +- name: Create a database google.cloud.gcp_spanner_database: name: webstore instance: "{{ instance }}" @@ -44,8 +44,8 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # - name: verify that database was created @@ -62,7 +62,7 @@ # that: # - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a database that already exists +- name: Create a database that already exists google.cloud.gcp_spanner_database: name: webstore instance: "{{ instance }}" @@ -71,12 +71,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a database +- name: Delete a database google.cloud.gcp_spanner_database: name: webstore instance: "{{ instance }}" @@ -85,8 +85,8 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # commented out due to a flakey List endpoint @@ -107,7 +107,7 @@ # that: # - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a database that does not exist +- name: Delete a database that does not exist google.cloud.gcp_spanner_database: name: webstore instance: "{{ instance }}" @@ -116,14 +116,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance +- name: Delete a instance google.cloud.gcp_spanner_instance: name: instance-database display_name: My Spanner Instance diff --git a/tests/integration/targets/gcp_spanner_database/tasks/main.yml b/tests/integration/targets/gcp_spanner_database/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_spanner_database/tasks/main.yml +++ b/tests/integration/targets/gcp_spanner_database/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml b/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml index 8993c7282..daae5c896 100644 --- a/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a instance +- name: Delete a instance google.cloud.gcp_spanner_instance: name: testinstance display_name: My Spanner Instance @@ -26,7 +26,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_spanner_instance: name: testinstance display_name: My Spanner Instance @@ -39,24 +39,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_spanner_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/spanner.admin + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*testinstance.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_spanner_instance: name: testinstance display_name: My Spanner Instance @@ -69,12 +69,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_spanner_instance: name: testinstance display_name: My Spanner Instance @@ -87,24 +87,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_spanner_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/spanner.admin + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*testinstance.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_spanner_instance: name: testinstance display_name: My Spanner Instance @@ -117,7 +117,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_spanner_instance/tasks/main.yml b/tests/integration/targets/gcp_spanner_instance/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_spanner_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_spanner_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml index 5171771c2..dd87faa83 100644 --- a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml @@ -13,14 +13,14 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance +- name: Create a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-3" + name: "{{ resource_name }}-3" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -28,7 +28,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance -- name: delete a database +- name: Delete a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" charset: utf8mb4 @@ -38,7 +38,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a database +- name: Create a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" charset: utf8mb4 @@ -48,25 +48,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that database was created +- name: Verify that database was created google.cloud.gcp_sql_database_info: - instance: "{{ instance.name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + instance: "{{ instance.name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "\"{{resource_name}}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - "\"{{ resource_name }}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a database that already exists +- name: Create a database that already exists google.cloud.gcp_sql_database: name: "{{ resource_name }}" charset: utf8mb4 @@ -76,12 +76,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a database +- name: Delete a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" charset: utf8mb4 @@ -91,25 +91,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that database was deleted +- name: Verify that database was deleted google.cloud.gcp_sql_database_info: - instance: "{{ instance.name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + instance: "{{ instance.name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "\"{{resource_name}}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - "\"{{ resource_name }}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a database that does not exist +- name: Delete a database that does not exist google.cloud.gcp_sql_database: name: "{{ resource_name }}" charset: utf8mb4 @@ -119,21 +119,21 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance +- name: Delete a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-3" + name: "{{ resource_name }}-3" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_sql_database/tasks/main.yml b/tests/integration/targets/gcp_sql_database/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_sql_database/tasks/main.yml +++ b/tests/integration/targets/gcp_sql_database/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml b/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml index 7e49adbc3..c57de05a5 100644 --- a/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml @@ -13,14 +13,14 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a instance +- name: Delete a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -28,14 +28,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -43,31 +43,31 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_sql_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*{{resource_name}}-2.*") | list | length == 1 + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}-2.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -75,19 +75,19 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -95,31 +95,31 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_sql_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*{{resource_name}}-2.*") | list | length == 0 + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}-2.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -127,7 +127,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_sql_instance/tasks/main.yml b/tests/integration/targets/gcp_sql_instance/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_sql_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_sql_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_sql_ssl_cert/aliases b/tests/integration/targets/gcp_sql_ssl_cert/aliases index 8189da3c4..0e4419e32 100644 --- a/tests/integration/targets/gcp_sql_ssl_cert/aliases +++ b/tests/integration/targets/gcp_sql_ssl_cert/aliases @@ -1,4 +1 @@ -cloud/gcp -# unsupported as gcp_sql_ssl_cert_info resource -# does not exist. -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml b/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml index 78528c8b0..c24746dff 100644 --- a/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml @@ -13,14 +13,14 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance +- name: Create a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -28,55 +28,72 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance -- name: delete a SSL cert +- name: Delete a non-existent SSL cert google.cloud.gcp_sql_ssl_cert: - common_name: "{{resource_name}}" - instance: "{{instance['name'}}" + common_name: "{{ resource_name }}" + instance: + name: "{{ instance['name'] }}" + sha1_fingerprint: "f572d396fae9206628714fb2ce00f72e94f2258f" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a SSL cert +- name: Create an SSL cert google.cloud.gcp_sql_ssl_cert: - common_name: "{{resource_name}}" - instance: "{{instance['name'}}" + common_name: "{{ resource_name }}" + instance: + name: "{{ instance['name'] }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - # SslCert is not altered, just verified. - - result.changed == false -- name: verify that ssl_cert was created - google.cloud.gcp_sql_ssl_cert_info: - filters: - - name = - instance: "{{instance['name'}}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin - register: results -- name: verify that command succeeded - assert: + - result.changed == true +- name: Peform a no-op update to verify the cert was created + google.cloud.gcp_sql_ssl_cert: + instance: + name: "{{ instance['name'] }}" + sha1_fingerprint: "{{ result['sha1Fingerprint'] }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + state: present + register: updates +- name: Verify that command succeeded + ansible.builtin.assert: + that: + - updates.changed == false +#---------------------------------------------------------- +- name: Delete an SSL cert + google.cloud.gcp_sql_ssl_cert: + common_name: "{{ resource_name }}" + instance: + name: "{{ instance['name'] }}" + sha1_fingerprint: "{{ result['sha1Fingerprint'] }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + state: absent + register: result +- name: Assert changed is true + ansible.builtin.assert: that: - - results['resources'] | length == 1 + - result.changed == true #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance +- name: Delete a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_sql_ssl_cert/tasks/main.yml b/tests/integration/targets/gcp_sql_ssl_cert/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_sql_ssl_cert/tasks/main.yml +++ b/tests/integration/targets/gcp_sql_ssl_cert/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_sql_user/tasks/autogen.yml b/tests/integration/targets/gcp_sql_user/tasks/autogen.yml index c655c5e36..20ddbea25 100644 --- a/tests/integration/targets/gcp_sql_user/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_user/tasks/autogen.yml @@ -13,14 +13,14 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance +- name: Create a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-1" + name: "{{ resource_name }}-1" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -28,7 +28,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance -- name: delete a user +- name: Delete a user google.cloud.gcp_sql_user: name: test-user host: 10.1.2.3 @@ -39,7 +39,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a user +- name: Create a user google.cloud.gcp_sql_user: name: test-user host: 10.1.2.3 @@ -50,25 +50,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that user was created +- name: Verify that user was created google.cloud.gcp_sql_user_info: - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'test-user' in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a user that already exists +- name: Create a user that already exists google.cloud.gcp_sql_user: name: test-user host: 10.1.2.3 @@ -79,12 +79,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a user +- name: Delete a user google.cloud.gcp_sql_user: name: test-user host: 10.1.2.3 @@ -95,25 +95,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that user was deleted +- name: Verify that user was deleted google.cloud.gcp_sql_user_info: - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'test-user' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a user that does not exist +- name: Delete a user that does not exist google.cloud.gcp_sql_user: name: test-user host: 10.1.2.3 @@ -124,21 +124,21 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance +- name: Delete a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-1" + name: "{{ resource_name }}-1" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_sql_user/tasks/main.yml b/tests/integration/targets/gcp_sql_user/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_sql_user/tasks/main.yml +++ b/tests/integration/targets/gcp_sql_user/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml b/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml index d2f58c92c..f5ccacabe 100644 --- a/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a bucket +- name: Delete a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a bucket +- name: Create a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -29,12 +29,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: create a bucket that already exists +- name: Create a bucket that already exists google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -42,12 +42,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a bucket +- name: Delete a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -55,12 +55,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: delete a bucket that does not exist +- name: Delete a bucket that does not exist google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -68,7 +68,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_storage_bucket/tasks/main.yml b/tests/integration/targets/gcp_storage_bucket/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_storage_bucket/tasks/main.yml +++ b/tests/integration/targets/gcp_storage_bucket/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml b/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml index a037a46b0..762e0f6cd 100644 --- a/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a bucket +- name: Create a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: bucket -- name: delete a bucket access control +- name: Delete a bucket access control google.cloud.gcp_storage_bucket_access_control: bucket: "{{ bucket }}" entity: user-alexstephen@google.com @@ -31,7 +31,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a bucket access control +- name: Create a bucket access control google.cloud.gcp_storage_bucket_access_control: bucket: "{{ bucket }}" entity: user-alexstephen@google.com @@ -41,12 +41,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: create a bucket access control that already exists +- name: Create a bucket access control that already exists google.cloud.gcp_storage_bucket_access_control: bucket: "{{ bucket }}" entity: user-alexstephen@google.com @@ -56,12 +56,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a bucket access control +- name: Delete a bucket access control google.cloud.gcp_storage_bucket_access_control: bucket: "{{ bucket }}" entity: user-alexstephen@google.com @@ -71,12 +71,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: delete a bucket access control that does not exist +- name: Delete a bucket access control that does not exist google.cloud.gcp_storage_bucket_access_control: bucket: "{{ bucket }}" entity: user-alexstephen@google.com @@ -86,14 +86,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a bucket +- name: Delete a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml b/tests/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml +++ b/tests/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_storage_default_object_acl/aliases b/tests/integration/targets/gcp_storage_default_object_acl/aliases index ff7eb2d4e..0e4419e32 100644 --- a/tests/integration/targets/gcp_storage_default_object_acl/aliases +++ b/tests/integration/targets/gcp_storage_default_object_acl/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported \ No newline at end of file +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml b/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml index 77197a08d..6f4368432 100644 --- a/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a bucket +- name: Create a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,74 +21,79 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: bucket -- name: delete a default object acl +- name: Delete a default object acl google.cloud.gcp_storage_default_object_acl: bucket: "{{ bucket }}" - entity: OWNER:user-alexstephen@google.com + entity: user-alexstephen@google.com + role: READER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a default object acl +- name: Create a default object acl google.cloud.gcp_storage_default_object_acl: bucket: "{{ bucket }}" - entity: OWNER:user-alexstephen@google.com + entity: user-alexstephen@google.com + role: READER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: create a default object acl that already exists +- name: Create a default object acl that already exists google.cloud.gcp_storage_default_object_acl: bucket: "{{ bucket }}" - entity: OWNER:user-alexstephen@google.com + entity: user-alexstephen@google.com + role: READER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a default object acl +- name: Delete a default object acl google.cloud.gcp_storage_default_object_acl: bucket: "{{ bucket }}" - entity: OWNER:user-alexstephen@google.com + entity: user-alexstephen@google.com + role: READER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: delete a default object acl that does not exist +- name: Delete a default object acl that does not exist google.cloud.gcp_storage_default_object_acl: bucket: "{{ bucket }}" - entity: OWNER:user-alexstephen@google.com + entity: user-alexstephen@google.com + role: READER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a bucket +- name: Delete a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_storage_default_object_acl/tasks/main.yml b/tests/integration/targets/gcp_storage_default_object_acl/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_storage_default_object_acl/tasks/main.yml +++ b/tests/integration/targets/gcp_storage_default_object_acl/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_storage_object/tasks/main.yml b/tests/integration/targets/gcp_storage_object/tasks/main.yml index e96adcd06..4d6d31f3e 100644 --- a/tests/integration/targets/gcp_storage_object/tasks/main.yml +++ b/tests/integration/targets/gcp_storage_object/tasks/main.yml @@ -1,18 +1,19 @@ --- # Pre-test setup -- name: create a temp file for uploading - tempfile: +- name: Create a temp file for uploading + ansible.builtin.tempfile: state: file register: upload_temp -- name: create a temp file for downloading - tempfile: +- name: Create a temp file for downloading + ansible.builtin.tempfile: state: file register: download_temp -- name: put content in the tempfile - copy: - content: "Ansible GCS test file" +- name: Put content in the tempfile + ansible.builtin.copy: + content: Ansible GCS test file dest: "{{ upload_temp.path }}" -- name: create a bucket + mode: 0644 +- name: Create a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,51 +22,51 @@ state: present register: bucket #---------------------------------------------------------- -- name: upload the object to gcs +- name: Upload the object to gcs google.cloud.gcp_storage_object: - action: 'upload' + action: upload bucket: "{{ bucket.name }}" src: "{{ upload_temp.path }}" - dest: "ansible/{{ resource_name }}" + dest: ansible/{{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: download the object to disk +- name: Download the object to disk google.cloud.gcp_storage_object: - action: 'download' + action: download bucket: "{{ bucket.name }}" - src: "ansible/{{ resource_name }}" + src: ansible/{{ resource_name }} dest: "{{ download_temp.path }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: delete the object +- name: Delete the object google.cloud.gcp_storage_object: - action: 'delete' + action: delete bucket: "{{ bucket.name }}" - src: "ansible/{{ resource_name }}" + src: ansible/{{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: delete the bucket +- name: Delete the bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml index 140d1f229..196aa6a9d 100644 --- a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml +++ b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml @@ -13,108 +13,108 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a node +- name: Delete a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-a - accelerator_type: "v2-32" - tensorflow_version: '2.10.0' + accelerator_type: v2-32 + tensorflow_version: 2.10.0 cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a node +- name: Create a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-a - accelerator_type: "v2-32" - tensorflow_version: '2.10.0' + accelerator_type: v2-32 + tensorflow_version: 2.10.0 cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node was created +- name: Verify that node was created google.cloud.gcp_tpu_node_info: - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a node that already exists +- name: Create a node that already exists google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-a - accelerator_type: "v2-32" - tensorflow_version: '2.10.0' + accelerator_type: v2-32 + tensorflow_version: 2.10.0 cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a node +- name: Delete a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-a - accelerator_type: "v2-32" - tensorflow_version: '2.10.0' + accelerator_type: v2-32 + tensorflow_version: 2.10.0 cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node was deleted +- name: Verify that node was deleted google.cloud.gcp_tpu_node_info: - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a node that does not exist +- name: Delete a node that does not exist google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-a - accelerator_type: "v2-32" - tensorflow_version: '2.10.0' + accelerator_type: v2-32 + tensorflow_version: 2.10.0 cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_tpu_node/tasks/main.yml b/tests/integration/targets/gcp_tpu_node/tasks/main.yml index 45d6e4917..fe47378c2 100644 --- a/tests/integration/targets/gcp_tpu_node/tasks/main.yml +++ b/tests/integration/targets/gcp_tpu_node/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml