Select Git revision
main.yaml 791 B
# create a security group
- name: Create a security group
os_security_group:
name: '{{ item.name }}'
description: '{{ item.description }}'
state: present
loop: '{{ security_groups }}'
- name: Create a list of security group names
set_fact:
sg_names: '{{ sg_names|default([]) + [ item.name ] }}'
loop: '{{ security_groups }}'
- debug:
msg: "Security group(s) {{ sg_names }} has been created. "
# create security group rules
- name: Create security group rules
os_security_group_rule:
security_group: '{{ item.name }}'
protocol: '{{ item.protocol }}'
port_range_min: '{{ item.port_range_min }}'
port_range_max: '{{ item.port_range_max }}'
remote_ip_prefix: '{{ item.remote_ip_prefix }}'
state: present
loop: '{{ security_groups }}'