We've recently had to add multiple security groups to an ec2 instance, but
based on the host group, it needs to be a different set of groups.
I see that you can do this by using an array list like so:
- name: launch
local_action:
module: ec2
region: us-west-2
keypair: xxxxx
group: ['mygroup1', 'mygroup2', 'mygroup3']
instance_type: t1.micro
image: ami-xxxxxx
wait: yes
wait_timeout: 3500
count: 2
instance_tags: '{"Name":"stuff"}'
register: ec2
This will work fine when hard coded, but when i replace the list with a
variable it does seem to detect the groups. What am I doing wrong?
- name: launch
local_action:
module: ec2
region: us-west-2
keypair: xxxxx
group: "{{ my_groups }}"
instance_type: t1.micro
image: ami-xxxxxx
wait: yes
wait_timeout: 3500
count: 2
instance_tags: '{"Name":"stuff"}'
register: ec2
and set my_groups as:
my_groups: ['mygroup1', 'mygroup2', 'mygroup3']
My guess is it has something to do with the quotes but if i remove it, I
get an YAML complaint, I've tried it a number of different ways without
success. Any ideas?
Thanks!
--
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/4c9b28c3-9a51-4181-a576-021cf2e0ed11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.