"msg": "Local object for PUT does not exist"

36 views
Skip to first unread message

Serin Abraham

unread,
Apr 15, 2020, 5:50:59 PM4/15/20
to Ansible Project

Hi,


I just started using ansible for sometime now. Not sure what I'm doing wrong.


I already created a s3 bucket successfully and then trying to upload a file(awscliv2.zip) to s3 bucket but it fails with below error

""msg": "Local object for PUT does not exist"


playbook looks like below:


---

- hosts: xyz

   remote_user: root

   tasks: 

  - name: upload to s3 bucket abc

     aws_s3:

       bucket: abc

       object: /awscliv2.zip (I dout i'm doing something wrong here, is this the dest path of s3?)

       src: /root/playbook/awscliv2.zip (src absolute file path in the host in which I run the playbook)

       mode: put

       


hope to get some hlp and learn ansible, thx alot guys!!



cheers
Serin

David Foley

unread,
Apr 15, 2020, 8:03:57 PM4/15/20
to Ansible Project
Remote_user I would do connection: local, also what's the folder permission on that playbook folder?



Serin Abraham

unread,
Apr 15, 2020, 11:22:40 PM4/15/20
to Ansible Project
permission: public-read

Serin Abraham

unread,
Apr 15, 2020, 11:33:06 PM4/15/20
to Ansible Project
root@master:~/playbook# cat create_s3.yml 
---
- hosts: ubuntu
  remote_user: root
  vars_files:
  - keys.yml
  tasks: 
  - name: create a s3 bucket
    aws_s3: 
      aws_access_key: "{{ AWS_ACCESS_KEY_ID }}"
      aws_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}"
      ec2_region: "{{ AWS_REGION }}"
      bucket: serin
      mode: create
      permission: public-read

  - name: upload a file to s3
    aws_s3:
      aws_access_key: "{{ AWS_ACCESS_KEY_ID }}"
      aws_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 
      ec2_region: "{{ AWS_REGION }}"
      bucket: serin
      mode: put
      object: /serin.txt
      src: /root/playbook/serin.txt
      permission: public-read

Dick Visser

unread,
Apr 16, 2020, 12:32:32 AM4/16/20
to ansible...@googlegroups.com
According to the docs aws modules should be run against localhost:

Please try that.


Also running ansible as root is both unnecessary and unsafe. So once you got things to work at all, take it a step further and fix that as well.


Dick 


--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4fe9a9b1-bd70-4739-a188-f72bdd84abbd%40googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Serin Abraham

unread,
Apr 16, 2020, 2:53:08 AM4/16/20
to Ansible Project
thank you Dick it worked. 

I'm using root since its just for practise. anyway I will be mindful of that. 

but the thing is I was able to install a ec2 and create a s3 bucket without localhost. anyway will need to dig-in deeper.

thanks again and appreciate it and thanks David for your help as-well. Cheers

Serin Abraham

unread,
Apr 16, 2020, 3:20:29 AM4/16/20
to Ansible Project
anyway i figured the actual problem. it was just the "src"(/root/playbook/serin.txt) file was not present in the targeted "hosts"(ubuntu).

simple issue but i guess this is how we learn :)
Reply all
Reply to author
Forward
0 new messages