launch ec2 instance without instance_ids

17 views
Skip to first unread message

Pavel Barmotin

unread,
Apr 6, 2015, 8:43:40 AM4/6/15
to ansible...@googlegroups.com
Hello Guys, 
I want run stopped ec2 instance using count_tag and exact_count and not using instance_ids.

- name: launch ec2 instance
  ec2:
    instance_type: m3.medium
    key_name: "{{ec2_key}}"
    group: web
    image: "{{ec2_ami}}"
    vpc_subnet_id: subnet-8c16c0d5
    instance_tags:
      Name: "{{ec2_hostname}}"
    exact_count: 1
    count_tag:
      Name: "{{ec2_hostname}}"
    region: eu-west-1
    wait: yes
    assign_public_ip: yes
    aws_access_key: "{{aws_access_key}}"
    aws_secret_key: "{{aws_secret_key}}"
    #state: running
  register: ec2
  always_run: yes


using count_tag and exact_count working properly, but it conflict with state. 
If I run playbook when instance stopped - I get new instance. 

How to resolve my issue?
Thanks
Reply all
Reply to author
Forward
0 new messages