Skip to content

Instantly share code, notes, and snippets.

@tsturzl
Forked from mrbaboon/output.py
Last active December 3, 2015 23:13
Show Gist options
  • Save tsturzl/982af96928743a9bf776 to your computer and use it in GitHub Desktop.
Save tsturzl/982af96928743a9bf776 to your computer and use it in GitHub Desktop.
{
"changed": false,
"ec2_gunicorn_az1_out": {
"changed": false,
"msg": "All items completed",
"results": [
{
"_ansible_no_log": false,
"changed": false,
"instance_ids": null,
"instances": [],
"invocation": {
"module_args": {
"assign_public_ip": false,
"count_tag": {
"Counter": "staging_gunicorn-sub1"
},
"exact_count": 2,
"group": "staging_gunicorn",
"image": "ami-61bbf104",
"instance_tags": {
"Counter": "staging_gunicorn-sub1",
"Name": "staging_gunicorn"
},
"instance_type": "t2.medium",
"key_name": "telmediq-staging",
"region": "us-east-1",
"source_dest_check": false,
"vpc_subnet_id": "subnet-ba8e4ecc",
"wait": true
},
"module_name": "ec2"
},
"item": "subnet-ba8e4ecc",
"tagged_instances": [
{
"ami_launch_index": "1",
"architecture": "x86_64",
"block_device_mapping": {
"/dev/sda1": {
"delete_on_termination": false,
"status": "attached",
"volume_id": "vol-808ffe63"
}
},
"dns_name": "",
"ebs_optimized": false,
"groups": {
"sg-fbb9949d": "staging_gunicorn"
},
"hypervisor": "xen",
"id": "i-b630ef00",
"image_id": "ami-61bbf104",
"instance_type": "t2.medium",
"kernel": null,
"key_name": "telmediq-staging",
"launch_time": "2015-12-03T21:56:46.000Z",
"placement": "us-east-1a",
"private_dns_name": "ip-10-50-50-183.ec2.internal",
"private_ip": "10.50.50.183",
"public_dns_name": "",
"public_ip": null,
"ramdisk": null,
"region": "us-east-1",
"root_device_name": "/dev/sda1",
"root_device_type": "ebs",
"state": "running",
"state_code": 16,
"tags": {
"Counter": "staging_gunicorn-sub1",
"Name": "staging_gunicorn"
},
"tenancy": "default",
"virtualization_type": "hvm"
},
{
"ami_launch_index": "0",
"architecture": "x86_64",
"block_device_mapping": {
"/dev/sda1": {
"delete_on_termination": false,
"status": "attached",
"volume_id": "vol-968ffe75"
}
},
"dns_name": "",
"ebs_optimized": false,
"groups": {
"sg-fbb9949d": "staging_gunicorn"
},
"hypervisor": "xen",
"id": "i-b530ef03",
"image_id": "ami-61bbf104",
"instance_type": "t2.medium",
"kernel": null,
"key_name": "telmediq-staging",
"launch_time": "2015-12-03T21:56:46.000Z",
"placement": "us-east-1a",
"private_dns_name": "ip-10-50-50-184.ec2.internal",
"private_ip": "10.50.50.184",
"public_dns_name": "",
"public_ip": null,
"ramdisk": null,
"region": "us-east-1",
"root_device_name": "/dev/sda1",
"root_device_type": "ebs",
"state": "running",
"state_code": 16,
"tags": {
"Counter": "staging_gunicorn-sub1",
"Name": "staging_gunicorn"
},
"tenancy": "default",
"virtualization_type": "hvm"
}
]
}
]
}
}
- name: Register gunicorn instances with the ELBS
local_action:
module: ec2_elb
region: "{{ ec2_region }}"
instance_id: "{{ item['id'] }}"
state: present
ec2_elbs: gunicorn-elb
wait: no
ignore_errors: yes
# when: ec2_gunicorn_elb_out.changed
with_items: "{{ ec2_gunicorn_az1_out.results[0].tagged_instances + ec2_gunicorn_az2_out.results[0].tagged_instances }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment