In my playbook yaml file I had something like:
vars:
vpc: {id: vpc-12345, net: 10.0.0.0/16}
and it worked when I referenced it:
- name: Launch instance
local_action:
module: ec2
vpc_subnet_id: ‘{{vpc.id}}’
I want to move these variables into dev- and prod-specific hosts file vars so I tried:
[local]
vpc = {id: subnet-12345, net: 10.0.0.0/16}
and even variations like:
vpc = ‘{{ { id = subnet-12345, net = 10.0.0.0/16 } }}’
but in my play this is being seen as a string (or unicode, respectively) and generating errors: “‘str object’ has no attribute ‘id’”, or “‘unicode object’ has no attribute id”
Is there a way to set these host vars to dicts (or other objects) in these ini-style host files? Or am I limited to simple strings?
Thanks.