build cobald image from slurm role, separated tags

This commit is contained in:
2021-06-22 16:48:56 +02:00
parent 78850d4636
commit 1f4dfe1821
8 changed files with 98 additions and 77 deletions

View File

@@ -3,7 +3,8 @@
name: [ slurm, slurm-doc ]
state: present
- include_tasks:
- name: build docker images for slurm
include_tasks:
file: dockerimage.yml
loop:
- name: slurmctld
@@ -36,7 +37,8 @@
group: munge
mode: u=rw,g=,o=
- file:
- name: create munge key directory for containers
file:
path: /container/volumes/munge
state: directory
owner: munge
@@ -51,7 +53,8 @@
src: /etc/munge/munge.key
dest: /container/volumes/munge/munge.key
- file:
- name: make slurm directory
file:
path: /container/volumes/slurm/
state: directory
@@ -78,29 +81,6 @@
name: slurm-shared
state: present
- set_fact:
slurm_nodes_std: # default nodes: controller and submit machine
- machine: ctl
image: slurm:slurmctld
exposed_ports: [ "6817:6817/tcp" ]
- machine: submit1
image: slurm:slurmd
extra_mounts:
- "/home/{{unpriv_user}}/job3/:/mnt/:rw"
slurm_nodes_exec: | # extend range to execute nodes list
{% set slurm_nodes_exec = slurm_nodes_exec | default([]) %}
{% for i in range(1, num_nodes+1) -%}
{% set _ = slurm_nodes_exec.extend([
{'machine':'exec%s'|format(i), 'image': 'slurm:slurmd'}]) -%}
{%- endfor %}
{{ slurm_nodes_exec }}
slurm_default_mounts:
- /container/volumes/slurm/:/etc/slurm/:rw
- /container/volumes/munge/munge.key:/etc/munge/munge.key:rw
- slurm-shared:/shared/:rw
slurm_network: "{{docker_network}}"
tags: [ slurm-config ]
# TODO: reserve some address using docker_network_info and assign as aux
# address to enable slurmctld to get a static address in order to be
# reachable from slurm running on docker host to enable submitting jobs.
@@ -113,7 +93,7 @@
volumes: "{{ slurm_default_mounts + ( item.extra_mounts | default([]) ) }}"
ports: "{{ item.exposed_ports | default([]) }}"
networks:
- name: "{{ slurm_network }}"
- name: "{{ docker_network }}"
env:
slurmuser: "{{ slurm_user }}"
image: "{{ item.image }}"
@@ -123,14 +103,14 @@
privileged: "{{ container_privileged | bool }}"
networks_cli_compatible: True
interactive: True
vars:
vars: # see vars/main.yml
slurm_nodes_all: "{{ slurm_nodes_exec + slurm_nodes_std }}"
loop: "{{ slurm_nodes_all }}"
loop_control:
label: "{{slurm_prefix}}-{{ item.machine }}"
tags: [ slurm-config ]
- name: set facts to be used by other modules
- name: export facts about slurm cluster to be used by other modules
set_fact:
slurm:
user: "{{slurm_user}}"
@@ -138,3 +118,4 @@
base_image: "slurm:base"
mounts: "{{slurm_default_mounts}}"
network: "{{docker_network}}"
tags: always