Hi,

I am getting facts from the ec2_vpc_net_facts module which I'm trying to 
grab the vpc-id from the output and use it as a variable to create a 
security group. This seems that it should be easy enough and I've read that 
ansible creates variables automatically but the example that I found 
doesn't not seem to work here. I thought I'd post here to see if someone 
else has done this sort of thing.

Thanks so much,
Ladean

---- main.yml

- name: get vpc_id
  ec2_vpc_net_facts:
    region: "{{ region }}"
    filters:
      "tag:Name": Svpc

- debug:
    var=ansible_ec2_vpc_vpc_id

- name: Create VPC Security Groups
  ec2_group:
    state: present
    name: "{{ env }}sshIn"
    description: allow ssh in from any
    region: "{{ region }}"
    vpc_id: "{{ ansible_ec2_vpc_vpc_id }}"
    rules:
      - proto: tcp
        cidr_ip: x.x.x.x/x
        to_port: 22

---- results

TASK [awsvpc : get vpc_id] 
*****************************************************
ok: [localhost]

TASK [awsvpc : debug] 
**********************************************************
ok: [localhost] => {
    "ansible_ec2_vpc.vpcs_id": "VARIABLE IS NOT DEFINED!"
}

TASK [awsvpc : Create VPC Security Groups] 
*************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": 
"'ansible_ec2_vpc_vpc_id' is undefined"}

-- 
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/3e92777c-013b-4b31-8e5e-a5ff380ea900%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to