Skip to content

Commit

Permalink
Allow running slurmdbd and mysql on different node.
Browse files Browse the repository at this point in the history
  • Loading branch information
jabl committed Mar 8, 2016
1 parent 090894e commit ed920b6
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 73 deletions.
94 changes: 94 additions & 0 deletions tasks/dbd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
- name: get munge key for distribution to nodes
copy: src=files/munge.key
dest=/etc/munge/munge.key
owner=munge
group=munge
mode=0400
notify:
- restart munge

- name: start munge
service: name=munge state=started enabled=yes

- name: install slurmdbd specific packages for EL6
yum: "name={{item}} state=present"
with_items:
- "mysql"
- "mysql-server"
- "mysql-devel"
- "MySQL-python"
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6"

- name: start and enable mysql
service: name=mysqld state=started enabled=yes
register: mysql_start
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6"

- name: install slurmdbd specific packages for EL7
yum: "name={{item}} state=present"
register: install_slurm_packages
with_items:
- "mariadb"
- "mariadb-server"
- "mariadb-devel"
- "MySQL-python"
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"

- name: start and enable mariadb on EL7
service: name=mariadb state=started enabled=yes
register: mariadb_start
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"

- name: restart mariadb after install
service: name=mariadb state=restarted
when: install_slurm_packages.changed

- name: cat /etc/my.cnf
command: cat /etc/my.cnf
register: slurm_mariadb_cnf
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
changed_when: False

- name: print slurm_mariadb_cnf
debug: "var=slurm_mariadb_cnf"
tags: debug
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
changed_when: False

- name: systemctl status mariadb
command: systemctl status mariadb
register: systemctl_slurm_status
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
changed_when: False

- name: wait for mysql in port 3306 to start
wait_for: port=3306 delay=10 timeout=60

- name: create slurm acct db
mysql_db: name=slurm_acct_db state=present

- name: check if slurm db user exists
mysql_user: "name=slurm state=present"
register: mysqlslurmuser
ignore_errors: yes
tags: debug

- name: print mysqlslurmuser
debug: "var=mysqlslurmuser"
tags: debug
changed_when: False

- name: slurm_mysql_password variable must be set
assert:
that: "slurm_mysql_password is defined"

- name: create slurm db user if it does not exist
mysql_user: "name=slurm password={{ slurm_mysql_password }} priv=slurm_acct_db.*:ALL state=present"
when: mysqlslurmuser|failed

- name: slurmdbd.conf
template: src=slurmdbd.conf.j2 dest=/etc/slurm/slurmdbd.conf owner=root mode=0640 backup=yes

- name: restart and enable slurmdbd
service: name=slurmdbd state=restarted enabled=yes
3 changes: 3 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
- include: common.yml
when: ansible_os_family == "RedHat"

- include: dbd.yml
when: (slurm_accounting_storage_host == ansible_hostname) and ansible_os_family == "RedHat"

- include: service.yml
when: slurm_type == "service" and ansible_os_family == "RedHat"

Expand Down
71 changes: 0 additions & 71 deletions tasks/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,23 @@
- name: install service specific packages for EL6
yum: "name={{item}} state=present"
with_items:
- "mysql"
- "mysql-server"
- "mysql-devel"
- "lua-devel"
- "MySQL-python"
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6"

- name: start and enable mysql
service: name=mysqld state=started enabled=yes
register: mysql_start
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6"

- name: install service specific packages for EL7
yum: "name={{item}} state=present"
register: install_slurm_packages
with_items:
- "mariadb"
- "mariadb-server"
- "mariadb-devel"
- "lua-devel"
- "MySQL-python"
- "mailx"
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"

- name: start and enable mariadb on EL7
service: name=mariadb state=started enabled=yes
register: mariadb_start
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"

- name: restart mariadb after install
service: name=mariadb state=restarted
when: install_slurm_packages.changed

- name: cat /etc/my.cnf
command: cat /etc/my.cnf
register: slurm_mariadb_cnf
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
changed_when: False

- name: print slurm_mariadb_cnf
debug: "var=slurm_mariadb_cnf"
tags: debug
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
changed_when: False

- name: systemctl status mariadb
command: systemctl status mariadb
register: systemctl_slurm_status
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
changed_when: False

- name: print systemctl_slurm_status
debug: "var=systemctl_slurm_status"
tags: debug
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
changed_when: False

- name: wait for mysql in port 3306 to start
wait_for: port=3306 delay=10 timeout=60

- name: create slurm acct db
mysql_db: name=slurm_acct_db state=present

- name: check if slurm db user exists
mysql_user: "name=slurm state=present"
register: mysqlslurmuser
ignore_errors: yes
tags: debug

- name: print mysqlslurmuser
debug: "var=mysqlslurmuser"
tags: debug
changed_when: False

- name: slurm_mysql_password variable must be set
assert:
that: "slurm_mysql_password is defined"

- name: create slurm db user if it does not exist
mysql_user: "name=slurm password={{ slurm_mysql_password }} priv=slurm_acct_db.*:ALL state=present"
when: mysqlslurmuser|failed

- name: does the munge.key exist?
stat: path=/etc/munge/munge.key
register: mungekeystat
Expand Down Expand Up @@ -180,9 +115,6 @@
command: /usr/bin/make -C /var/yp
when: nis_server

- name: slurmdbd.conf
template: src=slurmdbd.conf.j2 dest=/etc/slurm/slurmdbd.conf owner=root mode=0640 backup=yes

- name: restart munge
service: name=munge state=restarted
when: mungekeygen.changed and mungekeygen is defined
Expand All @@ -209,9 +141,6 @@
- name: add slurmstate tmp dir
file: "path={{ slurm_state_dir }} state=directory owner=slurm group=slurm mode=0750"

- name: restart and enable slurmdbd
service: name=slurmdbd state=restarted enabled=yes

- name: sacctmgr show cluster siteName and store in slurm_clusterlist variable
command: "sacctmgr -n show cluster {{ siteName }}"
register: slurm_clusterlist
Expand Down
3 changes: 1 addition & 2 deletions templates/slurmdbd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ AuthType=auth/munge
#AuthInfo=/var/run/munge/munge.socket.2
#
# slurmDBD info
DbdAddr={{ hostvars[groups['slurm_service'][0]]['ansible_hostname'] }}
DbdHost={{ hostvars[groups['slurm_service'][0]]['ansible_hostname'] }}
DbdHost={{ slurm_accounting_storage_host }}
#DbdPort=7031
SlurmUser=slurm
#MessageTimeout=300
Expand Down

0 comments on commit ed920b6

Please sign in to comment.