Skip to content

Commit

Permalink
Merge pull request #8 from SeqWare/feature/docker_automated_build
Browse files Browse the repository at this point in the history
Feature/docker automated build
  • Loading branch information
denis-yuen committed Feb 26, 2015
2 parents f7adfcd + 6506dc2 commit 412c8f9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
28 changes: 19 additions & 9 deletions roles/grid-engine/tasks/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

- name: SGE | Template act_qmaster
template: src=act_qmaster.j2 dest=/var/lib/gridengine/default/common/act_qmaster
when: docker is not defined

- name: SGE | Ensure gridengine-master started
service: name=gridengine-master state=started
Expand All @@ -17,14 +18,17 @@
command: qconf -as {{ inventory_hostname }}
register: configure_master_as
changed_when: not 'already exists' in configure_master_as.stderr
when: docker is not defined

- name: SGE | Make a directory for our SGE templates
file: state=directory path=/etc/gridengine/templates mode=0744
when: docker is not defined

# setup memory as a consumable resource
- name: SGE | Template memory configuration file
template: src=sc.j2 dest=/etc/gridengine/templates/sge_sc
register: memory_template
when: docker is not defined

- name: SGE | Setup memory as consumable resource
command: qconf -Mc /etc/gridengine/templates/sge_sc
Expand All @@ -38,30 +42,31 @@
shell: qconf -su users | grep -E "^entries" | cut -f2 -d " "
register: sge_current_users
changed_when: false
when: docker is not defined

- name: SGE | Add the capsid user
command: qconf -au capsid users
when: not 'capsid' in sge_current_users.stdout.split(',')
when: docker is not defined and not 'capsid' in sge_current_users.stdout.split(',')

# loop through and template worker hosts
- name: SGE | Generate execution host templates
template: src=execution_host.j2 dest=/etc/gridengine/templates/sge_execution_host_{{ item }}.sh mode=0555
when: not single_node
when: not single_node and docker is not defined
with_items: groups.worker
register: execution_host_template

# loop through and setup worker hosts, if this was better it would modify existing hosts as well instead of ignoring errors
- name: SGE | Add worker hosts as execution hosts
shell: export EDITOR=/etc/gridengine/templates/sge_execution_host_{{ item }}.sh && qconf -ae ; qconf -me {{ item }}
with_items: groups.worker
when: execution_host_template.changed
when: execution_host_template.changed
ignore_errors: yes

# add the master as an execution host if we only have one node
- name: SGE | Single node execution host templates
template: src=execution_selfhost.j2 dest=/etc/gridengine/templates/sge_execution_host_master.sh mode=0555
register: execution_host_template
when: single_node
when: single_node and docker is not defined

- name: SGE | Single node host as execution host
shell: export EDITOR=/etc/gridengine/templates/sge_execution_host_master.sh && qconf -ae ; qconf -me master
Expand All @@ -74,35 +79,39 @@
ignore_errors: yes
register: sge_current_host_groups
changed_when: false
when: docker is not defined

# The template now handles the hostlist properly
- name: SGE | Template host group configuration
template: src=ahgrp.j2 dest=/etc/gridengine/templates/sge_ahgrp
when: not '@allhosts' in sge_current_host_groups.stdout_lines
when: docker is not defined and not '@allhosts' in sge_current_host_groups.stdout_lines

- name: SGE | Add the host group configuration
command: qconf -Ahgrp /etc/gridengine/templates/sge_ahgrp
when: not '@allhosts' in sge_current_host_groups.stdout_lines
when: docker is not defined and not '@allhosts' in sge_current_host_groups.stdout_lines

# Again, we don't want to do this if it already exists
- name: SGE | Check current queues
command: qconf -sql
ignore_errors: yes
register: sge_current_queues
changed_when: false
when: docker is not defined

# template handles hostlist, worker queue slots, target load average
- name: SGE | Template main queue
template: src=aq.j2 dest=/etc/gridengine/templates/sge_aq
register: main_queue_template
when: docker is not defined

- name: SGE | Add main queue
command: qconf -Aq /etc/gridengine/templates/sge_aq
when: not 'main.q' in sge_current_queues.stdout_lines
when: docker is not defined and not 'main.q' in sge_current_queues.stdout_lines

- name: SGE | Template modify queue
template: src=mq.j2 dest=/etc/gridengine/templates/sge_mq.sh mode=0555
register: modify_main_queue_template
when: docker is not defined

- name: SGE | Modify main queue
shell: export EDITOR=/etc/gridengine/templates/sge_mq.sh && qconf -mq main.q
Expand All @@ -111,20 +120,21 @@
- name: SGE | Check parallel environment status
command: qconf -sp serial
ignore_errors: yes
when: grid_engine_master == True
when: grid_engine_master == True and docker is not defined
register: sge_parallel_env
changed_when: false

- name: SGE | Template serial parallel environment file
template: src=serial_profile.j2 dest=/etc/gridengine/templates/sge_serial_profile
register: serial_profile
when: docker is not defined

# Again, if this was better, we would re-create the environment if there were changes in the template
- name: SGE | Setup serial profile environment
command: "{{ item }}"
with_items:
- qconf -Ap /etc/gridengine/templates/sge_serial_profile
- qconf -aattr queue pe_list serial main.q
when: "'serial is not a parallel environment' in sge_parallel_env.stderr or serial_profile.changed"
when: "docker is not defined and 'serial is not a parallel environment' in sge_parallel_env.stderr or docker is not defined and serial_profile.changed"

# TODO: bindle 1.2.1 re-runs the sge setup script on reboot. Determine whether this is really needed
8 changes: 8 additions & 0 deletions roles/seqware-master-infrastructure/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@
- name: NFS Restart
service: name=rpcbind state=restarted
when: nfs_setup.changed
ignore_errors: yes
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'

- name: NFS Restart
service: name=portmap state=restarted
when: nfs_setup.changed
ignore_errors: yes
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'precise'

- name: NFS Restart
service: name=nfs-kernel-server state=restarted
Expand Down

0 comments on commit 412c8f9

Please sign in to comment.