|
| 1 | +--- |
| 2 | +- name: Check initial cluster has 2x nodes |
| 3 | + hosts: testohpc_login |
| 4 | + tasks: |
| 5 | + - name: Get slurm partition info |
| 6 | + command: sinfo --noheader --format="%P,%a,%l,%D,%t,%N" # using --format ensures we control whitespace |
| 7 | + register: sinfo |
| 8 | + changed_when: false |
| 9 | + - assert: # PARTITION AVAIL TIMELIMIT NODES STATE NODELIST |
| 10 | + that: "sinfo.stdout_lines == ['compute*,up,60-00:00:00,2,idle,testohpc-compute-[0-1]']" |
| 11 | + fail_msg: "FAILED - actual value: {{ sinfo.stdout_lines }}" |
| 12 | + success_msg: "OK - 2x nodes idle" |
| 13 | + |
| 14 | +- name: Add new host(s) to cluster |
| 15 | + hosts: all |
| 16 | + tasks: |
| 17 | + - name: Add new host(s) to group for slurm partition |
| 18 | + add_host: |
| 19 | + name: "{{ item }}" |
| 20 | + groups: testohpc_compute |
| 21 | + loop: "{{ groups['new'] }}" |
| 22 | + run_once: true |
| 23 | + - name: "Include ansible-role-openhpc" |
| 24 | + include_role: |
| 25 | + name: "ansible-role-openhpc/" |
| 26 | + vars: |
| 27 | + openhpc_enable: |
| 28 | + control: "{{ inventory_hostname in groups['testohpc_login'] }}" |
| 29 | + batch: "{{ inventory_hostname in groups['testohpc_compute'] }}" |
| 30 | + runtime: true |
| 31 | + openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}" |
| 32 | + openhpc_slurm_partitions: |
| 33 | + - name: "compute" |
| 34 | + openhpc_cluster_name: testohpc |
| 35 | + openhpc_slurm_configless: true |
| 36 | + |
| 37 | +- name: Check modified cluster has 3x nodes |
| 38 | + hosts: testohpc_login |
| 39 | + tasks: |
| 40 | + - name: Get slurm partition info |
| 41 | + command: sinfo --noheader --format="%P,%a,%l,%D,%t,%N" # using --format ensures we control whitespace |
| 42 | + register: sinfo |
| 43 | + changed_when: false |
| 44 | + - assert: # PARTITION AVAIL TIMELIMIT NODES STATE NODELIST |
| 45 | + that: "sinfo.stdout_lines == ['compute*,up,60-00:00:00,3,idle,testohpc-compute-[0-2]']" |
| 46 | + fail_msg: "FAILED - actual value: {{ sinfo.stdout_lines }}" |
| 47 | + success_msg: "OK - 3x nodes idle" |
0 commit comments