Skip to content

Commit d8f1877

Browse files
committed
Work around upstream bug
#26 skip if SG exists and has right number of rules Working around more problems w/ the ibmcloud ansible collection get rules from vpc.security_group var
1 parent d117409 commit d8f1877

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

create.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979

8080
- name: Print IBM Cloud Instance Floating IPs
8181
debug:
82-
msg:
82+
msg:
8383
- "IC instance Floating IP: "
8484
- "{{ ibmcloud_vsi_node }}"
8585

@@ -143,12 +143,12 @@
143143

144144
- name: Add VM's to Isolated group
145145
include_role:
146-
name: add_iso_hosts
146+
name: add_iso_hosts
147147
when: install_tower | default('True') | bool
148148

149149
- name: Print IBM Cloud Instance Floating IPs
150150
debug:
151-
msg:
151+
msg:
152152
- "IC instance Floating IP: "
153153
- "Isolated Nodes: {{ iso_node }}"
154154

@@ -239,7 +239,7 @@
239239
- name: Fetch the tower vars file
240240
include_vars:
241241
file: tower_vars.yml
242-
242+
243243
- name: Fetch the vaulted variables
244244
include_vars:
245245
file: config/credential.vault

create_vsi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
target: "{{ vsi.primary_network_interface[0]['id'] }}"
3030
register: fip_create_output
3131

32-
- name: Save Floating IPs
32+
- name: Save Floating IPs
3333
set_fact:
3434
cacheable: True
3535
ibmcloud_vsi_node: "{{ ibmcloud_vsi_node|default([]) + [fip_create_output.resource.address] }}"

roles/configure_security_group/tasks/main.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
2-
- name: "Configure Security Group Rule to open certain ports on the VSI"
2+
- debug:
3+
var: vpc.security_group
4+
5+
- name: "Configure Security Group Rule to open certain ports on the VSI when they don't exist"
36
ibm.cloudcollection.ibm_is_security_group_rule:
47
state: available
58
group: "{{ vpc.default_security_group }}"
@@ -10,6 +13,7 @@
1013
- port_max: "{{ item }}"
1114
port_min: "{{ item }}"
1215
loop: "{{ list_of_ports }}"
16+
when: vpc.security_group[0].rules|length < list_of_ports|length
1317

1418
- name: "Configure Security Group Rule to open icmp on the VSI"
1519
ibm.cloudcollection.ibm_is_security_group_rule:
@@ -20,3 +24,4 @@
2024
remote: 0.0.0.0/0
2125
icmp:
2226
- type: 8
27+
when: vpc.security_group[0].rules|length < list_of_ports|length

0 commit comments

Comments
 (0)