---
- name: "Create AWS SecurityGroup (CNS)"
  ec2_group:
    name: "cns"
    description: "cns"
    purge_rules: false
    purge_rules_egress: false
    region: "{{ aws_region }}"
    vpc_id: "{{ vpc.vpc.id }}"
  register: sgcns

- name: "Creating AWS SecurityGroup rules (CNS)"
  ec2_group:
    name: "cns"
    description: "cns"
    region: "{{ aws_region }}"
    vpc_id: "{{ vpc.vpc.id }}"
    rules:
      - proto: tcp
        from_port: 111
        to_port: 111
        group_name: "cns"
      - proto: tcp
        from_port: 2222
        to_port: 2222
        group_name: "cns"
      - proto: tcp
        from_port: 3260
        to_port: 3260
        group_name: "cns"
      - proto: tcp
        from_port: 3260
        to_port: 3260
        group_name: "node"
      - proto: tcp
        from_port: 24007
        to_port: 24008
        group_name: "cns"
      - proto: tcp
        from_port: 24007
        to_port: 24008
        group_name: "node"
      - proto: tcp
        from_port: 24010
        to_port: 24010
        group_name: "cns"
      - proto: tcp
        from_port: 24010
        to_port: 24010
        group_name: "node"
      - proto: tcp
        from_port: 49152
        to_port: 49664
        group_name: "cns"
      - proto: tcp
        from_port: 49152
        to_port: 49664
        group_name: "node"
      - proto: udp
        from_port: 111
        to_port: 111
        group_name: "cns"
