source archive succeeds however, downloading and unarchiving fails

10 views
Skip to first unread message

danish09

unread,
Mar 20, 2018, 12:51:44 PM3/20/18
to Ansible Project
Hi,


Please provide your suggestions. Kindly help me on what mistake I am doing,

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


cat /etc/issue
Linux Mint 18.3 Sylvia \n \l



1. First playbook below:



   
- name: downloading java
      get_url
:
        url
: https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_linux-x64_bin.tar.gz
        dest
: /usr/share/
        owner
: root
       
group: root
        mode
: 0644
     
register: status  


   
- name: unarchiving java source file
      unarchive
:
        src
: /usr/share/openjdk-9.0.4_linux-x64_bin.tar.gz
        dest
: /usr/share/
        owner
: root
       
group: root
        mode
: 0644
        remote_src
: no
     
when: status| success
   
   
- name: changing permissions recursively
      file
:
        path
: /usr/share/jdk-9.0.4
        mode
: 0755
        recurse
: yes



fails with below error:

<127.0.0.1> (0, '', '')
The full traceback is:
  File "/tmp/ansible_YOPdb4/ansible_module_unarchive.py", line 141, in
<module>
    from shlex import quote


fatal: [127.0.0.1]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "attributes": null,
            "backup": null,
            "content": null,
            "creates": null,
            "delimiter": null,
            "dest": "/usr/share/",
            "directory_mode": null,
            "exclude": [],
            "extra_opts": [],
            "follow": false,
            "force": null,
            "group": "root",
            "keep_newer": false,
            "list_files": false,
            "mode": 420,
            "original_basename": "openjdk-9.0.4_linux-x64_bin.tar.gz",
            "owner": "root",
            "regexp": null,
            "remote_src": true,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": "/usr/share/openjdk-9.0.4_linux-x64_bin.tar.gz",
            "unsafe_writes": null,
            "validate_certs": true
        }
    },
    "msg": "Failed to find handler for \"/usr/share/openjdk-9.0.4_linux-x64_bin.tar.gz\". Make sure the required command to extract the file is installed. Commands \"gtar\" and \"tar\" not found. Command \"unzip\" not found."
}
 to retry, use: --limit @/home/xxxxxx/gitlab/ansb-plybooks/playbook.retry
 ____________
< PLAY RECAP >
 ------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


127.0.0.1                  : ok=3    changed=1    unreachable=0    failed=1  


2. second playbook with only the same piece of unarchive module code: source archived file already present in the target path, succeeds



---


- name: testing the unarchive module
  hosts
: all
  become
: yes


  tasks
:


   
- name: unarchiving java source file
      unarchive
:
        src
: /usr/share/openjdk-9.0.4_linux-x64_bin.tar.gz
        dest
: /usr/share/
        owner
: root
       
group: root
        mode
: 0644

result:


changed
: [127.0.0.1] => {
   
"changed": true,
   
"dest": "/usr/share/",
   
"extract_results": {
       
"cmd": [
           
"/bin/gtar",
           
"--extract",
           
"-C",
           
"/usr/share/",
           
"-z",
           
"--owner=root",
           
"--group=root",
           
"-f",
           
"/home/xxxxxxx/.ansible/tmp/ansible-tmp-1521563805.88-153511776087494/source"
       
],
       
"err": "",
       
"out": "",
       
"rc": 0
   
},
   
"gid": 0,
   
"group": "root",
   
"handler": "TgzArchive",
   
"invocation": {
       
"module_args": {
           
"attributes": null,
           
"backup": null,
           
"content": null,
           
"creates": null,
           
"delimiter": null,
           
"dest": "/usr/share/",
           
"directory_mode": null,
           
"exclude": [],
           
"extra_opts": [],
           
"follow": false,
           
"force": null,
           
"group": "root",
           
"keep_newer": false,
           
"list_files": false,
           
"mode": 420,
           
"original_basename": "openjdk-9.0.4_linux-x64_bin.tar.gz",
           
"owner": "root",
           
"regexp": null,
           
"remote_src": false,
           
"selevel": null,
           
"serole": null,
           
"setype": null,
           
"seuser": null,
           
"src": "/home/xxxxxxx/.ansible/tmp/ansible-tmp-1521563805.88-153511776087494/source",
           
"unsafe_writes": null,
           
"validate_certs": true
       
}
   
},
   
"mode": "0755",
   
"owner": "root",
   
"size": 12288,
   
"src": "/home/xxxxxx/.ansible/tmp/ansible-tmp-1521563805.88-153511776087494/source",
   
"state": "directory",
   
"uid": 0
}
META
: ran handlers
META
: ran handlers
 ____________
< PLAY RECAP >
 
------------
       
\   ^__^
         
\  (oo)\_______
           
(__)\       )\/\
               
||----w |
               
||     ||


127.0.0.1                  : ok=2    changed=1    unreachable=0    failed=0  


Thanks
Reply all
Reply to author
Forward
0 new messages