Try this:

- name: Create a VPC
  local_action:
    module: ec2_vpc
    state: present
    cidr_block: 10.0.0.0/16
    resource_tags: { "Environment": "Development" }
    subnets:
      - cidr: 10.0.0.0/24
        az: us-east-1a
        resource_tags: { "Environment":"Development", "Name" : "Public 
Subnet" }
      - cidr: 10.0.1.0/24
        az: us-east-1b
        resource_tags: { "Environment":"Development", "Name" : "Private 
Subnet A" }
      - cidr: 10.0.2.0/24
        az: us-east-1d
        resource_tags: { "Environment":"Development", "Name" : "Private 
Subnet B" }
    wait: yes
    region: us-east-1
    internet_gateway: yes
  register: vpc



On Friday, 6 February 2015 21:57:44 UTC+1, Rahul Mehrotra wrote:
>
> Hi Everyone,
> I am trying to create a VPC using Ansible however I am having trouble in 
> tagging resoruces
>
> - name: Create a VPC
>       register: vpc
>       ec2_vpc:
>         state: present
>         cidr_block: 10.0.0.0/16
> #        resource_tags: { Environmenti: Development }
>         subnets:
>         - cidr: 10.0.0.0/24
>           az: us-east-1a
>           resource_tags:
>             Name: Development Public Subnet
>         - cidr: 10.0.1.0/24
>           az: us-east-1b
>           resource_tags:
>             Name: Development Private Subnet A
>         - cidr: 10.0.2.0/24
>           az: us-east-1d
>           resource_tags:
>             Name: Development Private Subnet B
>         wait: yes
>         region: us-east-1
>         internet_gateway: yes
>
>
>
> With the above code getting executed successfully, still the subnets dont 
> have the Tag of " Name ", the Tag gets created but its value remains empty
>
>
> Also If I try to tag the VPC, I get the following error with the below code
>
> - name: Create a VPC
>       register: vpc
>       ec2_vpc:
>         state: present
>         cidr_block: 10.0.0.0/16
>         resource_tags: { Environmenti: Development }
>         subnets:
>         - cidr: 10.0.0.0/24
>           az: us-east-1a
>           resource_tags:
>             Name: Development Public Subnet
>         - cidr: 10.0.1.0/24
>           az: us-east-1b
>           resource_tags:
>             Name: Development Private Subnet A
>         - cidr: 10.0.2.0/24
>           az: us-east-1d
>           resource_tags:
>             Name: Development Private Subnet B
>         wait: yes
>         region: us-east-1
>         internet_gateway: yes
>
>
> PLAY [local] 
> ****************************************************************** 
>
> TASK: [Create a VPC] 
> ********************************************************** 
> failed: [localhost] => {"failed": true}
> msg: unsupported parameter for module: resource_tags
>
> FATAL: all hosts have already failed -- aborting
>
> PLAY RECAP 
> ******************************************************************** 
>            to retry, use: --limit @/root/main.retry
>
>
> Can anyone point out what I am doing wrong.Thank you :)
>
>

-- 
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/58284fb9-eaf7-458c-8a72-b858f356d543%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to