summaryrefslogtreecommitdiff
path: root/test/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'test/legacy')
-rw-r--r--test/legacy/roles/scaleway_security_group_rule/tasks/main.yml57
1 files changed, 38 insertions, 19 deletions
diff --git a/test/legacy/roles/scaleway_security_group_rule/tasks/main.yml b/test/legacy/roles/scaleway_security_group_rule/tasks/main.yml
index 606b0c6034..812ef1f506 100644
--- a/test/legacy/roles/scaleway_security_group_rule/tasks/main.yml
+++ b/test/legacy/roles/scaleway_security_group_rule/tasks/main.yml
@@ -1,13 +1,20 @@
-# SCW_API_KEY='XXX' SCW_SG='GGG' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_security_group_rule
+# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_security_group_rule
-- name: Set security group fact
- set_fact:
- security_group: "{{ lookup('env','SCW_SG') }}"
-- name: Check if SCW_SG is defined
- debug:
- msg: "SCW_SG env variable is required"
- failed_when: security_group == ""
+- name: Create a scaleway security_group
+ scaleway_security_group:
+ state: present
+ region: '{{ scaleway_region }}'
+ name: test_compute
+ description: test_compute
+ organization: '{{ scaleway_organization }}'
+ stateful: true
+ inbound_default_policy: accept
+ outbound_default_policy: accept
+ organization_default: false
+ register: security_group
+
+- debug: var=security_group
- name: Create security_group_rule check
check_mode: true
@@ -19,7 +26,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_creation_task
- debug: var=security_group_rule_creation_task
@@ -39,7 +46,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_creation_task
- debug: var=security_group_rule_creation_task
@@ -58,7 +65,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_creation_task
- debug: var=security_group_rule_creation_task
@@ -78,7 +85,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_deletion_task
- debug: var=security_group_rule_deletion_task
@@ -98,7 +105,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_deletion_task
- debug: var=security_group_rule_deletion_task
@@ -117,7 +124,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_deletion_task
- debug: var=security_group_rule_deletion_task
@@ -137,7 +144,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_creation_task
- debug: var=security_group_rule_creation_task
@@ -156,7 +163,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_creation_task
- debug: var=security_group_rule_creation_task
@@ -176,7 +183,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_deletion_task
- debug: var=security_group_rule_deletion_task
@@ -196,7 +203,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_deletion_task
- debug: var=security_group_rule_deletion_task
@@ -215,7 +222,7 @@
ip_range: '{{ ip_range }}'
direction: '{{ direction }}'
action: '{{ action }}'
- security_group: '{{ security_group }}'
+ security_group: '{{ security_group.scaleway_security_group.id }}'
register: security_group_rule_deletion_task
- debug: var=security_group_rule_deletion_task
@@ -224,3 +231,15 @@
that:
- security_group_rule_deletion_task is success
- security_group_rule_deletion_task is not changed
+
+- name: Delete scaleway security_group
+ scaleway_security_group:
+ state: absent
+ region: '{{ scaleway_region }}'
+ name: test_compute
+ description: test_compute
+ organization: '{{ scaleway_organization }}'
+ stateful: true
+ inbound_default_policy: accept
+ outbound_default_policy: accept
+ organization_default: false \ No newline at end of file