Hi,
I have the following Playbook for launching ec2 instances in different AZs
---
- hosts: localhost
connection: local
gather_facts: False
vars_files:
- ebs-aws/external_vars.yml
tasks:
- name: EC2 basic provisioning
ec2:
region: "us-east-1"
key_name: mykey
aws_access_key: "{{ ec2_access_key }}"
aws_secret_key: "{{ ec2_secret_key }}"
instance_type: m3.2xlarge
image: ami-c21439aa
wait: yes
group: mygrp
instance_tags:
Name: low_zoom_1_1_0
count: "{{ item.count }}"
count_tag:
Name: low_zoom_1_1_0
user_data: |
#!/bin/bash
/bin/sed '56d' -i /etc/sudoers
zone: "{{ item.zone }}"
with_items:
- "{{ ec2_hosts }}"
register: ec2
- debug: var=ec2
- name: Add instances to host group
add_host: name={{ item.public_ip }} groupname=low_zoom
with_items: ec2.result.instances
- name: Wait for SSH to come up
wait_for: host={{item.public_dns_name }} port=22 delay=60 timeout=320 state=started
with_items: ec2.result.instances
- name: Print out instance id
debug: msg="{{
item.id }}"
with_items: ec2.result.instances
ebs-aws/external_vars.yml
ec2_hosts:
- zone: us-east-1a
count: 1
- zone: us-east-1c
count: 1
Instances are launched correctly but i get the following when adding instances to the host group
TASK [Add instances to host group] *********************************************
[DEPRECATION WARNING]: Skipping task due to undefined attribute, in the future this will be a fatal error.. This feature will be removed in a future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
skipping: [127.0.0.1] => {"changed": false, "results": [], "skipped": true, "skipped_reason": "No items in the list"}
Following is the data structure on the debug: var=ec2
http://pastie.org/10426082What am i doing wrong.
Regards,
Kevin