I'm having an issue with a playbook (v1.9.2) when trying to download an
object from S3 to the target server.
s3:
aws_access_key="{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}"
aws_secret_key="{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}'"
region="{{ vpc_region }}"
bucket=my_bucket
object="{{ item }}"
dest="/etc/ansible/{{ item }}"
mode=get
with_items:
- item1
- item2
I don't have the exact version, but I ran something very similar to it
initially it worked. I killed the server and tried doing it again and
ultimately, it shows this error in Ansible.
<XX.XX.XX.XX> ESTABLISH CONNECTION FOR USER: root
<XX.XX.XX.XX> REMOTE_MODULE s3 aws_access_key="aws_access_key"
aws_secret_key="bLahBlAhblakabalbalkab+6'" region="us-east-1"
bucket=my_bucket object="item1" dest="/etc/ansible/item1" mode=get
<XX.XX.XX.XX> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o
ControlPersist=60s -o
ControlPath="/Users/user/.ansible/cp/ansible-ssh-%h-%p-%r" -o
StrictHostKeyChecking=no -o
IdentityFile="./roles/some_role/files/ansible_id_rsa" -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 54.210.81.25
/bin/sh -c 'mkdir -p
$HOME/.ansible/tmp/ansible-tmp-1438797951.82-34534217897109 && echo
$HOME/.ansible/tmp/ansible-tmp-1438797951.82-34534217897109'
<XX.XX.XX.XX> PUT
/var/folders/7b/1lkc6j_s77zgks82clv2bgq80009w_/T/tmph1zn1Y TO
/root/.ansible/tmp/ansible-tmp-1438797951.82-34534217897109/s3
<XX.XX.XX.XX> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o
ControlPersist=60s -o
ControlPath="/Users/user/.ansible/cp/ansible-ssh-%h-%p-%r" -o
StrictHostKeyChecking=no -o
IdentityFile="./roles/create_vpc/files/ansible_id_rsa" -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 54.210.81.25
/bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python
/root/.ansible/tmp/ansible-tmp-1438797951.82-34534217897109/s3; rm -rf
/root/.ansible/tmp/ansible-tmp-1438797951.82-34534217897109/ >/dev/null
2>&1'
failed: [XX.XX.XX.XX] => (item=item1) => {"failed": true, "item": "item1"}
msg: Target bucket cannot be found
Before running this portion of the playbook, I install Pip, awscli, boto
and added the environment variables (access id, secret key, and region) for
the awscli. On the target server, I see this in the logs:
Aug 5 18:05:52 localhost ansible-s3: Invoked with profile=None
aws_secret_key=NOT_LOGGING_PARAMETER aws_access_key=aws_access_key
security_token=NOT_LOGGING_PARAMETER src=None dest=/etc/ansible/item1 region
=us-east-1 object=item1 bucket=my_bucket expiry=600 mode=get ec2_url=None
s3_url=None validate_certs=True overwrite=True metadata=None
I've verified that the access/secret works and can use the CLI to download
the objects using 'aws s3 cp s3://my_bucket/item1 ./'
It's a fresh CentOS7 image on AWS and the server has an IAM role attached
and has Read Access to S3. I'm using the root user to connect to the
Centos7 so it's not permission issue. I'm confused why it can't find my S3
bucket? I've verified the spelling of the bucket name.
--
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/0f10f2f1-da5a-4a13-b9a2-a925bda7bef7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.