2023-08-03 15:49:38 +00:00
|
|
|
---
|
|
|
|
- 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
|
|
|
|
|
2023-08-12 21:59:36 +00:00
|
|
|
- name: 'Detect the latest Deno version'
|
2023-08-03 15:49:38 +00:00
|
|
|
ansible.builtin.uri:
|
|
|
|
url: https://api.github.com/repos/denoland/deno/releases/latest
|
|
|
|
register: deno_latest_release_tag
|
|
|
|
|
2023-08-12 21:59:36 +00:00
|
|
|
- name: 'Determine whether or not the latest version of Deno is already installed'
|
2023-08-03 15:49:38 +00:00
|
|
|
ansible.builtin.set_fact:
|
|
|
|
install_deno: "{{ (ansible_local.deno is not defined) or \
|
|
|
|
((ansible_local.deno is defined) and \
|
|
|
|
(ansible_local['deno']['settings']['version'] != deno_latest_release_tag.json.tag_name | replace('v',''))) }}"
|
|
|
|
|
2023-08-12 21:59:36 +00:00
|
|
|
- name: 'Ensure Deno is installed'
|
2023-08-03 15:49:38 +00:00
|
|
|
unarchive:
|
|
|
|
src: 'https://github.com/denoland/deno/releases/download/{{ deno_latest_release_tag.json.tag_name }}/deno-x86_64-unknown-linux-gnu.zip'
|
|
|
|
dest: /usr/local/bin
|
|
|
|
mode: 0755
|
|
|
|
remote_src: true
|
|
|
|
extra_opts:
|
|
|
|
- -j
|
2023-08-11 19:28:48 +00:00
|
|
|
when: install_deno
|
2023-08-03 15:49:38 +00:00
|
|
|
|
2023-08-12 21:59:36 +00:00
|
|
|
- name: 'Save meta information about the version of Deno that was installed'
|
2023-08-03 15:49:38 +00:00
|
|
|
community.general.ini_file:
|
|
|
|
path: /etc/ansible/facts.d/deno.fact
|
|
|
|
mode: 0644
|
|
|
|
section: settings
|
|
|
|
option: version
|
|
|
|
value: "{{ deno_latest_release_tag.json.tag_name | replace('v','') }}"
|
|
|
|
backup: true
|
|
|
|
no_extra_spaces: true
|
2023-08-11 19:28:48 +00:00
|
|
|
when: install_deno
|