Provision an AWS EC2 instance with Ansible
devops-recipes / prov_aws_ec2_ansible Goto Github PK
View Code? Open in Web Editor NEWProvision an AWS EC2 instance with Ansible
Provision an AWS EC2 instance with Ansible
Although the EC2 status at AWS console is running the task keeps timeout.
Side info:
I debug the ec2 variable and I found out that the 'instances' list is empty and the 'tagged_instances' contains the ec2 information. I change the 'with_items' to "{{ ec2.tagged_instances }}" but nothing changed.
Error:
The full traceback is:
WARNING: The below traceback may not be related to the actual failure.
File "/tmp/ansible_wait_for_payload_o0UQHR/main.py", line 542, in main
s = _create_connection(host, port, min(connect_timeout, alt_connect_timeout))
File "/tmp/ansible_wait_for_payload_o0UQHR/main.py", line 407, in _create_connection
connect_socket = socket.create_connection((host, port), connect_timeout)
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
failed: [localhost] (item={u'ramdisk': None, u'kernel': None, u'root_device_type': u'ebs', u'private_dns_name': u'ip-172-31-6-2.eu-west-2.compute.internal', u'block_device_mapping': {u'/dev/xvda': {u'status': u'attached', u'delete_on_termination': True, u'volume_id': u'vol-08d3d6ee639194a63'}, u'/dev/sda1': {u'status': u'attached', u'delete_on_termination': True, u'volume_id': u'vol-0cdee137ae639189d'}}, u'key_name': u'ansible-key', u'public_ip': u'35.178.37.2', u'image_id': u'ami-0b0a60c0a2bd40612', u'tenancy': u'default', u'private_ip': u'172.31.6.2', u'groups': {u'sg-64d28c0e': u'default'}, u'public_dns_name': u'ec2-35-178-37-2.eu-west-2.compute.amazonaws.com', u'state_code': 16, u'id': u'i-0ae8f6aadda7f13ed', u'tags': {u'Role': u'ansible', u'Type': u't2.micro'}, u'placement': u'eu-west-2c', u'ami_launch_index': u'0', u'dns_name': u'ec2-35-178-37-2.eu-west-2.compute.amazonaws.com', u'region': u'eu-west-2', u'ebs_optimized': False, u'launch_time': u'2018-12-21T13:51:42.000Z', u'instance_type': u't2.micro', u'state': u'running', u'architecture': u'x86_64', u'hypervisor': u'xen', u'virtualization_type': u'hvm', u'root_device_name': u'/dev/sda1'}) => {
"changed": false,
"elapsed": 301,
"invocation": {
"module_args": {
"active_connection_states": [
"ESTABLISHED",
"FIN_WAIT1",
"FIN_WAIT2",
"SYN_RECV",
"SYN_SENT",
"TIME_WAIT"
],
"connect_timeout": 5,
"delay": 15,
"exclude_hosts": null,
"host": "35.178.37.2",
"msg": null,
"path": null,
"port": 22,
"search_regex": null,
"sleep": 1,
"state": "started",
"timeout": 300
}
},
"item": {
"ami_launch_index": "0",
"architecture": "x86_64",
"block_device_mapping": {
"/dev/sda1": {
"delete_on_termination": true,
"status": "attached",
"volume_id": "vol-0cdee137ae639189d"
},
"/dev/xvda": {
"delete_on_termination": true,
"status": "attached",
"volume_id": "vol-08d3d6ee639194a63"
}
},
"dns_name": "ec2-35-178-37-2.eu-west-2.compute.amazonaws.com",
"ebs_optimized": false,
"groups": {
"sg-64d28c0e": "default"
},
"hypervisor": "xen",
"id": "i-0ae8f6aadda7f13ed",
"image_id": "ami-0b0a60c0a2bd40612",
"instance_type": "t2.micro",
"kernel": null,
"key_name": "ansible-key",
"launch_time": "2018-12-21T13:51:42.000Z",
"placement": "eu-west-2c",
"private_dns_name": "ip-172-31-6-2.eu-west-2.compute.internal",
"private_ip": "172.31.6.2",
"public_dns_name": "ec2-35-178-37-2.eu-west-2.compute.amazonaws.com",
"public_ip": "35.178.37.2",
"ramdisk": null,
"region": "eu-west-2",
"root_device_name": "/dev/sda1",
"root_device_type": "ebs",
"state": "running",
"state_code": 16,
"tags": {
"Role": "ansible",
"Type": "t2.micro"
},
"tenancy": "default",
"virtualization_type": "hvm"
},
"msg": "Timeout when waiting for 35.178.37.2:22"`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.