zuul-jobs/roles/ensure-nimble/tasks/main.yaml
Ian Wienand 6d23d20f2f linters: add names to blocks
This is preparation for a later version of ansbile-lint, which finds
missing names on blocks.  This seems a reasonable rule, and the
Ansible manual says [1]

  Names for blocks have been available since Ansible 2.3. We recommend
  using names in all tasks, within blocks or elsewhere, for better
  visibility into the tasks being executed when you run the playbook.

This simply adds a name tag for blocks that are missing it.  This
should have no operational change, but allows us to update the linter
in a follow-on change.

[1] https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html

Change-Id: I92ed4616775650aced352bc9088a07e919f1a25f
2022-07-27 17:13:39 +10:00

46 lines
1.3 KiB
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
- name: Install nimble
when: _nimble_installed.rc != 0
block:
# Current version of nimble is not compatible with openssl3, which is included in CentOS9
- name: Install compat-openssl11 in CentOS 9
package:
name: compat-openssl11
become: yes
when:
- ansible_distribution == 'CentOS'
- ansible_distribution_major_version == '9'
- 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 }}"