ansible/test/integration/targets/gcp_container_node_pool/tasks/main.yml

126 lines
4 KiB
YAML
Raw Normal View History

---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file at
# https://www.github.com/GoogleCloudPlatform/magic-modules
#
# ----------------------------------------------------------------------------
# Pre-test setup
- name: create a cluster
gcp_container_cluster:
name: 'cluster-nodepool'
initial_node_count: 4
zone: 'us-central1-a'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
state: present
register: cluster
- name: delete a node pool
gcp_container_node_pool:
name: "{{ resource_name }}"
initial_node_count: 4
cluster: "{{ cluster }}"
zone: 'us-central1-a'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
state: absent
#----------------------------------------------------------
- name: create a node pool
gcp_container_node_pool:
name: "{{ resource_name }}"
initial_node_count: 4
cluster: "{{ cluster }}"
zone: 'us-central1-a'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
state: present
register: result
- name: assert changed is true
assert:
that:
- result.changed == true
# ----------------------------------------------------------------------------
- name: create a node pool that already exists
gcp_container_node_pool:
name: "{{ resource_name }}"
initial_node_count: 4
cluster: "{{ cluster }}"
zone: 'us-central1-a'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
state: present
register: result
- name: assert changed is false
assert:
that:
- result.changed == false
#----------------------------------------------------------
- name: delete a node pool
gcp_container_node_pool:
name: "{{ resource_name }}"
initial_node_count: 4
cluster: "{{ cluster }}"
zone: 'us-central1-a'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
state: absent
register: result
- name: assert changed is true
assert:
that:
- result.changed == true
# ----------------------------------------------------------------------------
- name: delete a node pool that does not exist
gcp_container_node_pool:
name: "{{ resource_name }}"
initial_node_count: 4
cluster: "{{ cluster }}"
zone: 'us-central1-a'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
state: absent
register: result
- name: assert changed is false
assert:
that:
- result.changed == false
#---------------------------------------------------------
# Post-test teardown
- name: delete a cluster
gcp_container_cluster:
name: 'cluster-nodepool'
initial_node_count: 4
zone: 'us-central1-a'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
state: absent
register: cluster