zuul-jobs/roles/ensure-nimble/tasks/main.yaml
Albin Vass b209381be0 Add nimble roles and job
Installs nim toolchains using choosenim (similar to rustup),
installs dependencies and builds nim projects using
the package manager nimble.

See:
https://nim-lang.org/
https://github.com/nim-lang/nimble
https://github.com/dom96/choosenim

Change-Id: I95e7e02eb975200aed7680880b945261888de5ca
2020-11-08 09:36:05 +01:00

36 lines
952 B
YAML

- name: Set nim_path fact
set_fact:
nim_path: "{{ ansible_user_dir }}/.nimble/bin/"
cacheable: true
- name: Check if nimble is installed
command: nimble --version
environment:
PATH: "{{ nim_path }}:{{ ansible_env.PATH }}"
failed_when: false
changed_when: false
register: _nimble_installed
- when: _nimble_installed.rc != 0
block:
- name: Create tempfile for choosenim install script
tempfile:
register: choosenim_installer
- name: Install nim with choosenim
get_url:
url: https://nim-lang.org/choosenim/init.sh
dest: "{{ choosenim_installer.path }}"
mode: 0755
- name: Install nim
command: "{{ choosenim_installer.path }} -y"
environment:
CHOOSENIM_NO_ANALYTICS: 1
CHOOSENIM_CHOOSE_VERSION: "{{ nim_version }}"
always:
- name: Remove installer tempfile
file:
state: absent
path: "{{ choosenim_installer.path }}"