#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

---
- name: add nvidia-docker2 Repo
  get_url:
    url: https://nvidia.github.io/nvidia-docker/centos7/nvidia-docker.repo
    dest: /etc/yum.repos.d/nvidia-docker.repo
  tags: install, testing

- name: install Nvidia driver and nvidia-docker2
  package:
    name:
      - kmod-nvidia
      - nvidia-docker2
    state: present
  tags: install

- name: Set nvidia as default runtime 
  copy: src=daemon.json dest=/etc/docker/ owner=root group=root mode=644
  tags: install

- name: Restart and Enable docker service
  service:
    name: docker
    state: restarted
    enabled: yes
  tags: install

- name: Restart and Enable Kubernetes - kubelet
  service:
    name: kubelet
    state: restarted
    enabled: yes
  tags: install