Hi All,
I'm getting an error when trying to attach and EIP to an EC2 AMI thats
provisioned with Ansible. The instance is provisioned correctly but then I
receive the error below. The key pair used has full administrative access
to AWS
PLAY [localhost]
**************************************************************
TASK: [Launch instances]
******************************************************
<localhost> REMOTE_MODULE ec2 access_key="AKIAIG6GJQ4S3HTEDFCQ" secret_key=
"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" keypair="dakey" group="ssh-only"
type="t2.micro" image="ami-cbe3e88e" region="us-west-1"
instance_tags="{'name':'WebServer',
'type':'t2.micro', 'group':'ssh-only'}" count="1" wait=true
changed: [localhost] => {"changed": true, "instance_ids": ["i-56671d9e"],
"instances": [{"ami_launch_index": "0", "architecture": "x86_64", "dns_name"
: "ec2-54-183-85-164.us-west-1.compute.amazonaws.com", "ebs_optimized":
false, "hypervisor": "xen", "id": "i-56671d9e", "image_id": "ami-cbe3e88e",
"instance_type": "t2.micro", "kernel": null, "key_name": "dakey",
"launch_time": "2014-11-01T17:18:30.000Z", "placement": "us-west-1b",
"private_dns_name": "ip-172-31-31-196.us-west-1.compute.internal",
"private_ip": "172.31.31.196", "public_dns_name":
"ec2-54-183-85-164.us-west-1.compute.amazonaws.com", "public_ip":
"54.183.85.164", "ramdisk": null, "region": "us-west-1", "root_device_name":
"/dev/sda1", "root_device_type": "ebs", "state": "running", "state_code": 16
, "virtualization_type": "hvm"}], "tagged_instances": []}
TASK: [Associate new elastic IPs with each of the instances]
******************
<localhost> REMOTE_MODULE ec2_eip region="us-west-1" instance_id=
"i-56671d9e"
failed: [localhost] => (item=i-56671d9e) => {"failed": true, "item":
"i-56671d9e"}
msg: EC2ResponseError: 401 Unauthorized
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>AuthFailure</Code><Message>AWS was not able
to validate the provided access credentials</Message></Error></Errors><
RequestID>f394af99-6dae-4383-835d-9e03d79984db</RequestID></Response>
FATAL: all hosts have already failed -- aborting
PLAY RECAP
********************************************************************
to retry, use: --limit @/Users/me/ec2-advanced-launch.retry
localhost : ok=1 changed=1 unreachable=0 failed=1
Here is the playbook:
#Provision some instances:
- hosts: localhost
connection: local
gather_facts: False
vars_files:
- group_vars/all
tasks:
- name: Launch instances
ec2: >
access_key="{{ ec2_access_key }}"
secret_key="{{ ec2_secret_key }}"
keypair="{{ ec2_keypair }}"
group="{{ ec2_security_group }}"
type="{{ ec2_instance_type }}"
image="{{ ec2_image }}"
region="{{ ec2_region }}"
instance_tags="{'name':'WebServer', 'type':'{{ ec2_instance_type }}',
'group':'{{ ec2_security_group }}'}"
count="{{ ec2_instance_count }}"
wait=true
register: ec2
- name: Associate new elastic IPs with each of the instances
ec2_eip: region="{{ ec2_region }}" instance_id="{{ item }}"
with_items: ec2.instance_ids
- name: output the IP
debug: msg="Allocated IP inside a VPC is {{ eip.public_ip }}"
- name: Set DNS Record for New Instance
route53: >
command=create
zone=mydowmain.com
record=webserver.mydomain.com
type=A
ttl=7200
value={{ eip.public_ip }}
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/64e5d6b8-b876-427f-8eb8-48468ee1ebfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.