Skip to content

Commit

Permalink
Merge pull request #17 from AaltoScienceIT/chroot
Browse files Browse the repository at this point in the history
Make role work for chroot images
  • Loading branch information
VilleS1 authored Mar 6, 2019
2 parents 314be6b + 4816f3d commit db7085e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ install:
- pip install ansible
- ansible --version
- printf '[defaults]\nroles_path=../\ncallback_whitelist=profile_tasks' >ansible.cfg
- ansible-galaxy install lae.travis-lxc
- ansible-galaxy install lae.travis-lxc,v0.7.3
- ansible-playbook -vvv tests/install.yml -i tests/inventory

script:
Expand Down
4 changes: 4 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
# handlers file for ansible-role-cuda
- name: reload systemd unit files
shell: systemctl daemon-reload
when: ansible_connection != 'chroot'

- name: Initialize the GPUs
command: /bin/bash /usr/local/bin/cuda_init.sh
when:
- cuda_init
- cuda_init_restart_service
- ansible_connection != 'chroot'

- name: Restart cuda_init service
service:
Expand All @@ -26,6 +28,7 @@
when:
- cuda_packages_installation.changed
- cuda_restart_node_on_install
- ansible_connection != 'chroot'

# define the variable running_as_ansible_pull in the ansible-pull playbook, like local.yml
- name: ZZ CUDA Wait for server to restart
Expand All @@ -39,5 +42,6 @@
when:
- cuda_restart_node_on_install
- (running_as_ansible_pull is not defined or running_as_ansible_pull == False)
- ansible_connection != 'chroot'

# vim:ft=ansible:
10 changes: 9 additions & 1 deletion tasks/cuda_init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,22 @@
notify:
- reload systemd unit files
- Restart cuda_init service
when: ansible_service_mgr == "systemd"
when: ansible_service_mgr == "systemd" or ansible_connection == 'chroot'

- name: enable the cuda_init systemd service
service:
name: cuda_init
enabled: yes
when: ansible_service_mgr == "systemd"

# Due to ansible bug 21026, cannot use service module on RHEL 7
- name: enable the cuda_init systemd service in chroots
command: systemctl enable cuda_init
when:
- ansible_connection == 'chroot'
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version|int >= 7

- name: check if cuda_gpu_name0 ( /dev/nvidia0 ) exists
stat:
path: "{{ cuda_gpu_name0 }}"
Expand Down

0 comments on commit db7085e

Please sign in to comment.