Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install and configure Apptainer #4

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions roles/apptainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# apptainer

Install and configure Apptainer on RedHat and Debian systems.

## Usage

| Name | Description | Default |
| ---- | ----------- | ------- |
|`apptainer_deb_repository` | DEB repository to install Apptainer from | "ppa:apptainer/ppa" |
|`apptainer_deb_package` | Apptainer DEB package to install | "apptainer=1.3.4*" |
|`apptainer_rpm_repository` | RPM repository to install Apptainer from | UNSET |
|`apptainer_rpm_package` | Apptainer RPM package to install | "apptainer=1.3.6" |
|`apptainer_config_overrides` | Configuration overrides to apply to Apptainer config| `[]` |
14 changes: 14 additions & 0 deletions roles/apptainer/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

apptainer_deb_repository: "ppa:apptainer/ppa"

apptainer_deb_package: "apptainer=1.3.4*"

apptainer_rpm_repository:

apptainer_rpm_package: "apptainer-1.3.6"

# e.g.
# - directive: "mount tmp"
# value: "no"
apptainer_config_overrides: []
9 changes: 9 additions & 0 deletions roles/apptainer/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

- name: Override Apptainer config directives
command:
cmd: apptainer config global --set "{{ item.directive }}" "{{ item.value }}"
become: true
loop: "{{ apptainer_config_overrides }}"
loop_control:
label: "{{ item.directive }} = {{ item.value }}"
58 changes: 58 additions & 0 deletions roles/apptainer/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---

- name: Configure repository for Apptainer packages [deb]
apt_repository:
repo: "{{ apptainer_deb_repository }}"
update_cache: true
become: true
when: ansible_os_family == 'Debian'

- name: Install Apptainer packages [deb]
apt:
name: "{{ apptainer_deb_package }}"
state: present
allow_downgrade: yes
become: true
when: ansible_os_family == 'Debian'

- name: Configure repository for Apptainer packages [rpm]
yum_repository:
name: "{{ apptainer_rpm_repository.name }}"
description: >-
"{% if 'description' in apptainer_rpm_repository %}
{{ apptainer_rpm_repository.description }}
{% else %}
{{ apptainer_rpm_repository.name }} repository
{% endif %}"
baseurl: "{{ apptainer_rpm_repository.baseurl | default(omit)}}"
file: "{{ apptainer_rpm_repository.file | default(omit)}}"
gpgkey: "{{ apptainer_rpm_repository.gpgkey | default(omit)}}"
gpgcheck: "{{ apptainer_rpm_repository.gpgcheck | default(omit)}}"
cost: "{{ apptainer_rpm_repository.cost | default(omit)}}"
enabled: "{{ apptainer_rpm_repository.enabled | default(omit)}}"
exclude: "{{ apptainer_rpm_repository.exclude | default(omit)}}"
gpgcakey: "{{ apptainer_rpm_repository.gpgcakey | default(omit)}}"
includepkgs: "{{ apptainer_rpm_repository.includepkgs | default(omit)}}"
metadata_expire: "{{ apptainer_rpm_repository.metadata_expire | default(omit)}}"
metalink: "{{ apptainer_rpm_repository.metalink | default(omit)}}"
mirrorlist: "{{ apptainer_rpm_repository.mirrorlist | default(omit)}}"
mirrorlist_expire: "{{ apptainer_rpm_repository.mirrorlist_expire | default(omit)}}"
password: "{{ apptainer_rpm_repository.password | default(omit) }}"
priority: "{{ apptainer_rpm_repository.priority | default(omit)}}"
proxy: "{{ apptainer_rpm_repository.proxy | default(omit)}}"
proxy_password: "{{ apptainer_rpm_repository.proxy_password | default(omit)}}"
proxy_username: "{{ apptainer_rpm_repository.proxy_username | default(omit)}}"
repo_gpgcheck: "{{ apptainer_rpm_repository.repo_gpgcheck | default(omit)}}"
sslverify: "{{ apptainer_rpm_repository.sslverify | default(omit)}}"
username: "{{ apptainer_rpm_repository.username | default(omit) }}"
state: "{{ apptainer_rpm_repository.state | default(omit)}}"
become: true
when:
- ansible_os_family == 'RedHat'
- apptainer_rpm_repository

- name: Install Apptainer packages [rpm]
dnf:
name: "{{ apptainer_rpm_package }}"
become: true
when: ansible_os_family == 'RedHat'
7 changes: 7 additions & 0 deletions roles/apptainer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

- name: Install Apptainer
include_tasks: install.yml

- name: Configure Apptainer
import_tasks: configure.yml
12 changes: 12 additions & 0 deletions roles/nextflow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# nextflow

Install and configure Nextflow on RedHat and Debian systems.

## Usage

| Name | Description | Default |
| ---- | ----------- | ------- |
|`nextflow_openjdk_package_name` | Name of a package that provides Java JDK > 11 | "java-21-openjdk" or "openjdk-21-jdk" |
|`nextflow_version` | Nextflow version to install | "v24.10.4" |
|`nextflow_executable_url` | URL to download Nextflow from | https://github.com/nextflow-io/nextflow/releases/download/{{ nextflow_version }}/nextflow |
|`nextflow_skel_config` | Config to add to /etc/skel/.nextflow/config | UNSET |
14 changes: 14 additions & 0 deletions roles/nextflow/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

nextflow_openjdk_package_name: >-
{{
'java-21-openjdk'
if ansible_os_family == 'RedHat'
else 'openjdk-21-jdk'
}}

nextflow_version: "v24.10.4"

nextflow_executable_url: https://github.com/nextflow-io/nextflow/releases/download/{{ nextflow_version }}/nextflow

nextflow_skel_config:
15 changes: 15 additions & 0 deletions roles/nextflow/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

- name: Create Nextflow config directory in /etc/skel
file:
state: directory
path: /etc/skel/.nextflow
when: nextflow_skel_config
become: true

- name: Write Nextflow config file to /etc/skel
copy:
dest: /etc/skel/.nextflow/config
content: "{{ nextflow_skel_config }}"
become: true
when: nextflow_skel_config
13 changes: 13 additions & 0 deletions roles/nextflow/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---

- name: Install OpenJDK
package:
name: "{{ nextflow_openjdk_package_name }}"
become: true

- name: Install Nextflow
get_url:
url: "{{ nextflow_executable_url }}"
dest: /usr/local/bin/nextflow
mode: u=rwx,g=rx,o=rx
become: true
7 changes: 7 additions & 0 deletions roles/nextflow/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

- name: Install Nextflow
include_tasks: install.yml

- name: Configure Nextflow
import_tasks: configure.yml