Ansible Can not handle .tar.gz file and gives error

5,958 views
Skip to first unread message

Balu Kompalli

unread,
Dec 9, 2016, 7:03:44 AM12/9/16
to Ansible Project

Hello Team,

   I got the below error. I tried So many things which were failed to do things good. If you have any knowledge to rectify this error, please inform the references or commands to use.   

fatal: [192.168.1.223]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to find handler for \"/usr/bin/jdk-8u112-linux-x64.tar.gz\". Make sure the required command to extract the file is installed. Command \"/usr/bin/unzip\" could not handle archive. Command \"/usr/bin/gtar\" could not handle archive."}
 
       to retry, use: --limit @/root/balu/ans_playbooks/install_java.retry


Thanks in advance.

Stankovic, Marko

unread,
Dec 9, 2016, 7:49:18 AM12/9/16
to ansible...@googlegroups.com
Hi Balu,

If you did something like this:
wget http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz
then you've downloaded the html page saying you have to accept the OTN license terms.
Can you check the filesize of the downloaded file?
If your file is 100+MB then verify its checksum:
https://www.oracle.com/webfolder/s/digest/8u112checksum.html

To get the archive, try this method:
http://stackoverflow.com/questions/10268583/downloading-java-jdk-on-linux-via-wget-is-shown-license-page-instead#10959815

Cheers,
Marko


______________________________________________________________________________________________________

CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or
its subsidiaries and may contain proprietary, confidential or trade secret information.
This message is intended solely for the use of the addressee. If you are not the intended recipient
and have received this message in error, please delete this message from your system. Any unauthorized
reading, distribution, copying, or other use of this message or its attachments is strictly prohibited.

Balu Kompalli

unread,
Dec 9, 2016, 10:42:03 AM12/9/16
to Ansible Project, marko.s...@igt.com
Yes, That link is fine. But When I used the wget  it gave error  


fatal: [192.168.1.223]: FAILED! => {"changed": true, "cmd": ["wget", "--no-check-certificate", "-c", "--header", "Cookie: oraclelicense=accept-securebackup-cookie", "http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz"], "delta": "0:02:26.744175", "end": "2016-12-09 10:36:58.731695", "failed": true, "rc": 4, "start": "2016-12-09 10:34:31.987520", "stderr": "--2016-12-09 10:34:31--  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nResolving download.oracle.com (download.oracle.com)... 23.215.132.129, 23.215.132.163\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:34:33--  (try: 2)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:34:35--  (try: 3)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:34:38--  (try: 4)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:34:42--  (try: 5)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:34:47--  (try: 6)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:34:53--  (try: 7)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:35:00--  (try: 8)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:35:08--  (try: 9)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:35:17--  (try:10)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:35:27--  (try:11)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:35:37--  (try:12)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:35:48--  (try:13)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:35:58--  (try:14)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:36:08--  (try:15)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:36:18--  (try:16)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:36:28--  (try:17)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:36:38--  (try:18)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:36:48--  (try:19)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nRetrying.\n\n--2016-12-09 10:36:58--  (try:20)  http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz\nConnecting to download.oracle.com (download.oracle.com)|23.215.132.129|:80... connected.\nHTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.\nGiving up.", "stdout": "", "stdout_lines": [], "warnings": ["Consider using get_url or uri module rather than running wget"]}
  

The connection from the Oracle server refused. So how to over come this in the ansible. Normally wget works fine. But in Ansible playbook, I got this error.


Dick Davies

unread,
Dec 9, 2016, 12:00:11 PM12/9/16
to ansible list
It's not looking very much like an Ansible problem from where I'm sat.

Do you have e.g. a proxy environment variable set in your shell
running wget that you haven't set in the
ansible task?
> --
> 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 post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/31b76c2f-3eee-4634-a6a6-73260f67e448%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Balu Kompalli

unread,
Dec 9, 2016, 2:19:06 PM12/9/16
to Ansible Project, di...@hellooperator.net
Actually, I do not have set any proxy environment variable in my Linux environment. By using unarchive module in the Ansible playbook it shows the below error.    
fatal: [192.168.1.223]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to find handler for \"/usr/bin/jdk-8u112-linux-x64.tar.gz\". Make sure the required command to extract the file is installed. Command \"/usr/bin/unzip\" could not handle archive. Command \"/usr/bin/gtar\" could not handle archive."}

        to retry, use: --limit @/root/balu/ans_playbooks/install_java.retry


this is my playbook. Please consider. 

--------------------------------------
install_java.yml
-------------------------------------

- hosts: webservers
  vars:
    java_name: "{{download_folder}}/jdk1.8.0_112"
    download_folder: "/usr/bin"
    java_archive: "{{download_folder}}/jdk-8u112-linux-x64.tar.gz"
    java_folder: "/usr/bin/jvm"
    java_alias: "java-8-oracle"
    java_controller: "/root/balu/ansi_playbooks/jdk-8u112-linux-x64.tar.gz"

  tasks:

  - name: Install tar
    yum: pkg=tar
  - name: Install wget
    yum: pkg=wget

  - name: Install unzip
    yum: pkg=unzip
  - file:
      path: "{{download_folder}}"
      owner: root
      mode: 0776

  - name: Download java
    get_url: 'url={{java_download}} dest={{download_folder}}'

  - name: creating foldder
    file: "path={{download_folder}} state=directory"

  - name: Download and unpack
    unarchive:
      src: "{{download_folder}}/jdk-8u112-linux-x64.tar.gz"
      dest: "{{download_folder}}/"
      copy: no
      owner: root
      mode: 0777

  - name: Fix ownership
    command : "state= directory path={{java_name}} owner=root recurse=yes"

  - name: Move Java to final folder
    command: "mv {{download_folder}}/{{java_name}} {{java_folder}} creates={{java_folder}}/{{java_name}}"

  - name: Create symlink for easier update
    file: "state=link src={{java_folder}}/{{java_name}} dest={{java_folder}}/{{java_alias}}"

  - name: Make Java available for system
    command: 'update-alternatives --install "/usr/bin/java" "java" "{{java_folder}}/{{java_alias}}/bin/java" 1'

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

where do i did wrong in this playbook?



Balu Kompalli

unread,
Dec 15, 2016, 10:13:37 AM12/15/16
to Ansible Project, di...@hellooperator.net
Ansible Couldn't handle archive error. Please help me to resolve.

Thank you

Balu Kompalli

unread,
Dec 15, 2016, 10:57:35 AM12/15/16
to Ansible Project, marko.s...@igt.com
 Hello Stankovic and Marko,

How to accept the OTN in ansible? Is there any documentation  or references available for that? If available, Please suggest me to reach. 
Thank you. 

Balu Kompalli

unread,
Dec 15, 2016, 11:00:44 AM12/15/16
to Ansible Project, marko.s...@igt.com
Hello Stankovi and Marko

 Is there any docs or references available that how to accept the OTN of oracle java? If available, Please suggest me and give those links to me.

Thank you in advance.

Stankovic, Marko

unread,
Dec 20, 2016, 10:08:37 AM12/20/16
to ansible...@googlegroups.com
Hi Balu,


Looking at the log you provided, you're using the right way for accepting the OTN license.

According to this comment:
http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/#comment-1998
...the error may be related to timeout.

Try using --timeout=20 option for wget (or more than 20 if still getting the same error).
Reply all
Reply to author
Forward
0 new messages