I am having a strange issue 

I have a role that looks like the following

# roles/ec2_sg/tasks/main
- name: Create Security Group
  ec2_group:
    profile: "{{ profile }}"
    name:  "{{ type }}"
    description: "ports required to communicate to {{ type }}"
    vpc_id: "{{ aws_vpc_id }}"
    region: "{{ aws_region }}"
    rules: "{{ sg_rules }}"


When I have the following playbook it fails with the following error

- hosts: localhost
  connection: local
  gather_facts: false
  vars_files:
    - group_vars/{{ env }}
  tags:
    - test
  roles:
    - role: ec2_sg
      type: "test"
      sg_rules:
        - proto: tcp
          from_port: 8081
          to_port: 8082
          cidr_ip: "{{ public_cidr }}"

TASK: [ec2_sg | Create Security Group] 
****************************************
fatal: [localhost] => Failed to template {% if [{'to_port': 8082, 
'from_port': 8081, 'cidr_ip': u'0.0.0.0/0', 'proto': 'tcp'}] %} True {% 
else %} False {% endif %}: template error while templating string: expected 
token ',', got 'string'

FATAL: all hosts have already failed -- aborting

but if I do it works. 

- hosts: localhost
  connection: local
  gather_facts: false
  vars_files:
    - group_vars/{{ env }}
  vars:
    type: "test"
    sg_rules:
        - proto: tcp
          from_port: 8081
          to_port: 8082
          cidr_ip: "{{ public_cidr }}"
  tags:
    - test
  roles:
    - role: ec2_sg
      type: "test"


It really makes no sense. Does anyone have any idea what is happening?

Appreciate the help in advance.

Cheers,

Edgardo

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/74b0b04b-b0fd-434a-9a0d-3a53923498e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to