AWS_SECRET_KEY I need to rstrip('/r') on ubuntu or I get an error

177 views
Skip to first unread message

Kesten Broughton

unread,
Jan 16, 2015, 9:32:57 AM1/16/15
to ansible...@googlegroups.com
I'm on ubuntu 14.04

[(master)] ansible --version
ansible 1.8.2

If I just define AWS_SECRET_KEY,AWS_ACCESS_KEY in my bash env,
I get the following error with all ec2 modules.

boto.exception.EC2ResponseError: 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>9ad65772-2754-42ab-901b-ef9153276797</RequestID></Response>

If I add the aws_access_key and aws_secret_key and lookup the var, I get the same error unless I rstrip('\\r') .   I discovered the trailing '\r' by running with -vvvv .

group_vars/all
aws_secret_key: "{{lookup('env','AWS_SECRET_KEY').rstrip('\\r')}}"
aws_access_key: "{{lookup('env','AWS_ACCESS_KEY').rstrip('\\r')}}"

task I am running.

- route53:
      aws_access_key: "{{aws_access_key}}"
      aws_secret_key: "{{aws_secret_key}}"
      command: create
      zone: "{{aws_vpc.zone}}"
      record: my-record.org
      type: A
      ttl: 7200
      value: 1.1.1.1,2.2.2.2,3.3.3.3

Am I doing something wrong, or is this something I should make a bug report for?

--

Kesten Broughton
512 701 4209

Brian Coca

unread,
Jan 16, 2015, 9:35:57 AM1/16/15
to ansible...@googlegroups.com
I'm guessing you copied the key from a windows machine?


--
Brian Coca

Kesten Broughton

unread,
Jan 21, 2015, 9:40:19 AM1/21/15
to ansible...@googlegroups.com
Hi Brian,
Actually, no windows machine involved.
I just go to the AWS manage keys and download the credentials.csv.
Then copied and pased into an aws.ini file.

I was using an ubuntu 14.04 machine.
I'll see if i can reproduce on my mac.

k
Reply all
Reply to author
Forward
0 new messages