Skip to content
Steve Brasier edited this page Sep 9, 2021 · 31 revisions

Use a hook from a parent environment

Hooks from parent environment's don't get run by default as site.yml relies on APPLIANCES_ENVIRONMENT_ROOT to find them. But you can explicitly run them using :

# environments/child/hooks/pre/yml
- name: Import parent hook
  vars:
    appliances_environment_root: "{{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}"
  import_playbook: "{{ appliances_environment_root }}/../parent/hooks/pre.yml"

where child and parent are the environment names.

Create a cluster with a combined compute/control/login node

  • Create a group control containing just the first compute node, and add that group into hpctests, e.g. in environments/<myenv>/inventory/groups:

    [control]
    combined-compute-0
    
    [hpctests:children]
    control
  • Do NOT create a group login (that is for login-only nodes)

  • Create a post-hook like this:

    - hosts: control
      become: true
      tasks:
        - name: Prevent ansible_user's processes being killed on compute nodes at job completion
          replace:
            path: /etc/slurm/slurm.epilog.clean
            regexp: 'if \[ \$SLURM_UID -lt 100 \] ; then'
            replace: "if [[ $SLURM_UID -lt 100 || $SLURM_JOB_USER -eq {{ ansible_user }} ]] ; then"
Clone this wiki locally