forked from galaxyproject/ansible-slurm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finally devised a way to define conditional defaults without
defaults/main.yml -> vars/condition.yml -> tasks/merge.yml. Properly templateize everything. Move as much as possible to defaults to simplify tasks. Munge stuff is broken, should be fixed soon, just wanted to get this committed.
- Loading branch information
Showing
18 changed files
with
286 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,89 @@ | ||
--- | ||
|
||
slurm_upgrade: no | ||
slurm_roles: [] | ||
slurm_partitions: [] | ||
slurm_nodes: [] | ||
|
||
slurm_config_dir: "{{ '/etc/slurm-llnl' if __slurm_debian else '/etc/slurm' }}" | ||
|
||
slurm_create_user: "{{ __slurm_redhat }}" | ||
slurm_create_dirs: "{{ __slurm_redhat }}" | ||
slurm_rotate_logs: "{{ __slurm_redhat }}" | ||
slurm_configure_munge: yes | ||
|
||
# Service names are the same on both distros since ?? | ||
slurmd_service_name: slurmd | ||
slurmctld_service_name: slurmctld | ||
slurmdbd_service_name: slurmdbd | ||
|
||
__slurm_user_name: "{{ (slurm_user | default({})).name | default('slurm') }}" | ||
# TODO: this could be incorrect, use the group collection from galaxyproject.galaxy | ||
__slurm_group_name: "{{ (slurm_user | default({})).group | default((slurm_user | default({})).name) | default('slurm') }}" | ||
|
||
__slurm_debian: "{{ ansible_os_family == 'Debian' }}" | ||
__slurm_redhat: "{{ ansible_os_family == 'RedHat' }}" | ||
|
||
__slurm_config_default: | ||
AuthType: auth/munge | ||
CryptoType: crypto/munge | ||
SlurmUser: "{{ __slurm_user_name }}" | ||
ClusterName: cluster | ||
# slurmctld options | ||
SlurmctldPort: 6817 | ||
SlurmctldLogFile: "{{ '/var/log/slurm-llnl/slurmctld.log' if __slurm_debian else null }}" | ||
SlurmctldPidFile: >- | ||
{{ | ||
'/var/run/slurm-llnl/slurmctld.pid' if __slurm_debian else ( | ||
'/var/run/slurmctld.pid' if __slurm_redhat else | ||
null) | ||
}} | ||
StateSaveLocation: >- | ||
{{ | ||
'/var/lib/slurm-llnl/slurmctld' if __slurm_debian else ( | ||
'/var/lib/slurm/slurmctld' if __slurm_redhat else | ||
null) | ||
}} | ||
# slurmd options | ||
SlurmdPort: 6818 | ||
SlurmdLogFile: "{{ '/var/log/slurm-llnl/slurmd.log' if __slurm_debian else null }}" | ||
SlurmdPidFile: >- | ||
{{ | ||
'/var/run/slurm-llnl/slurmd.pid' if __slurm_debian else ( | ||
'/var/run/slurm.pid' if __slurm_redhat else | ||
null) | ||
}} | ||
SlurmdSpoolDir: >- | ||
{{ | ||
'/var/lib/slurm-llnl/slurmd' if __slurm_debian else ( | ||
'/var/spool/slurm/slurmd' if __slurm_redhat else | ||
null) | ||
}} | ||
__slurm_config_merged: "{{ __slurm_config_default | combine(slurm_config | default({})) }}" | ||
|
||
__slurm_debian_packages: | ||
client: [slurm-client, slurm-wlm-doc] | ||
slurmctld: [slurm-wlm] | ||
slurmd: [slurm-wlm] | ||
slurmdbd: [slurmdbd] | ||
|
||
__slurm_redhat_packages: | ||
client: [slurm, munge] | ||
slurmctld: [munge, slurm, slurm-slurmctld] | ||
slurmd: [munge, slurm, slurm-slurmd] | ||
slurmdbd: [munge, slurm-slurmdbd] | ||
|
||
__slurm_packages: "{{ __slurm_debian_packages if __slurm_debian else __slurm_redhat_packages }}" | ||
|
||
__slurmdbd_config_default: | ||
AuthType: auth/munge | ||
DbdPort: 6819 | ||
SlurmUser: "{{ __slurm_user_name }}" | ||
PidFile: >- | ||
{{ | ||
'/var/run/slurm-llnl/slurmdbd.pid' if __slurm_debian else ( | ||
'/var/run/slurmdbd.pid' if __slurm_redhat else | ||
null) | ||
}} | ||
LogFile: "{{ '/var/log/slurm-llnl/slurmdbd.log' if __slurm_debian else null }}" | ||
__slurmdbd_config_merged: "{{ __slurmdbd_config_default | combine(slurmdbd_config | default({})) }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
|
||
# As of 17.11, this is only created if you install the example configs package (RedHat) | ||
- name: Create slurm config dir | ||
file: | ||
path: "{{ slurm_config_dir }}" | ||
state: directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
|
||
- name: Install Slurm client | ||
package: | ||
name: "{{ __slurm_packages.client }}" | ||
state: "{{ 'latest' if slurm_upgrade else 'present' }}" | ||
|
||
- name: Include config dir creation tasks | ||
include_tasks: _inc_create_config_dir.yml | ||
when: slurm_create_dirs | ||
|
||
- name: Install log rotation configuration | ||
template: | ||
src: logrotate.j2 | ||
dest: /etc/logrotate.d/slurm | ||
when: slurm_rotate_logs | ||
|
||
- name: Install slurm.conf | ||
template: | ||
src: "slurm.conf.j2" | ||
dest: "{{ slurm_config_dir }}/slurm.conf" | ||
owner: root | ||
group: root | ||
mode: 0444 | ||
notify: | ||
- restart slurmd | ||
- restart slurmctld | ||
|
||
- name: Include munge tasks | ||
include_tasks: munge.yml | ||
when: slurm_configure_munge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
|
||
- name: Check munge dir | ||
file: | ||
path: /etc/munge | ||
owner: munge | ||
group: munge | ||
mode: 0700 | ||
state: directory | ||
|
||
- name: Install munge key | ||
action: | ||
module: decode | ||
args: | ||
content: "{{ munge_key }}" | ||
dest: /etc/munge/munge.key | ||
filter: base64 | ||
owner: munge | ||
group: munge | ||
mode: 0400 | ||
|
||
# /var/log on Ubuntu 14.04+ is group writable, which causes munge to refuse to start | ||
# NOTE: This is fixed in munge 0.5.12 | ||
- name: Check /var/log permissions | ||
stat: | ||
path: /var/log | ||
register: stat_var_log | ||
when: ansible_distribution == "Ubuntu" | ||
|
||
- name: Force munge to start with "insecure" /var/log permissions | ||
lineinfile: | ||
dest: /etc/default/munge | ||
line: 'OPTIONS="--force"' | ||
regexp: ^OPTIONS= | ||
when: ansible_distribution == "Ubuntu" and stat_var_log.stat.wgrp | ||
|
||
- name: Ensure Munge is enabled and running | ||
service: | ||
name: munge | ||
enabled: yes | ||
state: started |
Oops, something went wrong.