ansible-oracle-java icon indicating copy to clipboard operation
ansible-oracle-java copied to clipboard

Error an Amazon Linux 2015.09.1

Open sdomula opened this issue 9 years ago • 5 comments

I am getting the following error when executing the role on the latest Amazon Linux:

TASK: [williamyeh.oracle-java | uninstall messy packages to avoid blocking conditions] ***
fatal: [x.x.x.x] => Traceback (most recent call last):
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/runner/__init__.py", line 586, in _executor
    exec_rc = self._executor_internal(host, new_stdin)
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/runner/__init__.py", line 789, in _executor_internal
    return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/runner/__init__.py", line 869, in _executor_internal_inner
    if not utils.check_conditional(cond, self.basedir, inject, fail_on_undefined=self.error_on_undefined_vars):
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/utils/__init__.py", line 269, in check_conditional
    conditional = template.template(basedir, presented, inject)
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/utils/template.py", line 124, in template
    varname = template_from_string(basedir, varname, templatevars, fail_on_undefined)
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/utils/template.py", line 382, in template_from_string
    res = jinja2.utils.concat(rf)
  File "<template>", line 9, in root
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


FATAL: all hosts have already failed -- aborting

sdomula avatar Nov 11 '15 13:11 sdomula

Hmmm, I have no trouble executing the role.

Environment:

$ cat /etc/os-release
NAME="Amazon Linux AMI"
VERSION="2015.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2015.09"
PRETTY_NAME="Amazon Linux AMI 2015.09"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2015.09:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

Executing the role:

$ ansible-galaxy install -p . williamyeh.oracle-java
$ cd williamyeh.oracle-java
$ echo "127.0.0.1" > hosts

$ ansible-playbook --connection=local -i hosts test.yml

PLAY [all] ********************************************************************

GATHERING FACTS ***************************************************************
ok: [127.0.0.1]

TASK: [precondition - java_version] *******************************************
skipping: [127.0.0.1]

TASK: [precondition - java_subversion] ****************************************
skipping: [127.0.0.1]

TASK: [set internal vars for 1.8.0_65] ****************************************
ok: [127.0.0.1]

TASK: [set internal vars for 1.8.0_60] ****************************************
skipping: [127.0.0.1]

TASK: [set internal vars for 1.8.0_51] ****************************************
skipping: [127.0.0.1]

TASK: [set internal vars for 1.8.0_45] ****************************************
skipping: [127.0.0.1]

TASK: [set internal vars for 1.8.0_31] ****************************************
skipping: [127.0.0.1]

TASK: [set internal vars for 1.7.0_80] ****************************************
skipping: [127.0.0.1]

TASK: [set internal vars for 1.7.0_75] ****************************************
skipping: [127.0.0.1]

TASK: [install curl] **********************************************************
ok: [127.0.0.1]

TASK: [copy scripts to server] ************************************************
skipping: [127.0.0.1]

TASK: [check if specific version of Oracle JDK is installed?] *****************
skipping: [127.0.0.1]

TASK: [get JDK tarball (as tar.gz file)] **************************************
skipping: [127.0.0.1]

TASK: [mkdir for Java] ********************************************************
skipping: [127.0.0.1]

TASK: [install JDK] ***********************************************************
skipping: [127.0.0.1]

TASK: [check if specific version of Oracle JDK is installed?] *****************
ok: [127.0.0.1]

TASK: [uninstall messy packages to avoid blocking conditions] *****************
changed: [127.0.0.1]

TASK: [delete messy .rpm files to avoid blocking conditions] ******************
changed: [127.0.0.1]

TASK: [get JDK tarball (as RPM file)] *****************************************
changed: [127.0.0.1]

TASK: [install JDK] ***********************************************************
changed: [127.0.0.1]

TASK: [clean up - uninstall messy packages] ***********************************
changed: [127.0.0.1]

TASK: [clean up - delete messy .rpm files] ************************************
changed: [127.0.0.1]

TASK: [link /usr/java/default] ************************************************
changed: [127.0.0.1]

TASK: [alternatives link for "java"] ******************************************
changed: [127.0.0.1]

TASK: [alternatives link for "javac"] *****************************************
changed: [127.0.0.1]

TASK: [alternatives link for "jar"] *******************************************
changed: [127.0.0.1]

TASK: [alternatives link for "java_sdk"] **************************************
changed: [127.0.0.1]

TASK: [remove temporary downloaded files, if requested] ***********************
changed: [127.0.0.1] => (item=/tmp/jdk-8u65-linux-x64.rpm)
ok: [127.0.0.1] => (item=/tmp/jdk-8u65-linux-x64.tar.gz)
ok: [127.0.0.1] => (item=/tmp/check-tarball-installed.sh)

PLAY RECAP ********************************************************************
127.0.0.1                  : ok=16   changed=12   unreachable=0    failed=0

Validate the JDK version:

$ java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

William-Yeh avatar Nov 12 '15 09:11 William-Yeh

Ok it is working for me too. The role does not work when running with:

become: yes
become_method: sudo

sdomula avatar Nov 12 '15 09:11 sdomula

I've recorded the successful execution history of this role. Please take a look at: https://asciinema.org/a/29962

William-Yeh avatar Nov 13 '15 09:11 William-Yeh

Hm. It is still happening for me when using the mentioned become options.

I am using ansible version 1.9.4. installed with brew on latest mac OS X.

It reports the node to be unreachable:

TASK: [williamyeh.oracle-java | uninstall messy packages to avoid blocking conditions] ***
fatal: [x.x.x.x] => Traceback (most recent call last):
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/runner/__init__.py", line 586, in _executor
    exec_rc = self._executor_internal(host, new_stdin)
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/runner/__init__.py", line 789, in _executor_internal
    return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/runner/__init__.py", line 869, in _executor_internal_inner
    if not utils.check_conditional(cond, self.basedir, inject, fail_on_undefined=self.error_on_undefined_vars):
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/utils/__init__.py", line 269, in check_conditional
    conditional = template.template(basedir, presented, inject)
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/utils/template.py", line 124, in template
    varname = template_from_string(basedir, varname, templatevars, fail_on_undefined)
  File "/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/utils/template.py", line 382, in template_from_string
    res = jinja2.utils.concat(rf)
  File "<template>", line 9, in root
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/Users/user/deploy.retry

x.x.x.x                : ok=4    changed=0    unreachable=1    failed=0

sdomula avatar Nov 13 '15 13:11 sdomula

Does anybody experience the same issue in Ansible 2.0?

William-Yeh avatar Feb 23 '16 06:02 William-Yeh