Hi,
I am trying to use instance_tags from ec2 module and I am not able to figure out the right syntaxe.
I tried:
ec2_instance_tags: ‘{“Name”: “test”}’
ec2_instance_tags:
Name: test
and still no luck to find right format for:
a hash/dictionary of tags, in quoted json format, to add to the new instance
Thanks
Filip
Hi Filip,
Like this:
instance_tags=‘{“my”:“stuff”}’
It looks like your space is the issue ": " - we should fix that.
Thanks!
Problem was with the space.
This one doesn’t work (space between ‘: "’):
instance_tags=‘{“my”: “stuff”}’
This one work
instance_tags=‘{“my”:“stuff”}’
I think it’s kind of confusing. For json dump in console: space is ok
n [3]: json.dumps({“Name”: “test”})
Out[3]: ‘{“Name”: “test”}’
Filip
We were thinking *possibly* the module could 'fix' spaces for you, but
maybe there is a better easier syntax we could use instead.
instance_tags='key=value,key=value,key=value'
would technically work with shlex, wouldn't it?
Do tags ever need to have nested datastructures?
That would be much more user friendly. Correct, tags are never nested, it’s always key=value.
That would be much more user friendly. Correct, tags are never nested, it's
always key=value.
I tend to feel few people are passing instance tags now, so I'm ok
with changing it work that way if you are?
We could possibly also look for a "{" and if so do it it the old way,
but that's up to you.
Yup, I think changing it to this format is fine.