Skip to content
Snippets Groups Projects
Select Git revision
  • 4bbc535c2338826b53cfd6d12c385b1ec446c6c2
  • master default protected
2 results

README.md

Blame
  • 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 }}'