From 36dfb3fcc8e6202aea1203c4c284b4df44b99f29 Mon Sep 17 00:00:00 2001 From: Janne Blomqvist Date: Fri, 14 Dec 2018 21:01:18 +0200 Subject: [PATCH 1/2] Make role work for chroot images --- handlers/main.yml | 4 ++++ tasks/cuda_init.yml | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/handlers/main.yml b/handlers/main.yml index adba3b7..a854726 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -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: @@ -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 @@ -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: diff --git a/tasks/cuda_init.yml b/tasks/cuda_init.yml index 9a10284..258b5e4 100644 --- a/tasks/cuda_init.yml +++ b/tasks/cuda_init.yml @@ -23,7 +23,7 @@ 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: @@ -31,6 +31,14 @@ 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 }}" From 4816f3d2d5a89d80c0ce6985f4b770eb9ab1809c Mon Sep 17 00:00:00 2001 From: Johan Guldmyr Date: Mon, 17 Dec 2018 09:09:15 +0200 Subject: [PATCH 2/2] Testing: Lock travis-lxc to v0.7.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0cdcab4..c306e4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: