Implement Singularity deployment from a DEB package

This commit is contained in:
Alexander Gorelyshev
2026-05-14 16:43:16 +04:00
parent 46e0f25761
commit 5b724a3869
9 changed files with 182 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
---
- name: Converge
hosts: all
pre_tasks:
- name: "Update apt cache"
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
roles:
- role: "genlab.common.singularity_deb"

View File

@@ -0,0 +1,27 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: ubuntu
image: geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2404}-ansible:latest
pre_build_image: true
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
provisioner:
name: ansible
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint .

View File

@@ -0,0 +1,39 @@
---
- name: Verify
hosts: all
gather_facts: false
any_errors_fatal: true
pre_tasks:
- name: "Verify | include default vars"
ansible.builtin.include_vars:
dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/defaults/"
extensions: ['yml']
tasks:
- name: "Verify | check the installed Singularity version"
register: singularity_deb_installed_version
changed_when: false
ansible.builtin.command:
cmd: singularity --version
- name: "Verify | assert installed version correctness"
tags: singularity
vars:
installed: "{{ singularity_deb_installed_version.stdout }}"
expected: "singularity-ce version {{ singularity_deb_version }}-{{ singularity_deb_os_name }}"
ansible.builtin.assert:
that: installed == expected
success_msg: "OK, expected version present: '{{ installed }}'"
fail_msg: "Unexpected Singularity version: '{{ installed }}'"
# - name: "Assert version correctness"
# ansible.builtin.assert:
# that: singularity_installed_version.stdout == "singularity version " + singularity_deb_version
# success_msg: "Found the expected Singularity version: '{{ singularity_version }}'"
# fail_msg: "Unexpected Sinagularity version ({{ singularity_installed_version }})"
- name: "Verify | test Singularity deployment with a 'hello-world' job" # noqa: no-changed-when
changed_when: false
ansible.builtin.command:
cmd: "singularity --debug run shub://GodloveD/lolcow"