| 1 |
--- |
| 2 |
#################################################################### |
| 3 |
# WARNING: These are designed specifically for Ansible tests # |
| 4 |
# and should not be used as examples of how to write Ansible roles # |
| 5 |
#################################################################### |
| 6 |
|
| 7 |
# Copyright (c) Ansible Project |
| 8 |
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 9 |
# SPDX-License-Identifier: GPL-3.0-or-later |
| 10 |
|
| 11 |
- name: Create security group check |
| 12 |
check_mode: true |
| 13 |
scaleway_security_group: |
| 14 |
state: present |
| 15 |
region: '{{ scaleway_region }}' |
| 16 |
name: security_group |
| 17 |
description: 'my security group description' |
| 18 |
organization: '{{ scaleway_organization }}' |
| 19 |
stateful: false |
| 20 |
inbound_default_policy: accept |
| 21 |
outbound_default_policy: accept |
| 22 |
organization_default: false |
| 23 |
register: security_group_creation |
| 24 |
|
| 25 |
- debug: var=security_group_creation |
| 26 |
|
| 27 |
- name: Ensure security groups check facts is success |
| 28 |
assert: |
| 29 |
that: |
| 30 |
- security_group_creation is success |
| 31 |
- security_group_creation is changed |
| 32 |
|
| 33 |
- block: |
| 34 |
- name: Create security group |
| 35 |
scaleway_security_group: |
| 36 |
state: present |
| 37 |
region: '{{ scaleway_region }}' |
| 38 |
name: security_group |
| 39 |
description: 'my security group description' |
| 40 |
organization: '{{ scaleway_organization }}' |
| 41 |
stateful: false |
| 42 |
inbound_default_policy: accept |
| 43 |
outbound_default_policy: accept |
| 44 |
organization_default: false |
| 45 |
register: security_group_creation |
| 46 |
|
| 47 |
- debug: var=security_group_creation |
| 48 |
|
| 49 |
- name: Ensure security groups facts is success |
| 50 |
assert: |
| 51 |
that: |
| 52 |
- security_group_creation is success |
| 53 |
- security_group_creation is changed |
| 54 |
|
| 55 |
- name: Create security group duplicate |
| 56 |
scaleway_security_group: |
| 57 |
state: present |
| 58 |
region: '{{ scaleway_region }}' |
| 59 |
name: security_group |
| 60 |
description: 'my security group description' |
| 61 |
organization: '{{ scaleway_organization }}' |
| 62 |
stateful: false |
| 63 |
inbound_default_policy: accept |
| 64 |
outbound_default_policy: accept |
| 65 |
organization_default: false |
| 66 |
register: security_group_creation |
| 67 |
|
| 68 |
- debug: var=security_group_creation |
| 69 |
|
| 70 |
- name: Ensure security groups duplicate facts is success |
| 71 |
assert: |
| 72 |
that: |
| 73 |
- security_group_creation is success |
| 74 |
- security_group_creation is not changed |
| 75 |
|
| 76 |
- name: Delete security group check |
| 77 |
check_mode: true |
| 78 |
scaleway_security_group: |
| 79 |
state: absent |
| 80 |
region: '{{ scaleway_region }}' |
| 81 |
name: security_group |
| 82 |
description: 'my security group description' |
| 83 |
organization: '{{ scaleway_organization }}' |
| 84 |
stateful: false |
| 85 |
inbound_default_policy: accept |
| 86 |
outbound_default_policy: accept |
| 87 |
organization_default: false |
| 88 |
register: security_group_deletion |
| 89 |
|
| 90 |
- debug: var=security_group_deletion |
| 91 |
|
| 92 |
- name: Ensure security groups delete check facts is success |
| 93 |
assert: |
| 94 |
that: |
| 95 |
- security_group_deletion is success |
| 96 |
- security_group_deletion is changed |
| 97 |
|
| 98 |
always: |
| 99 |
- name: Delete security group |
| 100 |
scaleway_security_group: |
| 101 |
state: absent |
| 102 |
region: '{{ scaleway_region }}' |
| 103 |
name: security_group |
| 104 |
description: 'my security group description' |
| 105 |
organization: '{{ scaleway_organization }}' |
| 106 |
stateful: false |
| 107 |
inbound_default_policy: accept |
| 108 |
outbound_default_policy: accept |
| 109 |
organization_default: false |
| 110 |
register: security_group_deletion |
| 111 |
|
| 112 |
- debug: var=security_group_deletion |
| 113 |
|
| 114 |
- name: Ensure security groups delete facts is success |
| 115 |
assert: |
| 116 |
that: |
| 117 |
- security_group_deletion is success |
| 118 |
- security_group_deletion is changed |
| 119 |
|
| 120 |
- name: Delete security group duplicate |
| 121 |
scaleway_security_group: |
| 122 |
state: absent |
| 123 |
region: '{{ scaleway_region }}' |
| 124 |
name: security_group |
| 125 |
description: 'my security group description' |
| 126 |
organization: '{{ scaleway_organization }}' |
| 127 |
stateful: false |
| 128 |
inbound_default_policy: accept |
| 129 |
outbound_default_policy: accept |
| 130 |
organization_default: false |
| 131 |
register: security_group_deletion |
| 132 |
|
| 133 |
- debug: var=security_group_deletion |
| 134 |
|
| 135 |
- name: Ensure security groups delete duplicate facts is success |
| 136 |
assert: |
| 137 |
that: |
| 138 |
- security_group_deletion is success |
| 139 |
- security_group_deletion is not changed |