Hi,
Sorry for a bit of a noobish question, but I am provisioning some instances in ec2, and I can successfully create and tag the instances in my provision playbook.
However, later I try and add a tag to exiting hosts based on a tag_Name, but I cannot seem to get the resource-id’s I need for ec2_tag.
Example
`
The ec2 (and hence the ec2.instance) variable is not defined in this
scope, it only exists after the task responsible for creating a new
instance is completed successfully.
To tag existing instances with hosts from EC2, you can use the ec2_id
variable defined by the aws dynamic inventory script. For example:
Thanks! that did the trick!
Are these variables documented anywhere in detail?
Thanks
/K
I think those variables are documented in the ec2 dynamic inventory
script. I don't now if there's a way to only add a tag, but you could
try using a different group in your hosts line, e.g., try selecting
your hosts based in another tag value besides Name. Or you may be able
to limit this task with a "when" clause using variables defined by the
ec2 script, but I never tested this.