commit 139b890e7774608b10787add0833d2916120b4b9 Author: Nate Coraor Date: Tue Apr 5 17:35:18 2016 -0400 Buncha updates for Jetstream diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..e302edd --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,18 @@ +--- + +# FIXME: these are all broken (they need to be run only when a particular +# service is enabled on that host +#- name: reload slurmd +# service: +# name: "{{ slurmd_service_name }}" +# state: reloaded +# +#- name: reload slurmctld +# service: +# name: "{{ slurmctld_service_name }}" +# state: reloaded +# +#- name: reload slurmdbd +# service: +# name: "{{ slurmdbd_service_name }}" +# state: reloaded diff --git a/tasks/elastic.yml b/tasks/elastic.yml new file mode 100644 index 0000000..1ba85f2 --- /dev/null +++ b/tasks/elastic.yml @@ -0,0 +1,14 @@ +--- + +- name: Install virtualenv (yum) + yum: + pkg: python-virtualenv + when: ansible_os_family == "RedHat" + +- name: Create virtualenv for elastic components + pip: + name: "{{ item }}" + virtualenv: "/opt/slurm_cloud_provision" + with_items: + - shade + - ansible diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..d9c09b4 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,155 @@ +--- + +- name: Include OS vars + include_vars: "{{ ansible_os_family | lower }}.yml" + +- name: Install Slurm (apt) + apt: + pkg: slurm-llnl + when: ansible_os_family == "Debian" + +- name: Configure slurm yum repository + action: + module: yum_repository + args: + baseurl: "{{ slurm_yum_repo_baseurl }}" + description: "Galaxy Slurm repo" + name: galaxy_slurm + gpgcheck: 0 + when: ansible_os_family == "RedHat" and slurm_yum_repo_baseurl is defined + +- name: Install Slurm (yum) + yum: + name: "{{ item }}" + with_items: + - munge + - munge-libs + - slurm-plugins + - slurm + - slurm-devel + - slurm-munge + - slurm-pam_slurm + #- slurm-perlapi + - slurm-sjobexit + - slurm-sjstat + - slurm-slurmdb-direct + - slurm-slurmdbd + #- slurm-sql + #- slurm-torque + when: ansible_os_family == "RedHat" + +- name: Install slurm.conf + template: + src: "{{ slurm_conf_src | default( 'files/slurm/slurm.conf' ) }}" + dest: "{{ slurm_conf_dir }}/slurm.conf" + owner: root + group: root + mode: 0444 + notify: + - reload slurmd + # FIXME: notify only for slurm controllers... + #- reload slurmctld + +- name: Install slurmdbd.conf + template: + src: slurmdbd.conf.j2 + dest: "{{ slurm_conf_dir }}/slurmdbd.conf" + owner: slurm + group: root + mode: 0400 + notify: + - reload slurmdbd + when: "'slurmdbdservers' in group_names" + +- name: Create slurm spool directory + file: + path: "{{ slurmd_spool_dir }}" + owner: root + group: root + mode: 0755 + state: directory + notify: + - reload slurmd + +- name: Create slurm state directory + file: + path: "{{ slurmctld_state_dir }}" + owner: slurm + group: slurm + mode: 0700 + state: directory + when: "'slurmservers' in group_names" + notify: + - reload slurmctld + +- name: Create slurm log directory + file: + path: "/var/log/{{ slurm_log_dir_name }}" + owner: slurm + group: slurm + mode: 0755 + state: directory + when: "'slurmservers' in group_names" + +- 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 + +- name: Force munge to start with "insecure" /var/log permissions + lineinfile: + dest: /etc/default/munge + line: 'OPTIONS="--force"' + regexp: ^OPTIONS= + when: stat_var_log.stat.wgrp + +- name: Ensure Munge is running + service: + name: munge + enabled: yes + state: started + +- name: Ensure slurmd is running + service: + name: "{{ slurmd_service_name }}" + enabled: yes + state: started + when: "'slurmexechosts' in group_names" + +- name: Ensure slurmctld is running + service: + name: "{{ slurmctld_service_name }}" + enabled: yes + state: started + when: "'slurmservers' in group_names" + +- name: Ensure slurmdbd is running + service: + name: "{{ slurmdbd_service_name }}" + enabled: yes + state: started + when: "'slurmdbdservers' in group_names" + +- include: elastic.yml + when: "'slurmelasticservers' in group_names" diff --git a/templates/slurmdbd.conf.j2 b/templates/slurmdbd.conf.j2 new file mode 100644 index 0000000..82853e3 --- /dev/null +++ b/templates/slurmdbd.conf.j2 @@ -0,0 +1,30 @@ +## +## This file is maintained by Ansible - CHANGES WILL BE OVERWRITTEN +## + +# Authentication info +AuthType=auth/munge +#AuthInfo=/var/run/munge/munge.socket.2 + +# slurmDBD info +DbdAddr=galaxy02 +DbdHost=galaxy02 +#DbdPort=7031 +DbdPort=30001 +SlurmUser=slurm +#MessageTimeout=300 +DebugLevel=4 +#DefaultQOS=normal,standby +LogFile=/var/log/slurm/slurmdbd.log +PidFile=/var/run/slurmdbd.pid +#PluginDir=/usr/lib/slurm +#PrivateData=accounts,users,usage,jobs +#TrackWCKey=yes + +# Database info +StorageType=accounting_storage/mysql +#StorageHost=localhost +#StoragePort=1234 +StoragePass={{ slurmdbd_mysql_pass }} +StorageUser=slurm +#StorageLoc=slurm_acct_db diff --git a/vars/debian.yml b/vars/debian.yml new file mode 100644 index 0000000..8d54bd2 --- /dev/null +++ b/vars/debian.yml @@ -0,0 +1,9 @@ +--- + +slurm_conf_dir: /etc/slurm-llnl +# FIXME +slurm_service_name: slurm-llnl +slurm_log_dir_name: slurm-llnl +slurmd_spool_dir: /var/lib/slurm-llnl/slurmd/slurmd.spool +slurmctld_state_dir: /var/lib/slurm-llnl/slurmctld/slurm.state + diff --git a/vars/redhat.yml b/vars/redhat.yml new file mode 100644 index 0000000..2ef7aa1 --- /dev/null +++ b/vars/redhat.yml @@ -0,0 +1,9 @@ +--- + +slurm_conf_dir: /etc/slurm +slurm_log_dir_name: slurm +slurmd_service_name: slurmd +slurmctld_service_name: slurmctld +slurmdbd_service_name: slurmdbd +slurmd_spool_dir: /var/lib/slurm/slurmd/slurmd.spool +slurmctld_state_dir: /var/lib/slurm/slurmctld/slurm.state