Comcast / ansible-sdkman

An Ansible role that installs, configures, and manages SDKMAN
https://galaxy.ansible.com/Comcast/sdkman/
Apache License 2.0
58 stars 28 forks source link

New version is broken - fail to deploy with the playbook example #21

Closed danielporto closed 6 years ago

danielporto commented 6 years ago

I tried to re-run the installation playbook given as an example (and pasted below) and it failed. When I downgrade it to version 1.3.0 it runs without problems. Running the playbook on mac to deploy on Centos7.

- hosts: clients_cluster, leader, replicas
  become: no
  any_errors_fatal: true
  vars_files:
      - play-vars.yml

  roles:
    - role: Comcast.sdkman
      sdkman_dir: "{{ sdkman_folder }}"
      sdkman_auto_answer: true
      sdkman_update: true
      sdkman_install_packages:
        - { candidate: java, version: "{{ java_version }}" }
        - { candidate: ant, version: "{{ ant_version }}" }
      sdkman_flush_caches_before:
        - temp
      sdkman_flush_caches_after:
        - archives
        - broadcast
        - candidates
        - temp

EDIT: @samrocketman added code blocks to ansible example.

elliotweiser commented 6 years ago

Would you mind sharing some output from the playbook execution? “It failed” isn’t much to go on. While you’re at it, cranking up the verbosity would help.

danielporto commented 6 years ago

Sure, here is the simplified output (the -vvv one is too bloated and the error message doesnt help):

PLAY [clients_cluster, leader, replicas] **

TASK [Gathering Facts] **** ok: [capsulecorp_oc0]

TASK [Comcast.sdkman : include_tasks] ***** included: /Volumes/data/Users/dan/.ansible/roles/Comcast.sdkman/tasks/install.yml for capsulecorp_oc0

TASK [Comcast.sdkman : Determine SDKMAN vars] ***** ok: [capsulecorp_oc0]

TASK [Comcast.sdkman : Include system vars] *** ok: [capsulecorp_oc0] => (item=/Volumes/data/Users/dan/.ansible/roles/Comcast.sdkman/vars/RedHat.yml)

TASK [Comcast.sdkman : Install system packages] *** ok: [capsulecorp_oc0] => (item=curl) ok: [capsulecorp_oc0] => (item=findutils) ok: [capsulecorp_oc0] => (item=libselinux-python) ok: [capsulecorp_oc0] => (item=libstdc++) ok: [capsulecorp_oc0] => (item=tar) ok: [capsulecorp_oc0] => (item=unzip) ok: [capsulecorp_oc0] => (item=which) ok: [capsulecorp_oc0] => (item=zip)

TASK [Comcast.sdkman : include] *** skipping: [capsulecorp_oc0]

TASK [Comcast.sdkman : Check for SDKMAN installation] ***** ok: [capsulecorp_oc0]

TASK [Comcast.sdkman : Download SDKMAN] *** skipping: [capsulecorp_oc0]

TASK [Comcast.sdkman : Run SDKMAN script] ***** skipping: [capsulecorp_oc0]

TASK [Comcast.sdkman : Cleanup SDKMAN script] ***** skipping: [capsulecorp_oc0]

TASK [Comcast.sdkman : Fix permissions on SDKMAN_DIR] ***** ok: [capsulecorp_oc0]

TASK [Comcast.sdkman : include_tasks] ***** included: /Volumes/data/Users/dan/.ansible/roles/Comcast.sdkman/tasks/sdkman.yml for capsulecorp_oc0

TASK [Comcast.sdkman : Configure SDKMAN] ** ok: [capsulecorp_oc0]

TASK [Comcast.sdkman : Flush SDK caches (before)] ***** failed: [capsulecorp_oc0] (item=temp) => {"changed": false, "cmd": ". /home/goku/kaioken/sdkman/bin/sdkman-init.sh && sdk flush temp", "delta": "0:00:00.005927", "end": "2018-09-25 20:52:44.635007", "item": "temp", "msg": "non-zero return code", "rc": 127, "start": "2018-09-25 20:52:44.629080", "stderr": "find: ‘/home/goku/.sdkman/src’: No such file or directory\nfind: ‘/home/goku/.sdkman/ext’: No such file or directory\ntouch: cannot touch ‘/home/goku/.sdkman/var/delay_upgrade’: No such file or directory\n/home/goku/kaioken/sdkman/bin/sdkman-init.sh: line 103: /home/goku/.sdkman/var/candidates: No such file or directory\n/home/goku/kaioken/sdkman/bin/sdkman-init.sh: line 104: sdkman_echo_debug: command not found\n/bin/bash: sdk: command not found", "stderr_lines": ["find: ‘/home/goku/.sdkman/src’: No such file or directory", "find: ‘/home/goku/.sdkman/ext’: No such file or directory", "touch: cannot touch ‘/home/goku/.sdkman/var/delay_upgrade’: No such file or directory", "/home/goku/kaioken/sdkman/bin/sdkman-init.sh: line 103: /home/goku/.sdkman/var/candidates: No such file or directory", "/home/goku/kaioken/sdkman/bin/sdkman-init.sh: line 104: sdkman_echo_debug: command not found", "/bin/bash: sdk: command not found"], "stdout": "", "stdout_lines": []}

NO MORE HOSTS LEFT ****

PLAY RECAP **** capsulecorp_oc0 : ok=13 changed=0 unreachable=0 failed=1

elliotweiser commented 6 years ago

It looks like the SDKMAN_DIR variable is not being respected for some reason. It shouldn't be looking in /home/goku/.sdkman if you've overwritten sdkman_dir to /home/goku/kaioken/sdkman. I'll see if I can reproduce it.

A few other details that might be helpful:

Thanks!

danielporto commented 6 years ago

local: ansible 2.6.2 python version = 2.7.15 (default, Jul 23 2018, 21:27:06) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)]

remote: python: 2.7.5 centos 7 minimal installation, latest update, baremetal.

elliotweiser commented 6 years ago

Found the problem:

This doesn't do anything https://github.com/Comcast/ansible-sdkman/blob/master/tasks/main.yml#L7-L8

Related issue: https://github.com/ansible/ansible/issues/42990

I'll cook up a fix tomorrow.

danielporto commented 6 years ago

Great job!! Looking forward to seeing it in production. I've just found another bug but in v1.3.0. I want to see if it remains in v1.4.0 before submitting another issue.

elliotweiser commented 6 years ago

Fix is released in 1.4.1. If you find that bug you're looking for in the latest version, please don't hesitate to let us know.