On Tue, Jul 22, 2014 at 3:13 PM, Michael DeHaan mich...@ansible.com wrote:
Also local_action is usually not needed in cloud provisioning tasks as
you can just have a play that talks to localhost
yeah, this was written before localhost was handled the way it is today. I
haven't gone back and
I'm having trouble setting up instance_tags in the following playbook:
vars:
key_name: mykey
instance_type: t2.micro
security_group: sg-
image: ami-f5b815e8
region: sa-east-1
subnet_id: subnet-5eab
instance_tags:
foo: bar
tasks:
- name: Launch
This might be old'ish style at this point, but this is how I do it:
- name: tag my launched instances
local_action: ec2_tag resource={{ item.id }} region={{ region }}
state=present
with_items: ec2.instances
args:
tags:
Name: {{assigned_hostname.stdout}}
That was it Brent thanks a lot! You pointed me to the right direction. I
knew the ec2_tags was an option but I'd like to place the tags in the same
call. So I followed the same structured as you proposed:
vars:
key_name: mykey
instance_type: t2.micro
security_group: sg-
You can stick absolutely everything under args if you want, might make it
feel a bit more consistent.
Also local_action is usually not needed in cloud provisioning tasks as
you can just have a play that talks to localhost
- hosts: localhost
tasks:
- ec2:
x: 1
y: 2
- ...