mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-11 05:10:27 -07:00
fix: upgrade ansible version, address test and lint errors
This commit is contained in:
parent
c15b47250d
commit
08ada5354d
216 changed files with 4394 additions and 4262 deletions
.github/workflows
ansible-integration-tests.ymlansible-test.ymlautomationhub.ymlgcloud.ymlgcsfuse.ymlpythonpublish.yml
CONTRIBUTING.mdchangelogs
galaxy.ymlmeta
molecule
plugins/modules
roles
gcloud/tasks
gcp_http_lb
gcsfuse/tasks
tests/integration/targets
gcp_appengine_firewall_rule
gcp_bigquery_dataset/tasks
gcp_bigquery_table/tasks
gcp_bigtable_instance/tasks
gcp_cloudbuild_trigger/defaults
gcp_cloudfunctions_cloud_function/tasks
gcp_cloudscheduler_job/tasks
gcp_cloudtasks_queue/tasks
gcp_compute_address/tasks
gcp_compute_autoscaler/tasks
gcp_compute_backend_bucket/tasks
gcp_compute_backend_service/tasks
gcp_compute_disk/tasks
gcp_compute_external_vpn_gateway/tasks
gcp_compute_firewall/tasks
gcp_compute_forwarding_rule/tasks
gcp_compute_global_address/tasks
gcp_compute_global_forwarding_rule/tasks
gcp_compute_health_check/tasks
gcp_compute_http_health_check/tasks
gcp_compute_https_health_check/tasks
gcp_compute_image/tasks
gcp_compute_instance/tasks
gcp_compute_instance_group/tasks
gcp_compute_instance_group_manager/tasks
gcp_compute_instance_template/tasks
gcp_compute_interconnect_attachment/defaults
gcp_compute_managed_ssl_certificate/defaults
gcp_compute_network/tasks
gcp_compute_network_endpoint_group/tasks
gcp_compute_node_group/tasks
gcp_compute_node_template/tasks
17
.github/workflows/ansible-integration-tests.yml
vendored
17
.github/workflows/ansible-integration-tests.yml
vendored
|
@ -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
|
||||
run: ansible-test integration -v --color --python 3.9 --venv-system-site-packages
|
||||
|
|
7
.github/workflows/ansible-test.yml
vendored
7
.github/workflows/ansible-test.yml
vendored
|
@ -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"
|
||||
run: ansible-test units -v --color --python "$PYTHON_VERSION"
|
||||
|
|
32
.github/workflows/automationhub.yml
vendored
32
.github/workflows/automationhub.yml
vendored
|
@ -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/
|
||||
|
|
15
.github/workflows/gcloud.yml
vendored
15
.github/workflows/gcloud.yml
vendored
|
@ -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
|
||||
|
|
3
.github/workflows/gcsfuse.yml
vendored
3
.github/workflows/gcsfuse.yml
vendored
|
@ -1,4 +1,5 @@
|
|||
name: "google.cloud.gcsfuse"
|
||||
---
|
||||
name: google.cloud.gcsfuse
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
|
|
32
.github/workflows/pythonpublish.yml
vendored
32
.github/workflows/pythonpublish.yml
vendored
|
@ -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
|
||||
|
|
|
@ -21,7 +21,7 @@ git clone <url> $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
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
minor_changes:
|
||||
- ansible-test - add support for GCP application default credentials (https://github.com/ansible-collections/google.cloud/issues/359).
|
||||
- ansible-test - add support for GCP application default credentials (https://github.com/ansible-collections/google.cloud/issues/359).
|
||||
|
|
4
changelogs/fragments/gcp_serviceusage_service.yml
Normal file
4
changelogs/fragments/gcp_serviceusage_service.yml
Normal file
|
@ -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
|
3
changelogs/fragments/gcp_sql_ssl_cert.yml
Normal file
3
changelogs/fragments/gcp_sql_ssl_cert.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
minor_changes:
|
||||
- gcp_sql_ssl_cert - made sha1_fingerprint optional, which enables resource creation
|
3
changelogs/fragments/gcp_storage_default_object_acl.yml
Normal file
3
changelogs/fragments/gcp_storage_default_object_acl.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
minor_changes:
|
||||
- gcp_storage_default_object_acl - removed non-existent fields; the resource is not usable.
|
6
changelogs/fragments/upgrade-versions.yml
Normal file
6
changelogs/fragments/upgrade-versions.yml
Normal file
|
@ -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
|
20
galaxy.yml
20
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 <email> (url)
|
||||
# @nicks:irc/im.site#channel'
|
||||
authors:
|
||||
- Google <alexstephen@google.com>
|
||||
- Google <yusuketsutsumi@google.com>
|
||||
|
||||
- Google <alexstephen@google.com>
|
||||
- Google <yusuketsutsumi@google.com>
|
||||
|
||||
### 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
requires_ansible: '>=2.14.0'
|
||||
requires_ansible: ">=2.14.0"
|
||||
|
||||
action_groups:
|
||||
gcp:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -88,7 +88,10 @@ options:
|
|||
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 @@ sha1Fingerprint:
|
|||
- 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:
|
||||
|
|
|
@ -60,11 +60,6 @@ options:
|
|||
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 @@ options:
|
|||
* 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 @@ entityId:
|
|||
- 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'),
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
- name: Test gcp_http_lb role
|
||||
hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- gcp_http_lb
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
---
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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:
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_tasks: autogen.yml
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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 }}"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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 }}"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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 }}"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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 }}"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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 }}"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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 }}"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_tasks: autogen.yml
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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) }}"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- include_tasks: autogen.yml
|
||||
- name: Generated tests
|
||||
ansible.builtin.include_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
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue