| 1 |
--- |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
- name: Delete a address |
| 17 |
google.cloud.gcp_compute_address: |
| 18 |
name: test-address1 |
| 19 |
region: us-west1 |
| 20 |
project: "{{ gcp_project }}" |
| 21 |
auth_kind: "{{ gcp_cred_kind }}" |
| 22 |
service_account_file: "{{ gcp_cred_file | default(omit) }}" |
| 23 |
state: absent |
| 24 |
|
| 25 |
- name: Create a address |
| 26 |
google.cloud.gcp_compute_address: |
| 27 |
name: test-address1 |
| 28 |
region: us-west1 |
| 29 |
project: "{{ gcp_project }}" |
| 30 |
auth_kind: "{{ gcp_cred_kind }}" |
| 31 |
service_account_file: "{{ gcp_cred_file | default(omit) }}" |
| 32 |
state: present |
| 33 |
register: result |
| 34 |
- name: Assert changed is true |
| 35 |
ansible.builtin.assert: |
| 36 |
that: |
| 37 |
- result.changed == true |
| 38 |
- name: Verify that address was created |
| 39 |
google.cloud.gcp_compute_address_info: |
| 40 |
filters: |
| 41 |
- name = test-address1 |
| 42 |
region: us-west1 |
| 43 |
project: "{{ gcp_project }}" |
| 44 |
auth_kind: "{{ gcp_cred_kind }}" |
| 45 |
service_account_file: "{{ gcp_cred_file | default(omit) }}" |
| 46 |
scopes: |
| 47 |
- https://www.googleapis.com/auth/compute |
| 48 |
register: results |
| 49 |
- name: Verify that command succeeded |
| 50 |
ansible.builtin.assert: |
| 51 |
that: |
| 52 |
- results['resources'] | length == 1 |
| 53 |
|
| 54 |
- name: Create a address that already exists |
| 55 |
google.cloud.gcp_compute_address: |
| 56 |
name: test-address1 |
| 57 |
region: us-west1 |
| 58 |
project: "{{ gcp_project }}" |
| 59 |
auth_kind: "{{ gcp_cred_kind }}" |
| 60 |
service_account_file: "{{ gcp_cred_file | default(omit) }}" |
| 61 |
state: present |
| 62 |
register: result |
| 63 |
- name: Assert changed is false |
| 64 |
ansible.builtin.assert: |
| 65 |
that: |
| 66 |
- result.changed == false |
| 67 |
|
| 68 |
- name: Delete a address |
| 69 |
google.cloud.gcp_compute_address: |
| 70 |
name: test-address1 |
| 71 |
region: us-west1 |
| 72 |
project: "{{ gcp_project }}" |
| 73 |
auth_kind: "{{ gcp_cred_kind }}" |
| 74 |
service_account_file: "{{ gcp_cred_file | default(omit) }}" |
| 75 |
state: absent |
| 76 |
register: result |
| 77 |
- name: Assert changed is true |
| 78 |
ansible.builtin.assert: |
| 79 |
that: |
| 80 |
- result.changed == true |
| 81 |
- name: Verify that address was deleted |
| 82 |
google.cloud.gcp_compute_address_info: |
| 83 |
filters: |
| 84 |
- name = test-address1 |
| 85 |
region: us-west1 |
| 86 |
project: "{{ gcp_project }}" |
| 87 |
auth_kind: "{{ gcp_cred_kind }}" |
| 88 |
service_account_file: "{{ gcp_cred_file | default(omit) }}" |
| 89 |
scopes: |
| 90 |
- https://www.googleapis.com/auth/compute |
| 91 |
register: results |
| 92 |
- name: Verify that command succeeded |
| 93 |
ansible.builtin.assert: |
| 94 |
that: |
| 95 |
- results['resources'] | length == 0 |
| 96 |
|
| 97 |
- name: Delete a address that does not exist |
| 98 |
google.cloud.gcp_compute_address: |
| 99 |
name: test-address1 |
| 100 |
region: us-west1 |
| 101 |
project: "{{ gcp_project }}" |
| 102 |
auth_kind: "{{ gcp_cred_kind }}" |
| 103 |
service_account_file: "{{ gcp_cred_file | default(omit) }}" |
| 104 |
state: absent |
| 105 |
register: result |
| 106 |
- name: Assert changed is false |
| 107 |
ansible.builtin.assert: |
| 108 |
that: |
| 109 |
- result.changed == false |