Skip to content
Snippets Groups Projects
installSlurmFromSource.yml~ 4.47 KiB
Newer Older
- name: define ucx_src_url
  set_fact:
    ucx_src_url: "http://consistency0/src/ucx_1_8_0.tar.gz"
  when: ucx_src_url is not defined

- name: define slurm_src_url
  set_fact:
    slurm_src_url: "http://consistency0/src/slurm-{{ slurm_version }}.tar.bz2"
  when: slurm_src_url is not defined

- name: Create ucx directory if it does not exist
  file:
    path: "{{ src_base }}"
    state: directory
    owner: "{{ ansible_user }}"
    group: root
    mode: u=rwx,g=rx,o=rx
  become: true

- name: remove all install
  file:
    path: "{{ slurm_src_dir }}"
    state: absent
  become: true
  when: force_slurm_recompile is defined

- name: remove all install
  file:
    path: "{{ slurm_dir }}"
    state: absent
  become: true
  when: force_slurm_recompile is defined

- name: download slurm
  get_url:
    url: "{{ slurm_src_url }}"
    checksum: "{{ slurm_src_checksum }}"
    dest: "{{ src_base }}/slurm_src"
  when: slurm_src_checksum is defined
- name: download slurm
  get_url:
    url: "{{ slurm_src_url }}"
    dest: "{{ src_base }}/slurm_src"
  when: slurm_src_checksum is not defined
    
- name: unarchive slurm
  unarchive:
    src: "{{ src_base }}/slurm_src"
    dest: "{{ src_base }}"
    remote_src: yes
    creates: "{{ slurm_src_dir }}"

- name: stat srun
  stat: path="{{ slurm_dir }}/bin/srun"
  register: stat_srun

- name: stat ucx
  stat: 
    path: "{{ ucx_dir }}"
  register: stat_ucx

- name: Create ucx directory if it does not exist
  file:
    path: "{{ ucx_dir }}"
    state: directory
    owner: root
    group: root
    mode: u=rwx,g=rx,o=rx
  become: true
  when: not stat_ucx.stat.exists

- name: download ucx
  get_url:
    url: "{{ ucx_src_url }}"
    checksum: "{{ ucx_src_checksum }}"
    dest: "{{ src_base }}/ucx_src"
  when: ucx_src_checksum is defined
- name: download ucx
  get_url:
    url: "{{ ucx_src_url }}"
    dest: "{{ src_base }}/ucx_src"
  when: ucx_src_checksum is not defined
    
- name: unarchive ucx
  unarchive:
  args:
    src: "{{ src_base }}/ucx_src"
    copy: no
    dest: "{{ src_base }}"
    creates: "{{ ucx_src_dir }}"
  become: true
  register: newucx

- name: install ucx
  shell: "./contrib/configure-release --prefix={{ ucx_dir }} && make -j8 && make install"
  args:
    chdir: "{{ ucx_src_dir }}"
    creates: "{{ ucx_dir }}/bin/ucx_info"
  become: true
    #  when: not stat_ucx.stat.exists

- name: configure slurm centos
  command: "{{ slurm_src_dir }}/configure --prefix={{ slurm_dir }} --with-munge={{ munge_dir }} --enable-pam --with-pmix={{ pmix_dir }} --with-ucx={{ ucx_dir }}"
  args:
    creates: "{{ slurm_dir }}/bin/srun"
    chdir: "{{ slurm_src_dir }}"
  when:
    - force_slurm_recompile is defined or not stat_srun.stat.exists
    - ansible_os_family == 'RedHat'

- name: configure slurm ubuntu
  command: "{{ slurm_src_dir }}/configure --prefix={{ slurm_dir }} --with-munge={{ munge_dir }} --enable-pam --with-pmix --with-ucx={{ ucx_dir }}"
  args:
    creates: "{{ slurm_dir }}/bin/srun"
    chdir: "{{ slurm_src_dir }}"
  when:
    - force_slurm_recompile is defined or not stat_srun.stat.exists
    - ansible_os_family == 'Debian'

- name: build slurm
  command: make
  args:
    creates: "{{ slurm_dir }}/bin/srun"
    chdir: "{{ slurm_src_dir }}"
  when: force_slurm_recompile is defined or not stat_srun.stat.exists

- name: install slurm
  shell: make install
  become: true
  args:
    chdir: "{{ slurm_src_dir }}"
    creates: "{{ slurm_dir }}/bin/srun"
  when: force_slurm_recompile is defined or not stat_srun.stat.exists

- name: build pam_slurm
  shell: "make && make install"
  args:
    chdir: "{{ slurm_src_dir }}/contribs/pam"
  when: force_slurm_recompile is defined or not stat_srun.stat.exists
  become: true

- name: build pam_slurm_adopt
  make:
    chdir: "{{ slurm_src_dir }}/contribs/pam_slurm_adopt"
  when: force_slurm_recompile is defined or not stat_srun.stat.exists

- name: install pam_slurm_adopt
  make:
    chdir: "{{ slurm_src_dir }}/contribs/pam_slurm_adopt"
    target: install
  when: force_slurm_recompile is defined or not stat_srun.stat.exists
  become: true

- name: remove exist-slurm-latest-link
  file:
    path: /opt/slurm-latest
    state: absent
  become: true
  when: force_slurm_recompile is defined or not stat_srun.stat.exists

- name: put slurm-latest-link
  file:
    src: "{{ slurm_dir }}"
    dest: /opt/slurm-latest
    state: link
  become: true
  when: force_slurm_recompile is defined or not stat_srun.stat.exists

- name: add slurm log rotate config
  template: src=slurmlog.j2 dest=/etc/logrotate.d/slurm mode=644
  become: true