Skip to content

Commit

Permalink
(fix) Fork the Deno role until ProfessorManhattan/ansible-deno#1 is f…
Browse files Browse the repository at this point in the history
…ixed
  • Loading branch information
ELLIOTTCABLE committed Jun 30, 2023
1 parent 40e94a1 commit e68408c
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Infrastructure/playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
become: true
- role: dokku_bot.ansible_dokku
become: true
- professormanhattan.deno
- deno
- windmill

vars:
Expand Down
41 changes: 41 additions & 0 deletions Infrastructure/roles/deno/tasks/install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copied from the (broken) ansible-deno:
# <https://github.com/megabyte-labs/ansible-deno/blob/3a0f96ed5049f145c3e45c8e336cf9e536af771a/tasks/install-Linux.yml>

---
- name: Ensure custom facts directory exists
file:
mode: 0755
path: /etc/ansible/facts.d
state: directory

- name: "Detect the latest {{ app_name }} version"
uri:
url: https://api.github.com/repos/denoland/deno/releases/latest
register: deno_latest_release_tag

- name: "Determine whether or not the latest version of {{ app_name }} is already installed"
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',''))) }}"

- name: "Ensure {{ app_name }} is installed"
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
when: install_deno

- name: "Save meta information about the version of {{ app_name }} that was installed"
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
when: install_deno
7 changes: 7 additions & 0 deletions Infrastructure/roles/deno/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# @action Installs Deno
# Ensures Deno is installed on macOS, Linux, and Windows systems
- name: Include tasks based on the operating system
become: true
block:
- include_tasks: "install.yaml"
2 changes: 2 additions & 0 deletions Infrastructure/roles/deno/vars/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
app_name: Deno

0 comments on commit e68408c

Please sign in to comment.