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

unarchive module can't find file but it exist #31926

Closed
winmasta opened this issue Oct 19, 2017 · 8 comments
Closed

unarchive module can't find file but it exist #31926

winmasta opened this issue Oct 19, 2017 · 8 comments
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@winmasta
Copy link

winmasta commented Oct 19, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME

unarchive

ANSIBLE VERSION
ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/winmasta/.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, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
CONFIGURATION

DEFAULT_PRIVATE_KEY_FILE(/etc/ansible/ansible.cfg) = /home/winmasta/.ssh/kireva_ans
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /home/winmasta/vault_pass.txt
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False

OS / ENVIRONMENT

running OS: Linux 4.10.0-37-generic #41~16.04.1-Ubuntu SMP Fri Oct 6 22:42:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

managing OS: Ubuntu server 16.04.3 x64

SUMMARY

unarchive module can't find the file but it exist

STEPS TO REPRODUCE
- name: getting node_exporter
    get_url:
      url: https://github.com/prometheus/node_exporter/releases/download/v{{ NODE_EXPORTER_VERSION }}/node_exporter-{{ NODE_EXPORTER_VERSION }}.linux-amd64.tar.gz
      dest: /tmp/
      mode: 0777

- name: unpacking node_exporter
    unarchive:  
      src: /tmp/node_exporter-{{ NODE_EXPORTER_VERSION }}.linux-amd64.tar.gz
      dest: /tmp/
EXPECTED RESULTS

Expect no errors.

ACTUAL RESULTS
amazon-ebs: TASK [getting node_exporter] ***************************************************
    amazon-ebs: changed: [default]
    amazon-ebs:
    amazon-ebs: TASK [debug] *******************************************************************
    amazon-ebs: ok: [default] => {
    amazon-ebs:     "result": {
    amazon-ebs:         "changed": true,
    amazon-ebs:         "cmd": "cd /tmp && ls -lA",
    amazon-ebs:         "delta": "0:00:00.002823",
    amazon-ebs:         "end": "2017-10-19 08:10:39.288165",
    amazon-ebs:         "failed": false,
    amazon-ebs:         "rc": 0,
    amazon-ebs:         "start": "2017-10-19 08:10:39.285342",
    amazon-ebs:         "stderr": "",
    amazon-ebs:         "stderr_lines": [],
    amazon-ebs:         "stdout": "total 5188\ndrwx------ 2 root   root      4096 Oct 19 08:10 ansible_Poq6xM\ndrwxrwxrwt 2 root   root      4096 Oct 19 08:09 .font-unix\ndrwxrwxrwt 2 root   root      4096 Oct 19 08:09 .ICE-unix\n-rwxrwxrwx 1 root   root   5276195 Oct 19 08:10 node_exporter-0.15.0.linux-amd64.tar.gz\ndrwx------ 2 ubuntu ubuntu    4096 Oct 19 08:09 ssh-vJN9uGp4lf\ndrwx------ 3 root   root      4096 Oct 19 08:09 systemd-private-d63b439562cf4faaa60e759301a3be87-systemd-timesyncd.service-vE2ivK\ndrwxrwxrwt 2 root   root      4096 Oct 19 08:09 .Test-unix\n-rw------- 1 root   root         0 Oct 19 08:10 tmpkGWnS9\n-rw------- 1 root   root         0 Oct 19 08:10 tmpYcCBUb\ndrwxrwxrwt 2 root   root      4096 Oct 19 08:09 .X11-unix\ndrwxrwxrwt 2 root   root      4096 Oct 19 08:09 .XIM-unix",
    amazon-ebs:         "stdout_lines": [
    amazon-ebs:             "total 5188",
    amazon-ebs:             "drwx------ 2 root   root      4096 Oct 19 08:10 ansible_Poq6xM",
    amazon-ebs:             "drwxrwxrwt 2 root   root      4096 Oct 19 08:09 .font-unix",
    amazon-ebs:             "drwxrwxrwt 2 root   root      4096 Oct 19 08:09 .ICE-unix",
    amazon-ebs:             "-rwxrwxrwx 1 root   root   5276195 Oct 19 08:10 node_exporter-0.15.0.linux-amd64.tar.gz",
    amazon-ebs:             "drwx------ 2 ubuntu ubuntu    4096 Oct 19 08:09 ssh-vJN9uGp4lf",
    amazon-ebs:             "drwx------ 3 root   root      4096 Oct 19 08:09 systemd-private-d63b439562cf4faaa60e759301a3be87-systemd-timesyncd.service-vE2ivK",
    amazon-ebs:             "drwxrwxrwt 2 root   root      4096 Oct 19 08:09 .Test-unix",
    amazon-ebs:             "-rw------- 1 root   root         0 Oct 19 08:10 tmpkGWnS9",
    amazon-ebs:             "-rw------- 1 root   root         0 Oct 19 08:10 tmpYcCBUb",
    amazon-ebs:             "drwxrwxrwt 2 root   root      4096 Oct 19 08:09 .X11-unix",
    amazon-ebs:             "drwxrwxrwt 2 root   root      4096 Oct 19 08:09 .XIM-unix"
    amazon-ebs:         ]
    amazon-ebs:     }
    amazon-ebs: }
    amazon-ebs:
    amazon-ebs: TASK [unpacking node_exporter] *************************************************
    amazon-ebs: fatal: [default]: FAILED! => {"changed": false, "failed": true, "msg": "Could not find or access '/tmp/node_exporter-0.15.0.linux-amd64.tar.gz'"}
    amazon-ebs: 	to retry, use: --limit @/home/winmasta/hasca/iac/packer/playbook.retry
@winmasta winmasta changed the title unarchive module can't find file but it exists unarchive module can't find file but it exist Oct 19, 2017
@ansibot
Copy link
Contributor

ansibot commented Oct 19, 2017

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bug_report 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 Oct 19, 2017
@winmasta
Copy link
Author

It also affects "copy" module whith the same error. So if I replace "unarchive" with "shell: tar xvzf" and "copy" with "shell: cp" everything works fine.

@andreaso
Copy link
Contributor

Have you read what https://docs.ansible.com/ansible/latest/unarchive_module.html has to say about the src parameter?

@albertomurillo
Copy link
Contributor

Please close since is not a bug

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 20, 2017
@bcoca
Copy link
Member

bcoca commented Oct 20, 2017

Possible Misunderstanding

Hi!

Thanks very much for your submission to Ansible. It sincerely means a lot to us.

We believe the ticket you have filed is being somewhat misunderstood, as one thing works a little differently than stated.

In the future, this might be a topic more well suited for the user list, which you can also post here if you'd like some more help with the above.

Thank you once again for this and your interest in Ansible!

@bcoca bcoca closed this as completed Oct 20, 2017
@luzfcb
Copy link

luzfcb commented Oct 23, 2017

Same problem here.

- name: 'untar files on remote server'
  unarchive:
    remote_src: yes
    src: "{{ ansible_env.HOME }}/file_to_untar.tar.xz"
    dest: "{{ ansible_env.HOME }}/app/src"

The unarchive works if i run directly on remote server

/bin/tar --extract -C /home/myuser/app/src --show-transformed-names -f /home/myuser/file_to_untar.tar.xz
ansible-playbook playbook.yml -vvv --version
ansible-playbook 2.4.0.0
  config file = /home/luzfcb/projetos/ansible_solar/ansible-solar3/ansible.cfg
  configured module search path = [u'/home/luzfcb/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/luzfcb/virtualenvs/ansiblesolarp2/lib/python2.7/site-packages/ansible
  executable location = /home/luzfcb/virtualenvs/ansiblesolarp2/bin/ansible-playbook
  python version = 2.7.11 (default, Mar  8 2016, 09:32:11) [GCC 5.2.1 20151010]

@Brulemat
Copy link

Brulemat commented Nov 8, 2017

same problem , but I have a good result with

  • name: unzip installer
    become: true
    become_method: sudo
    unarchive:
    src: "{{ oracle_tmp }}/{{ installer }}"
    dest: "{{ oracle_tmp }}"
    remote_src: yes

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@dankalytovskyy
Copy link

all you need to do is add remote_src: yes on the bottom.

@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. 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

No branches or pull requests

8 participants