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

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"?>

AuthFailureAWS was not able to validate the provided access credentials9ad65772-2754-42ab-901b-ef9153276797

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?

I'm guessing you copied the key from a windows machine?

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