Comcast/ansible-sdkman

Cleanup Handler is failing if sdkman_user is 'root'

martin-huber opened this issue · 0 comments

the main-handler currently is:

- name: Cleanup SDKMAN script
  file:
    path: '{{ sdkman_tmp_dir }}/sdkman_script'
    state: absent

and fails, if sdkman_user is 'root', because the sdkman_script then is owned by 'root' but attempted to be deleted by the ansible user.

It should be

- name: Cleanup SDKMAN script
  file:
    path: '{{ sdkman_tmp_dir }}/sdkman_script'
    state: absent
  become: '{{ sdkman_user != ansible_user_id }}'
  become_user: '{{ sdkman_user }}'

Using ansible-sdkman 1.7.0 with ansible [core 2.11.9]