Issue
I have installed gradel-5.4.1 manually using the command sudo curl -O -k -L -v -X https\://services.gradle.org/distributions/gradle-5.4.zip
Now I want to automate this task using an ansible-playbook. This is what i have tried, however it does not work. The playbook and the error message is below.
please help??
Playbook:
---
- hosts: servers
become: yes
tasks:
- name: create a Directory /opt/gradle
file:
path: ~/opt/gradel
state: directory
mode: 0755
- name: Unarchive a file that needs to be downloaded (added in 2.0)
unarchive:
src: https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
dest: ~/
remote_src: yes
Error Message:
fatal: FAILED! => {"changed": false, "msg": "Failure downloading https\\://services.gradle.org/distributions/gradle-5.4.1-bin.zip, Request failed: <urlopen error unknown url type: https\\>"}
Solution
I'm not sure why you included a random backslash, but as the message clearly indicated, https\
is not a legal protocol
- name: Unarchive a file that needs to be downloaded (added in 2.0)
unarchive:
src: https://services.gradle.org/distributions/gradle-5.4.1-bin.zip
dest: ~/
remote_src: yes
I also have suspicions about dest: ~/
because that ~/
nomenclature is a shell construct, and not an actual path, but it's possible ansible will use os.path.expanduser
and you'll get away with it. Otherwise you'll want to replace that with dest: "{{ ansible_env.HOME }}/"
Answered By - mdaniel Answer Checked By - Marilyn (WPSolving Volunteer)