diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7ea07c6..52d6b673 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ jobs: matrix: image: - 'centos:8.2.2004' + - 'centos:8.3.2011' - 'centos:7' scenario: - test1 @@ -23,6 +24,10 @@ jobs: - test2 - test3 - test4 + - test5 + exclude: + - image: 'centos:7' + scenario: test5 steps: - name: Check out the codebase. diff --git a/molecule/README.md b/molecule/README.md index 061fe5ff..6baa43c2 100644 --- a/molecule/README.md +++ b/molecule/README.md @@ -2,17 +2,17 @@ Molecule tests for the role. # Test Matrix -Test options "flow down" through table unless changed. +Test options in "Other" column flow down through table unless changed. Test | # Partitions | Groups in partitions? | Other --- | --- | --- | --- -test1 | 1 | N | 2x compute node, sequential names (default test) +test1 | 1 | N | 2x compute node, sequential names (default test), config on all nodes test1b | 1 | N | 1x compute node test1c | 1 | N | 2x compute nodes, nonsequential names test2 | 2 | N | 4x compute node, sequential names test3 | 1 | Y | - test4 | 1 | N | 2x compute node, accounting enabled - +test5 | 1 | N | As for #1 but configless # Local Installation & Running diff --git a/molecule/test5/INSTALL.rst b/molecule/test5/INSTALL.rst new file mode 100644 index 00000000..d926ca25 --- /dev/null +++ b/molecule/test5/INSTALL.rst @@ -0,0 +1,22 @@ +******* +Docker driver installation guide +******* + +Requirements +============ + +* Docker Engine + +Install +======= + +Please refer to the `Virtual environment`_ documentation for installation best +practices. If not using a virtual environment, please consider passing the +widely recommended `'--user' flag`_ when invoking ``pip``. + +.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ +.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site + +.. code-block:: bash + + $ python3 -m pip install 'molecule[docker]' diff --git a/molecule/test5/converge.yml b/molecule/test5/converge.yml new file mode 100644 index 00000000..670f11f6 --- /dev/null +++ b/molecule/test5/converge.yml @@ -0,0 +1,19 @@ +--- +- name: Converge + hosts: all + tasks: + - name: "Include ansible-role-openhpc" + include_role: + name: "ansible-role-openhpc/" + vars: + openhpc_enable: + control: "{{ inventory_hostname in groups['testohpc_login'] }}" + batch: "{{ inventory_hostname in groups['testohpc_compute'] }}" + runtime: true + openhpc_slurm_service_enabled: true + openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}" + openhpc_slurm_partitions: + - name: "compute" + openhpc_cluster_name: testohpc + openhpc_slurm_configless: true + diff --git a/molecule/test5/molecule.yml b/molecule/test5/molecule.yml new file mode 100644 index 00000000..b1a5776a --- /dev/null +++ b/molecule/test5/molecule.yml @@ -0,0 +1,48 @@ +--- +name: single partition, group is partition +driver: + name: docker +platforms: + - name: testohpc-login-0 + image: ${MOLECULE_IMAGE} + pre_build_image: true + groups: + - testohpc_login + command: /sbin/init + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + networks: + - name: net1 + - name: testohpc-compute-0 + image: ${MOLECULE_IMAGE} + pre_build_image: true + groups: + - testohpc_compute + command: /sbin/init + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + networks: + - name: net1 + - name: testohpc-compute-1 + image: ${MOLECULE_IMAGE} + pre_build_image: true + groups: + - testohpc_compute + command: /sbin/init + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + networks: + - name: net1 +provisioner: + name: ansible +verifier: + name: ansible diff --git a/molecule/test5/verify.yml b/molecule/test5/verify.yml new file mode 100644 index 00000000..e3f24763 --- /dev/null +++ b/molecule/test5/verify.yml @@ -0,0 +1,12 @@ +--- + +- name: Check slurm hostlist + hosts: testohpc_login + tasks: + - name: Get slurm partition info + command: sinfo --noheader --format="%P,%a,%l,%D,%t,%N" # using --format ensures we control whitespace + register: sinfo + - name: + assert: # PARTITION AVAIL TIMELIMIT NODES STATE NODELIST + that: "sinfo.stdout_lines == ['compute*,up,60-00:00:00,2,idle,testohpc-compute-[0-1]']" + fail_msg: "FAILED - actual value: {{ sinfo.stdout_lines }}" diff --git a/tasks/install.yml b/tasks/install.yml index 8a8fc103..f58e6c24 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -19,10 +19,17 @@ include_vars: file: "ohpc-{{ ansible_facts.packages['ohpc-release'][0]['version'] }}" +- name: Find CentOS8 PowerTools repo + find: + paths: /etc/yum.repos.d + patterns: CentOS-*PowerTools.repo + register: powertools + when: ansible_distribution_major_version == "8" + - name: Enable CentOS8 PowerTools repo # NB: doesn't run command `dnf config-manager --set-enabled PowerTools` as can't make that idempotent lineinfile: - path: /etc/yum.repos.d/CentOS-PowerTools.repo + path: "{{ powertools.files[0].path }}" # 8.2: /etc/yum.repos.d/CentOS-PowerTools.repo 8.3: /etc/yum.repos.d/CentOS-Linux-PowerTools.repo create: false # raises error if not already installed regexp: enabled= line: enabled=1