Skip to content

Commit

Permalink
Merge branch 'vagrant-provision' into feat-ood-add-r
Browse files Browse the repository at this point in the history
  • Loading branch information
diedpigs committed Nov 6, 2018
2 parents e3a1c5f + a30c357 commit 8f7ae99
Show file tree
Hide file tree
Showing 21 changed files with 203 additions and 133 deletions.
1 change: 1 addition & 0 deletions ohpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
- { name: 'compute_build_vnfs', tags: 'compute_build_vnfs' }
- { name: 'compute_build_nodes', tags: 'compute_build_nodes' }
- { name: 'nodes_vivify', tags: 'nodes_vivify' }
- { name: 'ohpc_add_easybuild', tags: 'ohpc_add_easybuild' }
- { name: 'ohpc_add_rstudio', tags: 'ohpc_add_rstudio' }
6 changes: 5 additions & 1 deletion ood.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
- hosts: ood
roles:
- ood
- { name: 'prep_ood', tags: 'prep_ood' }
- { name: 'ood', tags: 'ood' }
- { name: 'warewulf_sync', tags: 'warewulf_sync' }
- { name: 'ood_firewall_and_services', tags: 'ood_firewall_and_services' }
- { name: 'ohpc_firewall_and_services', tags: 'ohpc_firewall_and_services' }
- { name: 'ood_add_rstudio', tags: 'ood_add_rstudio' }
1 change: 1 addition & 0 deletions roles/compute_build_vnfs/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
- tmux
- ruby
- turbojpeg
- nc
- '@X Window System'
- '@Xfce'

Expand Down
65 changes: 65 additions & 0 deletions roles/ohpc_add_easybuild/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
- name: Install pip for system python and build tools
yum:
state: present
name:
- '@Development Tools'
- python-pip

- name: Create user build
user:
name: build

- name: Change owner and permission of easybuild installation directory
file:
path: "{{ easybuild_prefix }}"
owner: root
group: build
mode: "g+w"
recurse: yes

- name: Download EasyBuild bootstrap script
get_url:
url: https://raw.githubusercontent.com/easybuilders/easybuild-framework/develop/easybuild/scripts/bootstrap_eb.py
dest: /tmp/bootstrap_eb.py

- name: Boostrap EasyBuild
shell: |
source /opt/ohpc/admin/lmod/lmod/init/bash
python bootstrap_eb.py "{{ easybuild_prefix }}"
become_user: build
args:
executable: /bin/bash
chdir: /tmp

- name: Check if EasyBuild installation path is in default MODULEPATH
shell: grep "{{ easybuild_prefix }}/modules/all" /etc/profile.d/lmod.sh
ignore_errors: yes
register: default_modulepath_sh

- shell: grep "{{ easybuild_prefix }}/modules/all" /etc/profile.d/lmod.csh
ignore_errors: yes
register: default_modulepath_csh

- name: Add EasyBuild installation path into default MODULEPATH
replace:
path: /etc/profile.d/lmod.sh
regexp: '(MODULEPATH=.*)'
replace: '\1:{{ easybuild_prefix }}/modules/all'
backup: yes
when: default_modulepath_sh.stdout == ""

- name: Add EasyBuild installation path into default MODULEPATH
replace:
path: /etc/profile.d/lmod.csh
regexp: '(MODULEPATH "[^"]*)'
replace: '\1:{{ easybuild_prefix }}/modules/all'
backup: yes
when: default_modulepath_csh.stdout == ""

- name: Verify EasyBuild installation
shell: |
source /opt/ohpc/admin/lmod/lmod/init/bash
module use "{{ easybuild_prefix }}/modules/all"
module load EasyBuild
eb --version
12 changes: 12 additions & 0 deletions roles/ohpc_firewall_and_services/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: start and enable munge
service:
name: munge
state: started
enabled: yes

- name: start and enable slurmd
service:
name: slurmd
state: started
enabled: yes
132 changes: 0 additions & 132 deletions roles/ood/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,6 @@
name: "ondemand"
state: present

- name: Get OpenHPC repo
yum: name={{ openhpc_release_rpm }} state=present update_cache=true

- name: Install dependencies-nfs-utils, ohpc packages, ntp and other required tools.
yum: name={{ item }} state=installed update_cache=true
with_items:
- nfs-utils
- ohpc-base-compute
- ohpc-slurm-client
- zsh
- git
- vim
- tmux
- ruby

- name: Mount /home, /opt/ohpc/pub from OHPC node
lineinfile:
path: /etc/fstab
line: '{{ item }}'
with_items:
- "{{ headnode_private_ip }}:/home /home nfs nfsvers=3,nodev,nosuid,noatime 0 0"
- "{{ headnode_private_ip }}:/opt/ohpc/pub /opt/ohpc/pub nfs nfsvers=3,nodev,noatime 0 0"

- name: Create clusters.d directory
file:
path: /etc/ood/config/clusters.d
Expand Down Expand Up @@ -87,112 +64,3 @@
- name: Build the updated Apache config
command: /opt/ood/ood-portal-generator/sbin/update_ood_portal
ignore_errors: yes

- name: Enable http service
systemd:
state: started
name: httpd24-httpd
enabled: yes

- name: Open port http/s
firewalld:
service: http
permanent: true
state: enabled

- firewalld:
service: https
permanent: true
state: enabled

- name: Disable SELinux Enforcement (permissive)
selinux:
policy: targeted
state: permissive

- name: Set SELinux to permissive mode without reboot
command: setenforce 0

# Implement warewulf file synchrnoization for cluster integration
# https://groups.io/g/OpenHPC-users/message/2084
# https://groups.io/g/OpenHPC-users/message/2405

# Discovery avoids having to hard code the ethernet device number
# it keys off the assigned static IP for the ood node and uses that
# to discover the ethernet device and mac address for the node
# adapted from: https://serverfault.com/a/852093
- name: discover ethernet address for ood internal network
set_fact:
ood_macaddress: "{{ hostvars[inventory_hostname]['ansible_' + item]['macaddress'] }}"
when: hostvars[inventory_hostname]['ansible_' + item]['ipv4']['address'] == ood_ip_addr
with_items:
- "{{ hostvars[inventory_hostname]['ansible_interfaces'] }}"

- name: install warewulf file synchronization
copy:
src: warewulf
dest: /
owner: root
group: root

# ensure script files are executable
- file:
path: /warewulf/bin
recurse: true
mode: u+x,g+x

- name: create custom warewulf config file for node
template:
src: wwnodeconf.j2
dest: /warewulf/config
owner: root
group: root
mode: 0640

- name: add warewulf file sync via cron
copy:
src: wwupdatefiles
dest: /etc/cron.d
owner: root
group: root
mode: 0640

- name: create log output dir for warewulf cron
file:
path: /var/log/warewulf
state: directory
owner: root
group: root
mode: 755

- name: "RUN THESE COMMAND ON OHPC MASTER TO COMPLETE REGISTRATION"
pause:
seconds: 1

- name: "sudo wwsh node new ood -y"
pause:
seconds: 1

- name: "sudo wwsh node set ood -y -I {{ ood_ip_addr }} --hwadd {{ ood_macaddress }}"
pause:
seconds: 1

- name: "sudo wwsh provision set ood -y --files dynamic_hosts,munge.key,slurm.conf --bootlocal=exit"
pause:
seconds: 90

- name: Force warewulf synchronization
shell: /warewulf/bin/wwgetfiles >/var/log/warewulf/wwgetfiles.log 2>&1

- name: start and enable munge
service:
name: munge
state: started
enabled: yes

- name: start and enable slurmd
service:
name: slurmd
state: started
enabled: yes

25 changes: 25 additions & 0 deletions roles/ood_firewall_and_services/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- name: Enable http service
systemd:
state: started
name: httpd24-httpd
enabled: yes

- name: Open port http/s
firewalld:
service: http
permanent: true
state: enabled

- firewalld:
service: https
permanent: true
state: enabled

- name: Disable SELinux Enforcement (permissive)
selinux:
policy: targeted
state: permissive

- name: Set SELinux to permissive mode without reboot
command: setenforce 0
23 changes: 23 additions & 0 deletions roles/prep_ood/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: Get OpenHPC repo
yum: name={{ openhpc_release_rpm }} state=present update_cache=true

- name: Install dependencies-nfs-utils, ohpc packages, ntp and other required tools.
yum: name={{ item }} state=installed update_cache=true
with_items:
- nfs-utils
- ohpc-base-compute
- ohpc-slurm-client
- zsh
- git
- vim
- tmux
- ruby

- name: Mount /home, /opt/ohpc/pub from OHPC node
lineinfile:
path: /etc/fstab
line: '{{ item }}'
with_items:
- "{{ headnode_private_ip }}:/home /home nfs nfsvers=3,nodev,nosuid,noatime 0 0"
- "{{ headnode_private_ip }}:/opt/ohpc/pub /opt/ohpc/pub nfs nfsvers=3,nodev,noatime 0 0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
71 changes: 71 additions & 0 deletions roles/warewulf_sync/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
# Implement warewulf file synchrnoization for cluster integration
# https://groups.io/g/OpenHPC-users/message/2084
# https://groups.io/g/OpenHPC-users/message/2405

# Discovery avoids having to hard code the ethernet device number
# it keys off the assigned static IP for the ood node and uses that
# to discover the ethernet device and mac address for the node
# adapted from: https://serverfault.com/a/852093
- name: discover ethernet address for ood internal network
set_fact:
ood_macaddress: "{{ hostvars[inventory_hostname]['ansible_' + item]['macaddress'] }}"
when: hostvars[inventory_hostname]['ansible_' + item]['ipv4']['address'] == ood_ip_addr
with_items:
- "{{ hostvars[inventory_hostname]['ansible_interfaces'] }}"

- name: install warewulf file synchronization
copy:
src: warewulf
dest: /
owner: root
group: root

# ensure script files are executable
- file:
path: /warewulf/bin
recurse: true
mode: u+x,g+x

- name: create custom warewulf config file for node
template:
src: wwnodeconf.j2
dest: /warewulf/config
owner: root
group: root
mode: 0640

- name: add warewulf file sync via cron
copy:
src: wwupdatefiles
dest: /etc/cron.d
owner: root
group: root
mode: 0640

- name: create log output dir for warewulf cron
file:
path: /var/log/warewulf
state: directory
owner: root
group: root
mode: 755

- name: "RUN THESE COMMAND ON OHPC MASTER TO COMPLETE REGISTRATION"
pause:
seconds: 1

- name: "sudo wwsh node new ood -y"
pause:
seconds: 1

- name: "sudo wwsh node set ood -y -I {{ ood_ip_addr }} --hwadd {{ ood_macaddress }}"
pause:
seconds: 1

- name: "sudo wwsh provision set ood -y --files dynamic_hosts,munge.key,slurm.conf --bootlocal=exit"
pause:
seconds: 90

- name: Force warewulf synchronization
shell: /warewulf/bin/wwgetfiles >/var/log/warewulf/wwgetfiles.log 2>&1
File renamed without changes.

0 comments on commit 8f7ae99

Please sign in to comment.