Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_s3: "src" always looking locally for files. #38656

Closed
marcnil815 opened this issue Apr 12, 2018 · 7 comments · Fixed by #39023
Closed

aws_s3: "src" always looking locally for files. #38656

marcnil815 opened this issue Apr 12, 2018 · 7 comments · Fixed by #39023
Labels
affects_2.5 This issue/PR affects Ansible v2.5 aws bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@marcnil815
Copy link

ISSUE TYPE
  • Bug Report
COMPONENT NAME

aws_s3

ANSIBLE VERSION
ansible 2.5.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/ubuntu/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]
CONFIGURATION

HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False

OS / ENVIRONMENT

Ansible host: Ubuntu 16.04 TLS
Remote host: Ubuntu 16.04 TLS

SUMMARY

The aws_s3 PUT mode used in a playbook looks for the src file locally, not remote.

STEPS TO REPRODUCE

Create file on remote machine: /home/ansible-user/test.txt

- name: s3_upload_of_test_file
   hosts: remote_host
   gather_facts: no
   tasks:
     - name: upload_to_s3
       bucket: my_bucket
       object: test.txt
       src: /home/ansible-user/test.txt
       mode: put
EXPECTED RESULTS

test.txt gets uploaded to bucket.

ACTUAL RESULTS

"File cannot be found or accessed."

Creating the file locally in the same location results in the file being found.

This does not happen with the deprecated "s3". Some old entries hint at a setting called something along the lines of "src_remote: true" in terms of aws modules, but nothing in the current documentation seems to corroborate that point.

@ansibot
Copy link
Contributor

ansibot commented Apr 12, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Apr 12, 2018

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 aws bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 12, 2018
@samdoran samdoran removed the needs_triage Needs a first human triage before being processed. label Apr 12, 2018
@willthames
Copy link
Contributor

Can you provide the results of running under -vvv including invocation.

We probably need to think about how we combine the aws_s3 action plugin (which is used for looking for src in all the usual places locally) with a currently non-existent remote_src.

@marcnil815
Copy link
Author

$ ansible-playbook s3_test.yml -vvv
ansible-playbook 2.5.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/<user>/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]
Using /etc/ansible/ansible.cfg as config file
Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: s3_test.yml *********************************************************************************************************************************************************************************************************************************************************************
1 plays in s3_test.yml

PLAY [s3_test] ****************************************************************************************************************************************************************************************************************************************************************************
META: ran handlers

TASK [upload_to_s3] ***********************************************************************************************************************************************************************************************************************************************************************
task path: /opt/ansible/s3_test.yml:6
<172.31.0.102> ESTABLISH SSH CONNECTION FOR USER: None
<172.31.0.102> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/<user>/.ansible/cp/a1284e15df 172.31.0.102 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<172.31.0.102> (0, '/home/<user>\n', '')
<172.31.0.102> ESTABLISH SSH CONNECTION FOR USER: None
<172.31.0.102> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/<user>/.ansible/cp/a1284e15df 172.31.0.102 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/<user>/.ansible/tmp/ansible-tmp-1523899197.02-178217214238941 `" && echo ansible-tmp-1523899197.02-178217214238941="` echo /home/<user>/.ansible/tmp/ansible-tmp-1523899197.02-178217214238941 `" ) && sleep 0'"'"''
<172.31.0.102> (0, 'ansible-tmp-1523899197.02-178217214238941=/home/<user>/.ansible/tmp/ansible-tmp-1523899197.02-178217214238941\n', '')
fatal: [172.31.0.102]: FAILED! => {
    "changed": false, 
    "msg": "Could not find or access '/opt/backup/test.txt'"
}

@jrko
Copy link

jrko commented Apr 27, 2018

I'm seeing the same behavior in Ansible 2.5.0 and 2.5.2.
It works in 2.4.3.

@ryansb
Copy link
Contributor

ryansb commented May 4, 2018

@jrko can you take a look at #39023 and check that it resolves your issue?

@jrko
Copy link

jrko commented May 9, 2018

@ryansb I can confirm #39023 fixes the issue in Ansible 2.5.2 👍

@ansible ansible locked and limited conversation to collaborators May 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 aws bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants