48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
---
|
|
- name: Ensure unzip is installed
|
|
ansible.builtin.package:
|
|
name: unzip
|
|
state: present
|
|
|
|
- name: Ensure custom facts directory exists
|
|
ansible.builtin.file:
|
|
mode: 0755
|
|
path: /etc/ansible/facts.d
|
|
state: directory
|
|
|
|
- name: Fetch latest Deno version if 'latest' is specified
|
|
ansible.builtin.uri:
|
|
url: https://api.github.com/repos/denoland/deno/releases/latest
|
|
register: deno_latest_release
|
|
when: deno_version == 'latest'
|
|
|
|
- name: Set actual Deno version
|
|
ansible.builtin.set_fact:
|
|
actual_deno_version: "{{ deno_latest_release.json.tag_name | replace('v','') if deno_version == 'latest' else deno_version }}"
|
|
|
|
- name: Determine whether or not the specified version of Deno is already installed
|
|
ansible.builtin.set_fact:
|
|
install_deno: "{{ (ansible_local.deno is not defined) or
|
|
((ansible_local.deno is defined) and
|
|
(ansible_local['deno']['settings']['version'] != actual_deno_version)) }}"
|
|
|
|
- name: Ensure Deno is installed
|
|
unarchive:
|
|
src: "https://github.com/denoland/deno/releases/download/v{{ actual_deno_version }}/deno-x86_64-unknown-linux-gnu.zip"
|
|
dest: /usr/local/bin
|
|
mode: 0755
|
|
remote_src: true
|
|
extra_opts:
|
|
- -j
|
|
when: install_deno
|
|
|
|
- name: Save meta information about the version of Deno that was installed
|
|
community.general.ini_file:
|
|
path: /etc/ansible/facts.d/deno.fact
|
|
mode: 0644
|
|
section: settings
|
|
option: version
|
|
value: "{{ actual_deno_version }}"
|
|
backup: true
|
|
no_extra_spaces: true
|
|
when: install_deno |