Skip to content

Commit

Permalink
Merge pull request #42 from grycap/devel
Browse files Browse the repository at this point in the history
Improve test
  • Loading branch information
micafer authored Dec 7, 2023
2 parents 44e9ad5 + 1bc26d9 commit 250ef98
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: pip3 install ansible molecule-plugins[docker] docker

- name: Run Molecule tests.
run: molecule test
run: molecule test --all
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
Expand Down
4 changes: 3 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,6 @@ slurm_default_conf_options:
slurm_conf_options: {}
# SLURM configuration options for cgroup
slurm_cgroup_conf_options:
CgroupPlugin: cgroup/v1
CgroupPlugin: cgroup/v1
# Add extra nodes to the /etc/hosts (elastic version)
add_extra_hosts: true
23 changes: 23 additions & 0 deletions molecule/cluster/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: Converge
hosts: all
become: true

tasks:

- name: "Include grycap.slurm"
include_role:
name: "ansible-role-slurm"
vars:
slurm_wn_cpus: 2
slurm_wn_mem: 1048576
slurm_wn_gres: "gpu:tesla:2"
slurm_server_name: slurmserver
slurm_wn_ips: "{{ groups['wn'] | map('extract', hostvars,'facter_ipaddress') | list }}"
slurm_vnode_prefix: vnode-
max_number_of_nodes: 1
drmaa_lib_install: true
drmaa_lib_version: 1.1.4
slurm_version: 21.08.8
add_extra_hosts: false

61 changes: 61 additions & 0 deletions molecule/cluster/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
scenario:
name: cluster
test_sequence:
- dependency
- destroy
- create
- prepare
- converge
# - idempotence
- verify
- destroy
dependency:
name: galaxy
driver:
name: docker
verifier:
name: ansible
platforms:
- name: slurmserver
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
groups:
- front
networks:
- name: "slurm"
network_mode: "slurm"
published_ports:
- 6818/tcp
- 6817/tcp
- name: vnode-1
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
groups:
- wn
networks:
- name: "slurm"
network_mode: "slurm"
published_ports:
- 6818/tcp
- 6817/tcp
provisioner:
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
inventory:
group_vars:
front:
slurm_type_of_node: "front"
wn:
slurm_type_of_node: "wn"
3 changes: 3 additions & 0 deletions molecule/default/prepare.yml → molecule/cluster/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
apt:
update_cache: yes
when: ansible_os_family == "Debian"

roles:
- role: kevincoakley.facter
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- name: geerlingguy.ntp
- name: grycap.ssh
- name: grycap.munge
- name: kevincoakley.facter
6 changes: 3 additions & 3 deletions molecule/default/verify.yml → molecule/cluster/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

- name: Check service running
fail:
msg: "Error getting node info"
when:
- "'NodeName=vnode-1' not in nodes.stdout"
msg: "Error getting node IDLE state"
when: "'NodeName=vnode-1' not in nodes.stdout or 'State=IDLE' not in nodes.stdout"

41 changes: 0 additions & 41 deletions molecule/default/converge.yml

This file was deleted.

30 changes: 0 additions & 30 deletions molecule/default/molecule.yml

This file was deleted.

1 change: 1 addition & 0 deletions tasks/front.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
item="{{slurm_vnode_prefix}}${i}";
grep -q "\<${item}\>" /etc/hosts || echo "127.0.0.1 ${item}.localdomain ${item}" >> /etc/hosts;
done
when: add_extra_hosts

- name: Create the slurm.conf file
template: dest={{ SLURM_CONF_DIR }}/slurm.conf src=slurm.conf.j2
Expand Down

0 comments on commit 250ef98

Please sign in to comment.