pushing code that only works
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,4 +1,4 @@
|
||||
SHELL := /bin/bash
|
||||
/ https://www.youtube.com/channel/UCQdZltW7bh1ta-_nCH7LWYw/playlistSHELL := /bin/bash
|
||||
|
||||
install:
|
||||
go build -o p2prc
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Dmitry Kozlov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,27 +0,0 @@
|
||||
ansible-nvidia
|
||||
====================
|
||||
ansible roles to install docker-ce, graphics drivers, cuda, cudnn and nvidia-docker
|
||||
|
||||
How-to run
|
||||
----------------
|
||||
- Install ansible
|
||||
```
|
||||
sudo pip3 install ansible
|
||||
```
|
||||
- Create hosts file in current directory
|
||||
```
|
||||
$ cat hosts
|
||||
[gpus:vars]
|
||||
ansible_python_interpreter=/usr/bin/python3
|
||||
|
||||
[gpus]
|
||||
#192.168.1.2
|
||||
```
|
||||
- Use locally available ssh keys to authorise logins on a remote machine
|
||||
```
|
||||
ssh-copy-id root@192.168.1.2
|
||||
```
|
||||
- Run playbook
|
||||
```
|
||||
ansible-playbook gpus.yml
|
||||
```
|
||||
@@ -1,22 +0,0 @@
|
||||
[defaults]
|
||||
host_key_checking=False
|
||||
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
|
||||
inventory = hosts
|
||||
remote_user = ubuntu
|
||||
sudo = yes
|
||||
force_color = True
|
||||
#private_key_file = ~/.ssh/my_aws_ec2_private_key.pem #chmod 400 ~/.ssh/my_aws_ec2_private_key.pem
|
||||
hash_behaviour=merge
|
||||
library = ./library
|
||||
gathering = smart
|
||||
fact_caching = jsonfile
|
||||
fact_caching_connection = /tmp
|
||||
stdout_callback = skippy
|
||||
callback_whitelist = profile_tasks
|
||||
forks = 100
|
||||
timeout = 600
|
||||
|
||||
[ssh_connection]
|
||||
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o ConnectionAttempts=100 -o UserKnownHostsFile=/dev/null
|
||||
pipelining = True
|
||||
retries = 3
|
||||
@@ -1,9 +0,0 @@
|
||||
- hosts: test
|
||||
become: true
|
||||
become_user: root
|
||||
roles:
|
||||
# - { role: base }
|
||||
# - { role: docker-ce, docker_version: "5:18.09.3~3-0~ubuntu-bionic", docker_compose_version: 1.23.2 }
|
||||
- { role: cuda, cuda_version_major: 10, cuda_version_minor: 0 }
|
||||
- { role: cudnn, cuda_version_major: 10, cuda_version_minor: 0, cudnn_version: 7.3 }
|
||||
#- { role: nvidia-docker, nvidia_docker_version: 2.0.3+docker18.09.3-1 }
|
||||
@@ -1,17 +0,0 @@
|
||||
---
|
||||
locales_present:
|
||||
- en_US.UTF-8
|
||||
|
||||
locales_language_packs_present:
|
||||
- language-pack-en
|
||||
- language-pack-en-base
|
||||
|
||||
locales_absent: []
|
||||
|
||||
locales_language_packs_absent: []
|
||||
|
||||
locales_default:
|
||||
lang: en_US.UTF-8
|
||||
lc_all: en_US.UTF-8
|
||||
lc_ctype: en_US.UTF-8
|
||||
language: en_US.UTF-8
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
- name: update locales
|
||||
command: dpkg-reconfigure --frontend noninteractive locales
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
- shell: "sudo apt-get clean"
|
||||
|
||||
- shell: "sudo rm -r /var/lib/apt/lists/*"
|
||||
@@ -1,12 +0,0 @@
|
||||
---
|
||||
- name: Disable APT:Periodic::Update-Package-Lists
|
||||
become: yes
|
||||
shell: 'sudo find /etc/apt/apt.conf.d -type f -exec sed -i -e ''s/APT::Periodic::Update-Package-Lists "1"/APT::Periodic::Update-Package-Lists "0"/g'' {} \;'
|
||||
|
||||
- name: Disable APT::Periodic::Unattended-Upgrade
|
||||
become: yes
|
||||
shell: 'sudo find /etc/apt/apt.conf.d -type f -exec sed -i -e ''s/APT::Periodic::Unattended-Upgrade "1"/APT::Periodic::Unattended-Upgrade "0"/g'' {} \;'
|
||||
|
||||
- name: Disable APT::Periodic::Update-Package-Lists
|
||||
become: yes
|
||||
shell: 'sudo find /etc/apt/apt.conf.d -type f -exec sed -i -e ''s/APT::Periodic::Update-Package-Lists "1"/APT::Periodic::Update-Package-Lists "0"/g'' {} \;'
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
# Setup task.
|
||||
# eg: tasks/setup-Ubuntu.yml
|
||||
- include_tasks: "disable-unattended-update-{{ ansible_distribution }}.yml"
|
||||
- include_tasks: "clean-apt-cache.yml"
|
||||
- include_tasks: "setup-locale-{{ ansible_distribution }}.yml"
|
||||
- include_tasks: "setup-{{ ansible_distribution }}.yml"
|
||||
@@ -1,121 +0,0 @@
|
||||
---
|
||||
- name: Install software-properties-common
|
||||
apt:
|
||||
name: software-properties-common
|
||||
state: present
|
||||
|
||||
- name:
|
||||
shell: "sudo add-apt-repository universe"
|
||||
|
||||
- name:
|
||||
shell: "sudo apt update"
|
||||
|
||||
- name: Update and upgrade apt packages
|
||||
apt:
|
||||
upgrade: yes
|
||||
update_cache: yes
|
||||
|
||||
- name: Install python3-pip
|
||||
apt:
|
||||
name: python3-pip
|
||||
state: present
|
||||
|
||||
- name: Upgrade pip
|
||||
pip:
|
||||
name: pip
|
||||
state: latest
|
||||
|
||||
- name: Install docker
|
||||
pip:
|
||||
name: docker
|
||||
state: present
|
||||
|
||||
- name: Install pyOpenSSL
|
||||
pip:
|
||||
name: pyOpenSSL
|
||||
state: present
|
||||
|
||||
- name: Install Ansible
|
||||
pip:
|
||||
name: ansible
|
||||
state: present
|
||||
|
||||
- name: Install jmespath
|
||||
pip:
|
||||
name: jmespath
|
||||
state: present
|
||||
|
||||
- name: Install apache-libcloud
|
||||
pip:
|
||||
name: apache-libcloud
|
||||
state: present
|
||||
|
||||
- name: Install jq
|
||||
apt:
|
||||
name: jq
|
||||
state: present
|
||||
|
||||
- name: Install git
|
||||
apt:
|
||||
name: git
|
||||
state: present
|
||||
|
||||
- name: Install htop
|
||||
apt:
|
||||
name: htop
|
||||
state: present
|
||||
|
||||
- name: Install tmux
|
||||
apt:
|
||||
name: tmux
|
||||
state: present
|
||||
|
||||
- name: Install zip
|
||||
apt:
|
||||
name: zip
|
||||
state: present
|
||||
|
||||
- name: Install unzip
|
||||
apt:
|
||||
name: unzip
|
||||
state: present
|
||||
|
||||
- name: Install rsync
|
||||
apt:
|
||||
name: rsync
|
||||
state: present
|
||||
|
||||
- name: Install Silver Searcher
|
||||
apt:
|
||||
name: silversearcher-ag
|
||||
state: present
|
||||
|
||||
- name: Install sysdig
|
||||
apt:
|
||||
name: sysdig
|
||||
state: present
|
||||
|
||||
- name: Install ncdu
|
||||
apt:
|
||||
name: ncdu
|
||||
state: present
|
||||
|
||||
- name: Install nfs-common
|
||||
apt:
|
||||
name: nfs-common
|
||||
state: present
|
||||
|
||||
- name: Install httpie
|
||||
apt:
|
||||
name: httpie
|
||||
state: present
|
||||
|
||||
- name: Install docker-compose
|
||||
pip:
|
||||
name: docker-compose
|
||||
state: present
|
||||
|
||||
- name: Install openjdk-8-jre
|
||||
apt:
|
||||
name: openjdk-8-jre
|
||||
state: present
|
||||
@@ -1,72 +0,0 @@
|
||||
# tasks file for locales
|
||||
---
|
||||
- name: Update and upgrade apt packages
|
||||
shell: sudo apt update
|
||||
|
||||
- name: Update and upgrade apt packages
|
||||
apt:
|
||||
upgrade: yes
|
||||
update_cache: yes
|
||||
|
||||
- name: install
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: "{{ apt_install_state | default('latest') }}"
|
||||
update_cache: true
|
||||
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"
|
||||
with_items: "{{ locales_dependencies }}"
|
||||
tags: [configuration, locales, locales-install]
|
||||
|
||||
- name: install (specified) language packs
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: "{{ apt_install_state | default('latest') }}"
|
||||
with_items: "{{ locales_language_packs_present }}"
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
notify: update locales
|
||||
tags: [configuration, locales, locales-language-packs-present]
|
||||
|
||||
- name: remove (specified) language packs
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items: "{{ locales_language_packs_absent }}"
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
notify: update locales
|
||||
tags: [configuration, locales, locales-language-packs-absent]
|
||||
|
||||
- name: detect locale gen file
|
||||
stat:
|
||||
path: "{{ locales_gen_file }}"
|
||||
register: _locales_gen_file_stats
|
||||
tags: [configuration, locales, locales-gen-file]
|
||||
|
||||
- name: create locale gen file
|
||||
file:
|
||||
path: "{{ locales_gen_file }}"
|
||||
state: touch
|
||||
when: _locales_gen_file_stats.stat.exists == false
|
||||
tags: [configuration, locales, locales-gen-file]
|
||||
|
||||
- name: make sure (specified) locales are present
|
||||
locale_gen:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items: "{{ locales_present }}"
|
||||
tags: [configuration, locales, locales-present]
|
||||
|
||||
- name: make sure (specified) locales are absent
|
||||
locale_gen:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items: "{{ locales_absent }}"
|
||||
tags: [configuration, locales, locales-absent]
|
||||
|
||||
- name: set default locale
|
||||
template:
|
||||
src: etc/default/locale.j2
|
||||
dest: /etc/default/locale
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
tags: [configuration, locales, locales-default]
|
||||
@@ -1,48 +0,0 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
LANG="{{ locales_default.lang }}"
|
||||
{% if locales_default.language is defined %}
|
||||
LANGUAGE="{{ locales_default.language }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_address is defined %}
|
||||
LC_ADDRESS="{{ locales_default.lc_address }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_all is defined %}
|
||||
LC_ALL="{{ locales_default.lc_all }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_collate is defined %}
|
||||
LC_COLLATE="{{ locales_default.lc_collate }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_ctype is defined %}
|
||||
LC_CTYPE="{{ locales_default.lc_ctype }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_identification is defined %}
|
||||
LC_IDENTIFICATION="{{ locales_default.lc_identification }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_measurement is defined %}
|
||||
LC_MEASUREMENT="{{ locales_default.lc_measurement }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_messages is defined %}
|
||||
LC_MESSAGES="{{ locales_default.lc_messages }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_monetary is defined %}
|
||||
LC_MONETARY="{{ locales_default.lc_monetary }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_name is defined %}
|
||||
LC_NAME="{{ locales_default.lc_name }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_numeric is defined %}
|
||||
LC_NUMERIC="{{ locales_default.lc_numeric }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_paper is defined %}
|
||||
LC_PAPER="{{ locales_default.lc_paper }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_response is defined %}
|
||||
LC_RESPONSE="{{ locales_default.lc_response }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_telephone is defined %}
|
||||
LC_TELEPHONE="{{ locales_default.lc_telephone }}"
|
||||
{% endif %}
|
||||
{% if locales_default.lc_time is defined %}
|
||||
LC_TIME="{{ locales_default.lc_time }}"
|
||||
{% endif %}
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
locales_dependencies:
|
||||
- tzdata
|
||||
- locales
|
||||
locales_gen_file: "{{ '/var/lib/locales/supported.d/local' if ansible_distribution == 'Ubuntu' else '/etc/locale.gen' }}"
|
||||
@@ -1,29 +0,0 @@
|
||||
---
|
||||
language: python
|
||||
python: "2.7"
|
||||
|
||||
# Use the new container infrastructure
|
||||
sudo: false
|
||||
|
||||
# Install ansible
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python-pip
|
||||
|
||||
install:
|
||||
# Install ansible
|
||||
- pip install ansible
|
||||
|
||||
# Check ansible version
|
||||
- ansible --version
|
||||
|
||||
# Create ansible.cfg with correct roles_path
|
||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
||||
|
||||
script:
|
||||
# Basic role syntax check
|
||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
# defaults file for cuda
|
||||
cuda_version_major: 10
|
||||
cuda_version_minor: 0
|
||||
cuda_version_str: "v{{ cuda_version_major }}.{{ cuda_version_minor }}"
|
||||
cuda_version_linux: "cuda-{{ cuda_version_major}}-{{ cuda_version_minor}}"
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
- name: Environment configure
|
||||
lineinfile: >
|
||||
dest=/etc/profile regexp="^{{ item.regexp }}" line="{{ item.line }}"
|
||||
with_items:
|
||||
- { regexp: "export PATH={{ cuda_home }}", line: "export PATH={{ cuda_home }}/bin:$PATH" }
|
||||
- { regexp: "export LD_LIBRARY_PATH={{ cuda_home }}", line: "export LD_LIBRARY_PATH={{ cuda_home }}/lib64:$LD_LIBRARY_PATH" }
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
# Include variables and define needed variables.
|
||||
# eg: vars/Ubuntu.yml
|
||||
- name: Include OS-specific variables
|
||||
include_vars: "{{ ansible_distribution }}.yml"
|
||||
|
||||
# Setup/install tasks.
|
||||
# eg: tasks/setup-Ubuntu.yml
|
||||
- include_tasks: "setup-{{ ansible_distribution }}.yml"
|
||||
|
||||
# Configure.
|
||||
# eg: tasks/configure-Ubuntu.yml
|
||||
- include_tasks: "configure-{{ ansible_distribution }}.yml"
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
- name: Add an Apt signing key for CUDA
|
||||
apt_key:
|
||||
url: "{{ cuda_installer.cuda_apt_key }}"
|
||||
state: present
|
||||
|
||||
- name: Install CUDA repo
|
||||
apt: "deb={{ cuda_installer.deb }} state=present update_cache=yes"
|
||||
register: install_repo_result
|
||||
ignore_errors: True
|
||||
|
||||
- name: Skip if already installed or fail the play if the previous command did not succeed
|
||||
fail: msg="the command failed {{ install_repo_result }}"
|
||||
when: "install_repo_result.changed == 'false' and 'A later version is already installed' not in install_repo_result.stderr"
|
||||
|
||||
- name: Install CUDA package
|
||||
apt: "name=cuda state=present update_cache=yes"
|
||||
|
||||
- name: Install CUDA {{ cuda_version_linux }}
|
||||
apt: "name={{ cuda_version_linux }} state=present update_cache=yes"
|
||||
@@ -1 +0,0 @@
|
||||
localhost
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- cuda
|
||||
@@ -1,33 +0,0 @@
|
||||
---
|
||||
cuda_download_url_map:
|
||||
bionic:
|
||||
v10.1:
|
||||
deb: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.1.243-1_amd64.deb
|
||||
cuda_apt_key: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
|
||||
v10.0:
|
||||
deb: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
|
||||
cuda_apt_key: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
|
||||
xenial:
|
||||
v8.0:
|
||||
deb: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
|
||||
cuda_apt_key: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
|
||||
v9.0:
|
||||
deb: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
|
||||
cuda_apt_key: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
|
||||
v9.1:
|
||||
deb: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
|
||||
cuda_apt_key: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
|
||||
v9.2:
|
||||
deb: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.2.148-1_amd64.deb
|
||||
cuda_apt_key: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
|
||||
zesty:
|
||||
v9.0:
|
||||
deb: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64/cuda-repo-ubuntu1704_9.0.176-1_amd64.deb
|
||||
cuda_apt_key: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64/7fa2af80.pub
|
||||
v9.1:
|
||||
deb: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64/cuda-repo-ubuntu1704_9.1.85-1_amd64.deb
|
||||
cuda_apt_key: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64/7fa2af80.pub
|
||||
|
||||
cuda_installer: "{{ cuda_download_url_map[ansible_distribution_release][cuda_version_str] }}"
|
||||
|
||||
cuda_home: /usr/local/cuda
|
||||
@@ -1,29 +0,0 @@
|
||||
---
|
||||
language: python
|
||||
python: "2.7"
|
||||
|
||||
# Use the new container infrastructure
|
||||
sudo: false
|
||||
|
||||
# Install ansible
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python-pip
|
||||
|
||||
install:
|
||||
# Install ansible
|
||||
- pip install ansible
|
||||
|
||||
# Check ansible version
|
||||
- ansible --version
|
||||
|
||||
# Create ansible.cfg with correct roles_path
|
||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
||||
|
||||
script:
|
||||
# Basic role syntax check
|
||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
cuda_version_major: 10
|
||||
cuda_version_minor: 0
|
||||
cuda_version_str: "v{{ cuda_version_major }}.{{ cuda_version_minor }}"
|
||||
cuda_version_linux: "cuda-{{ cuda_version_major}}-{{ cuda_version_minor}}"
|
||||
|
||||
cudnn_version: 7.3
|
||||
cudnn_version_str: "v{{ cudnn_version }}"
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
# Include variables and define needed variables.
|
||||
# eg: vars/Ubuntu.yml
|
||||
- name: Include OS-specific variables
|
||||
include_vars: "{{ ansible_distribution }}.yml"
|
||||
|
||||
# Setup task.
|
||||
# eg: tasks/setup-Ubuntu.yml
|
||||
- include_tasks: "setup-{{ ansible_distribution }}.yml"
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
- name: Install CUDNN package
|
||||
apt: "deb={{ cudnn_installer.deb }} state=present update_cache=yes"
|
||||
@@ -1 +0,0 @@
|
||||
localhost
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- cudnn
|
||||
@@ -1,63 +0,0 @@
|
||||
---
|
||||
# vars file for cudnn
|
||||
cudnn_installer_map:
|
||||
bionic:
|
||||
v7.6:
|
||||
v10.1:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libcudnn7_7.6.4.38-1+cuda10.1_amd64.deb
|
||||
v10.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libcudnn7_7.6.4.38-1+cuda10.0_amd64.deb
|
||||
v7.3:
|
||||
v10.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libcudnn7_7.3.0.29-1+cuda10.0_amd64.deb
|
||||
v7:
|
||||
v9.2:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.2.1.38-1+cuda9.2_amd64.deb
|
||||
xenial:
|
||||
v7:
|
||||
v9.2:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.2.1.38-1+cuda9.2_amd64.deb
|
||||
v9.1:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.1.3.16-1+cuda9.1_amd64.deb
|
||||
v9.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.2.1.38-1+cuda9.0_amd64.deb
|
||||
v8.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.2.1.38-1+cuda8.0_amd64.deb
|
||||
v7-dev:
|
||||
v9.2:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7-dev_7.2.1.38-1+cuda9.2_amd64.deb
|
||||
v9.1:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7-dev_7.1.3.16-1+cuda9.1_amd64.deb
|
||||
v9.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7-dev_7.2.1.38-1+cuda9.0_amd64.deb
|
||||
v8.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7-dev_7.2.1.38-1+cuda8.0_amd64.deb
|
||||
v6:
|
||||
v8.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn6_6.0.21-1+cuda8.0_amd64.deb
|
||||
v6-dev:
|
||||
v8.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn6-dev_6.0.21-1+cuda8.0_amd64.deb
|
||||
zesty:
|
||||
v7:
|
||||
v9.1:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/libcudnn7_7.1.3.16-1+cuda9.1_amd64.deb
|
||||
v9.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/libcudnn7_7.1.3.16-1+cuda9.0_amd64.deb
|
||||
v8.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/libcudnn7_7.1.3.16-1+cuda8.0_amd64.deb
|
||||
v7-dev:
|
||||
v9.1:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/libcudnn7-dev_7.1.3.16-1+cuda9.1_amd64.deb
|
||||
v9.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/libcudnn7-dev_7.1.3.16-1+cuda9.0_amd64.deb
|
||||
v8.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/libcudnn7-dev_7.1.3.16-1+cuda8.0_amd64.deb
|
||||
v6:
|
||||
v8.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/libcudnn6_6.0.21-1+cuda8.0_amd64.deb
|
||||
v6-dev:
|
||||
v8.0:
|
||||
deb: http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/libcudnn6-dev_6.0.21-1+cuda8.0_amd64.deb
|
||||
|
||||
cudnn_installer: "{{ cudnn_installer_map[ansible_distribution_release][cudnn_version_str][cuda_version_str]}}"
|
||||
@@ -1,8 +0,0 @@
|
||||
.DS_Store
|
||||
*/**.DS_Store
|
||||
._*
|
||||
.*.sw*
|
||||
*~
|
||||
.idea/
|
||||
.vscode/
|
||||
*.retry
|
||||
@@ -1,178 +0,0 @@
|
||||
## What is ansible-docker?
|
||||
It is an [Ansible](http://www.ansible.com/home) role to:
|
||||
|
||||
- Install Docker (editions, channels and version pinning are all supported)
|
||||
- Install Docker Compose
|
||||
- Manage login credentials for 1 or more public or private Docker registries
|
||||
- Set up 1 or more users to run Docker without needing root access
|
||||
- Configure a cron job to run Docker clean up commands
|
||||
- Configure the Docker daemon's options and environment variables
|
||||
|
||||
## Why would you want to use this role?
|
||||
If you're like me, you probably love Docker. This role provides everything you
|
||||
need to get going with a production ready Docker host.
|
||||
|
||||
## Supported platforms
|
||||
|
||||
- Ubuntu 16.04 LTS (Xenial)
|
||||
- Ubuntu 18.04 LTS (Bionic)
|
||||
- Debian 8 (Jessie)
|
||||
- Debian 9 (Stretch)
|
||||
|
||||
## Role variables
|
||||
```
|
||||
# When set to "True", the Docker package and supporting files will be removed.
|
||||
docker_remove_package: False
|
||||
|
||||
# Do you want to use "ce" (community edition) or "ee" (enterprise edition)?
|
||||
docker_edition: "ce"
|
||||
|
||||
# Do you want to use the "stable", "edge", "testing" or "nightly" channels?
|
||||
# Add more than 1 channel by separating each one by a space.
|
||||
docker_channel: "stable"
|
||||
|
||||
# When set to "latest" this role will always attempt to install the latest
|
||||
# version based on the channel you selected. This could lead to something like
|
||||
# Docker 18.06 being installed today but then a year from now, re-running the
|
||||
# role will result in 19.06 or whatever Docker happens to use a year from now.
|
||||
#
|
||||
# If you want to pin a version simply put "18.06", "18.06.1" or whatever version
|
||||
# you want. Even if you update your package list and newer Docker versions are
|
||||
# available this role will stick to the pinned version on all future runs.
|
||||
docker_version: "latest"
|
||||
|
||||
# Do you want to also install Docker Compose?
|
||||
docker_install_docker_compose: True
|
||||
|
||||
# If Docker Compose is being installed, which version do you want to use?
|
||||
docker_compose_version: "1.22.0"
|
||||
|
||||
# A list of users to be added to the docker group. For example if you have a
|
||||
# user of "admin", then you'll want to set docker_users: ["admin"] here.
|
||||
#
|
||||
# Keep in mind this user needs to already exist, this role will not create it.
|
||||
#
|
||||
# This role does not configure User Namespaces or any other security features
|
||||
# by default. If the user you add here has SSH access to your server then you're
|
||||
# effectively giving them root access to the system since they can run docker
|
||||
# without sudo and volume mount in any file on your file system.
|
||||
#
|
||||
# In a controlled environment this is safe, but like anything security related
|
||||
# it's worth knowing this up front. You can enable User Namespaces and any
|
||||
# other options with the docker_daemon_options variable which is explained later.
|
||||
docker_users: []
|
||||
|
||||
# Manage login credentials for 1 or more Docker registries. Example usage:
|
||||
# docker_registries:
|
||||
# # Your registry URL is optional and defaults to the Docker Hub if undefined.
|
||||
# - registry_url: "https://index.docker.io/v1/"
|
||||
# # Your username is required.
|
||||
# username: "your_docker_hub_username"
|
||||
# # Your password is required.
|
||||
# password: "your_docker_hub_password"
|
||||
# # Your email address is optional (not all registries use it).
|
||||
# email: "your_docker_hub@emailaddress.com"
|
||||
# # Update your credentials. If undefined, this behavior will be skipped.
|
||||
# reauthorize: False
|
||||
# # Enable or disable these credentials by setting "present" or "absent".
|
||||
# # If undefined, it will default to "present".
|
||||
# state: "present"
|
||||
# # The system user that will have access to the registry. If undefined it
|
||||
# # will default to the root user. You likely want to set this to be a user
|
||||
# # defined in your docker_users list above.
|
||||
# system_user: "a_user_defined_in_docker_users"
|
||||
docker_registries: []
|
||||
|
||||
# Docker daemon options as they would appear on the command line, such as:
|
||||
# docker_daemon_options:
|
||||
# - "--dns 8.8.8.8"
|
||||
docker_daemon_options: []
|
||||
|
||||
# Can be used to set environment variables for the Docker daemon, such as:
|
||||
# docker_daemon_environment:
|
||||
# - "HTTP_PROXY=http://proxy.example.com:3128/"
|
||||
# - "HTTPS_PROXY=http://proxy.example.com:3128/"
|
||||
# - "NO_PROXY=localhost,127.0.0.1"
|
||||
docker_daemon_environment: []
|
||||
|
||||
# Manage 1 or more cron jobs to perform Docker related system tasks. By default
|
||||
# this will safely clean up disk space used by Docker every Sunday at midnight.
|
||||
docker_cron_tasks:
|
||||
- job: docker system prune -f &> /dev/null
|
||||
name: "Docker disk clean up"
|
||||
schedule: ["0", "0", "*", "*", "0"]
|
||||
|
||||
# A list of packages that Docker requires to run. Typically you shouldn't have
|
||||
# to modify this list, but if Docker's dependencies change it can be updated
|
||||
# here without having to fork the role.
|
||||
docker_package_dependencies:
|
||||
- "apt-transport-https"
|
||||
- "ca-certificates"
|
||||
- "software-properties-common"
|
||||
- "gnupg2"
|
||||
- "cron"
|
||||
|
||||
# The Docker GPG key id used to sign the Docker package.
|
||||
docker_apt_key_id: "9DC858229FC7DD38854AE2D88D81803C0EBFCD88"
|
||||
|
||||
# The Docker GPG key server address.
|
||||
docker_apt_key_server: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
|
||||
|
||||
# The Docker APT repository.
|
||||
docker_apt_repository: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_channel }}"
|
||||
|
||||
# How long should the apt-cache last in seconds?
|
||||
docker_apt_cache_time: 86400
|
||||
```
|
||||
|
||||
## Example usage
|
||||
|
||||
For the sake of this example let's assume you have a group called **app** and
|
||||
you have a typical `site.yml` file.
|
||||
|
||||
To use this role edit your `site.yml` file to look something like this:
|
||||
|
||||
```
|
||||
---
|
||||
|
||||
- name: Configure app server(s)
|
||||
hosts: "app"
|
||||
become: True
|
||||
|
||||
roles:
|
||||
- { role: "ansible-docker", tags: ["docker"] }
|
||||
```
|
||||
|
||||
Here's a few examples. You can recreate this example on your end by opening or
|
||||
creating `group_vars/app.yml` which is located relative to your `inventory`
|
||||
directory and then making it look like this:
|
||||
|
||||
```
|
||||
---
|
||||
|
||||
# Pin Docker version 18.06 from the stable channel.
|
||||
docker_version: "18.06"
|
||||
|
||||
# Allow the admin and zerocool users to access Docker without needing root access.
|
||||
docker_users: ["admin", "zerocool"]
|
||||
|
||||
# A couple of examples of authenticating to a Docker registry.
|
||||
docker_registries:
|
||||
# Authenticate to the Docker Hub, and allow the "admin" system user acces to it:
|
||||
- username: "your_docker_hub_username"
|
||||
password: "your_docker_hub_password"
|
||||
email: "your_docker_hub@emailaddress.com"
|
||||
system_user: "{{ docker_users | first }}"
|
||||
# Authenticate to some other private registry and allow "zerocool":
|
||||
- registry_url: "https://your-registry.com"
|
||||
username: "some_other_username"
|
||||
password: "some_other_password"
|
||||
system_user: "zerocool"
|
||||
# Disable logging in to some old registry you don't use anymore:
|
||||
- registry_url: "https://old-registry.com"
|
||||
username: "some_old_username"
|
||||
password: "some_old_password"
|
||||
state: "absent"
|
||||
```
|
||||
|
||||
Now you would run `ansible-playbook -i inventory/hosts site.yml -t docker`.
|
||||
@@ -1,34 +0,0 @@
|
||||
---
|
||||
|
||||
docker_remove_package: False
|
||||
|
||||
docker_edition: "ce"
|
||||
docker_channel: "stable"
|
||||
docker_version: "18.06.1"
|
||||
|
||||
docker_install_docker_compose: True
|
||||
docker_compose_version: "1.22.0"
|
||||
|
||||
docker_users: ["ubuntu"]
|
||||
docker_registries: []
|
||||
|
||||
docker_daemon_options: []
|
||||
docker_daemon_environment: []
|
||||
|
||||
docker_cron_tasks:
|
||||
- job: docker system prune -f &> /dev/null
|
||||
name: "Docker clean up"
|
||||
schedule: ["0", "0", "*", "*", "0"]
|
||||
|
||||
|
||||
docker_package_dependencies:
|
||||
- "apt-transport-https"
|
||||
- "ca-certificates"
|
||||
- "software-properties-common"
|
||||
- "gnupg2"
|
||||
- "cron"
|
||||
|
||||
docker_apt_key_id: "9DC858229FC7DD38854AE2D88D81803C0EBFCD88"
|
||||
docker_apt_key_server: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
|
||||
docker_apt_repository: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_channel }}"
|
||||
docker_apt_cache_time: 86400
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
|
||||
- name: Restart Docker
|
||||
service:
|
||||
name: "docker"
|
||||
state: "restarted"
|
||||
@@ -1,163 +0,0 @@
|
||||
---
|
||||
|
||||
- name: Disable pinned docker-ce version
|
||||
file:
|
||||
dest: "/etc/apt/preferences.d/docker-ce.pref"
|
||||
state: "absent"
|
||||
when: docker_remove_package or docker_version == "" or docker_version == "latest"
|
||||
|
||||
- name: Disable pinned docker-ce-cli version
|
||||
file:
|
||||
dest: "/etc/apt/preferences.d/docker-ce-cli.pref"
|
||||
state: "absent"
|
||||
when: docker_remove_package or docker_version == "" or docker_version == "latest"
|
||||
|
||||
- name: Pin docker-ce version
|
||||
template:
|
||||
src: "etc/apt/preferences.d/docker-ce.pref.j2"
|
||||
dest: "/etc/apt/preferences.d/docker-ce.pref"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
when: not docker_remove_package and (docker_version and docker_version != "latest")
|
||||
|
||||
- name: Pin docker-ce-cli version
|
||||
template:
|
||||
src: "etc/apt/preferences.d/docker-ce-cli.pref.j2"
|
||||
dest: "/etc/apt/preferences.d/docker-ce-cli.pref"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
when: not docker_remove_package and (docker_version and docker_version != "latest")
|
||||
|
||||
- name: Install Docker's dependencies
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
update_cache: True
|
||||
cache_valid_time: "{{ docker_apt_cache_time }}"
|
||||
loop: "{{ docker_package_dependencies }}"
|
||||
|
||||
- name: Add Docker's GPG key
|
||||
apt_key:
|
||||
id: "{{ docker_apt_key_id }}"
|
||||
url: "{{ docker_apt_key_server }}"
|
||||
|
||||
- name: Configure upstream APT repository
|
||||
apt_repository:
|
||||
repo: "{{ docker_apt_repository }}"
|
||||
|
||||
- name: Remove Docker
|
||||
apt:
|
||||
name: "docker-{{ docker_edition }}"
|
||||
state: "absent"
|
||||
when: docker_remove_package
|
||||
|
||||
- name: Install Docker
|
||||
apt:
|
||||
name: "docker-{{ docker_edition }}"
|
||||
update_cache: True
|
||||
cache_valid_time: "{{ docker_apt_cache_time }}"
|
||||
state: "latest"
|
||||
when: not docker_remove_package
|
||||
|
||||
- name: Remove Upstart config file
|
||||
file:
|
||||
path: "/etc/default/docker"
|
||||
state: "absent"
|
||||
|
||||
- name: Ensure systemd directory exists
|
||||
file:
|
||||
path: "/etc/systemd/system"
|
||||
state: "directory"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0755"
|
||||
|
||||
- name: Remove systemd unit file
|
||||
file:
|
||||
path: "/etc/systemd/system/docker.service"
|
||||
state: "absent"
|
||||
when: docker_remove_package
|
||||
|
||||
#- name: Generate systemd unit file
|
||||
# template:
|
||||
# src: "etc/systemd/system/docker.service.j2"
|
||||
# dest: "/etc/systemd/system/docker.service"
|
||||
# owner: "root"
|
||||
# group: "root"
|
||||
# mode: "0644"
|
||||
# register: docker_register_systemd_service
|
||||
# when: not docker_remove_package
|
||||
|
||||
- name: Reload systemd daemon
|
||||
systemd:
|
||||
daemon_reload: True
|
||||
notify: ["Restart Docker"]
|
||||
when: not docker_remove_package or docker_register_systemd_service is changed
|
||||
|
||||
- name: Add user(s) to "docker" group
|
||||
user:
|
||||
name: "{{ item }}"
|
||||
groups: "docker"
|
||||
append: True
|
||||
loop: "{{ docker_users }}"
|
||||
when: not docker_remove_package and docker_users
|
||||
|
||||
- name: Install Python for managing Docker login credentials
|
||||
apt:
|
||||
name: "python"
|
||||
update_cache: True
|
||||
cache_valid_time: "{{ docker_apt_cache_time }}"
|
||||
when: not docker_remove_package and docker_registries
|
||||
|
||||
- name: Install docker-py for managing Docker login credentials
|
||||
pip:
|
||||
name: "docker-py"
|
||||
when: not docker_remove_package and docker_registries
|
||||
|
||||
- name: Manage login credentials for 1 or more Docker registries
|
||||
docker_login:
|
||||
registry_url: "{{ item.registry_url | default(omit) }}"
|
||||
username: "{{ item.username }}"
|
||||
password: "{{ item.password }}"
|
||||
email: "{{ item.email | default(omit)}}"
|
||||
reauthorize: "{{ item.reauthorize | default(omit) }}"
|
||||
state: "{{ item.state | default(omit) }}"
|
||||
loop: "{{ docker_registries }}"
|
||||
when: not docker_remove_package and docker_registries
|
||||
become_user: "{{ item.system_user | default(omit) }}"
|
||||
|
||||
- name: Remove Docker Compose
|
||||
file:
|
||||
path: "/usr/local/bin/docker-compose"
|
||||
state: "absent"
|
||||
when: docker_remove_package
|
||||
|
||||
- name: Install Docker Compose
|
||||
get_url:
|
||||
url: "https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64"
|
||||
dest: "/usr/local/bin/docker-compose"
|
||||
force: True
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0755"
|
||||
when: not docker_remove_package and docker_install_docker_compose
|
||||
|
||||
- name: Remove cron tasks for Docker commands
|
||||
cron:
|
||||
name: "{{ item.name }}"
|
||||
state: "absent"
|
||||
loop: "{{ docker_cron_tasks }}"
|
||||
when: docker_remove_package and docker_cron_tasks
|
||||
|
||||
- name: Create cron tasks for Docker commands
|
||||
cron:
|
||||
name: "{{ item.name }}"
|
||||
job: "{{ item.job }}"
|
||||
minute: "{{ item.schedule[0] }}"
|
||||
hour: "{{ item.schedule[1] }}"
|
||||
day: "{{ item.schedule[2] }}"
|
||||
month: "{{ item.schedule[3] }}"
|
||||
weekday: "{{ item.schedule[4] }}"
|
||||
loop: "{{ docker_cron_tasks }}"
|
||||
when: not docker_remove_package and docker_cron_tasks
|
||||
@@ -1,4 +0,0 @@
|
||||
Explanation: Pin added by Ansible role "{{ role_name }}"
|
||||
Package: docker-ce-cli
|
||||
Pin: version {{ docker_version }}*
|
||||
Pin-Priority: 600
|
||||
@@ -1,4 +0,0 @@
|
||||
Explanation: Pin added by Ansible role "{{ role_name }}"
|
||||
Package: docker-ce
|
||||
Pin: version {{ docker_version }}*
|
||||
Pin-Priority: 600
|
||||
@@ -1,34 +0,0 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=Docker Application Container Engine
|
||||
Documentation=https://docs.docker.com
|
||||
After=network-online.target docker.socket
|
||||
Requires=docker.socket
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
# the default is not to use systemd for cgroups because the delegate issues still
|
||||
# exists and systemd currently does not support the cgroup feature set required
|
||||
# for containers run by docker
|
||||
{% if docker_daemon_environment %}
|
||||
Environment="{{ docker_daemon_environment | join('" "') }}"
|
||||
{% endif %}
|
||||
ExecStart=/usr/bin/dockerd {{ docker_daemon_options | join(" ") }}
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
# Having non-zero Limit*s causes performance problems due to accounting overhead
|
||||
# in the kernel. We recommend using cgroups to do container-local accounting.
|
||||
LimitNOFILE=infinity
|
||||
LimitNPROC=infinity
|
||||
LimitCORE=infinity
|
||||
# Uncomment TasksMax if your systemd version supports it.
|
||||
# Only systemd 226 and above support this version.
|
||||
TasksMax=infinity
|
||||
TimeoutStartSec=0
|
||||
# set delegate yes so that systemd does not reset the cgroups of docker containers
|
||||
Delegate=yes
|
||||
# kill only the docker process, not all processes in the cgroup
|
||||
KillMode=process
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,59 +0,0 @@
|
||||
---
|
||||
|
||||
- hosts: "all"
|
||||
become: True
|
||||
|
||||
vars:
|
||||
docker_version: "18.03"
|
||||
docker_users: ["test"]
|
||||
|
||||
docker_daemon_options:
|
||||
- "--dns 8.8.8.8"
|
||||
|
||||
roles:
|
||||
- "role_under_test"
|
||||
|
||||
pre_tasks:
|
||||
- name: Add test user
|
||||
user:
|
||||
name: "test"
|
||||
shell: "/bin/bash"
|
||||
|
||||
post_tasks:
|
||||
- name: Ensure Docker gets installed
|
||||
command: docker --version
|
||||
register: result_pinned
|
||||
changed_when: result_pinned.rc != 0
|
||||
|
||||
- name: Run the equivalent of "apt-get update"
|
||||
apt:
|
||||
update_cache: True
|
||||
changed_when: False
|
||||
|
||||
- name: Ensure pinned Docker version wasn't updated
|
||||
# This is valid because 18.06+ is currently out. If the pin failed then
|
||||
# this docker --version would be different from the previous check.
|
||||
command: docker --version
|
||||
register: result
|
||||
changed_when: result.stdout != result_pinned.stdout
|
||||
|
||||
- name: Ensure test user can access Docker without root access
|
||||
command: groups test
|
||||
register: result
|
||||
changed_when: result.stdout.split(":")[1] | trim != "test docker"
|
||||
|
||||
- name: Ensure Docker Compose gets installed
|
||||
command: docker-compose --version
|
||||
register: result
|
||||
changed_when: result.rc != 0
|
||||
|
||||
- name: Ensure /etc/systemd/system/docker.service contains '--dns 8.8.8.8'
|
||||
# Double dashes: https://unix.stackexchange.com/a/11382
|
||||
command: grep -- "--dns 8.8.8.8" /etc/systemd/system/docker.service
|
||||
register: result
|
||||
changed_when: result.rc != 0
|
||||
|
||||
- name: Ensure Docker clean up cron job was added
|
||||
command: crontab -l
|
||||
register: result
|
||||
changed_when: not result.stdout is search("docker system prune -f")
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
|
||||
ubuntu_version: ubuntu18.04
|
||||
nvidia_docker_version: 2.0.3+docker18.09.0-1
|
||||
nvidia_container_runtime_major_version: 2.0.0
|
||||
@@ -1,4 +0,0 @@
|
||||
- name: restart docker service
|
||||
systemd:
|
||||
name: docker
|
||||
state: restarted
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
|
||||
- name: nvidia-modprobe is installed
|
||||
apt:
|
||||
name: nvidia-modprobe
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: nvidia-docker (v2) is uninstalled
|
||||
apt:
|
||||
name: nvidia-docker2
|
||||
state: absent
|
||||
notify: restart docker service
|
||||
|
||||
- name: nvidia-docker (v1) is installed
|
||||
apt:
|
||||
deb: '{{ nvidia_docker_deb_url }}'
|
||||
state: present
|
||||
notify: restart docker service
|
||||
@@ -1,79 +0,0 @@
|
||||
---
|
||||
|
||||
- name: nvidia-docker (v2) release key is registered
|
||||
apt_key:
|
||||
url: https://nvidia.github.io/nvidia-docker/gpgkey
|
||||
state: present
|
||||
|
||||
- name: software-properties-common is installed for prerequisite for apt_repository ansible module
|
||||
apt:
|
||||
name: software-properties-common
|
||||
state: present
|
||||
|
||||
- name: nvidia-docker (v2) apt repository is registered
|
||||
apt_repository:
|
||||
repo: "{{ item }}"
|
||||
filename: nvidia-docker
|
||||
state: present
|
||||
mode: 0644
|
||||
update_cache: yes
|
||||
with_items:
|
||||
- 'deb https://nvidia.github.io/libnvidia-container/{{ ubuntu_version }}/amd64 /'
|
||||
- 'deb https://nvidia.github.io/nvidia-container-runtime/{{ ubuntu_version }}/amd64 /'
|
||||
- 'deb https://nvidia.github.io/nvidia-docker/{{ ubuntu_version }}/amd64 /'
|
||||
|
||||
- name: nvidia-docker (v1) is uninstalled
|
||||
apt:
|
||||
name: nvidia-docker
|
||||
state: absent
|
||||
|
||||
- name: confirm content of /etc/docker/daemon.json
|
||||
command: cat /etc/docker/daemon.json
|
||||
register: nvidia_docker_daemon_json_backup
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
|
||||
- name: Pin nvidia-docker2 version
|
||||
template:
|
||||
src: "etc/apt/preferences.d/nvidia-docker2.pref.j2"
|
||||
dest: "/etc/apt/preferences.d/nvidia-docker2.pref"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
|
||||
- name: Pin nvidia-container-runtime version
|
||||
template:
|
||||
src: "etc/apt/preferences.d/nvidia-container-runtime.pref.j2"
|
||||
dest: "/etc/apt/preferences.d/nvidia-container-runtime.pref"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
|
||||
- name: nvidia-docker (v2) is installed
|
||||
apt:
|
||||
name: "nvidia-docker2={{ nvidia_docker_version }}"
|
||||
state: present
|
||||
notify: restart docker service
|
||||
|
||||
- name: confirm content of /etc/docker/daemon.json after installation of nvidia-docker2
|
||||
command: cat /etc/docker/daemon.json
|
||||
register: nvidia_docker_daemon_json_v2
|
||||
changed_when: False
|
||||
|
||||
- name: content of /etc/docker/daemon.json is merged
|
||||
copy:
|
||||
content: "{{ nvidia_docker_daemon_json_backup.stdout | from_json | combine(nvidia_docker_daemon_json_v2.stdout | from_json) }}"
|
||||
dest: /etc/docker/daemon.json
|
||||
validate: python3 -m json.tool %s
|
||||
when: nvidia_docker_daemon_json_backup.stdout != ""
|
||||
|
||||
- name: confirm content of /etc/docker/daemon.json after installation of nvidia-docker2
|
||||
command: cat /etc/docker/daemon.json
|
||||
register: nvidia_docker_daemon_json_v3
|
||||
changed_when: False
|
||||
|
||||
- name: content of /etc/docker/daemon.json is merged
|
||||
copy:
|
||||
content: "{{ nvidia_docker_daemon_json_v3.stdout | from_json | combine({'default-runtime':'nvidia'}) | to_nice_json }}"
|
||||
dest: /etc/docker/daemon.json
|
||||
validate: python3 -m json.tool %s
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
- name: import task for Debian derivatives
|
||||
include_tasks: debian_v1.yml
|
||||
when: ansible_os_family == "Debian" and nvidia_docker_version.startswith('1')
|
||||
|
||||
- name: import task for Debian derivatives
|
||||
include_tasks: debian_v2.yml
|
||||
when: ansible_os_family == "Debian" and nvidia_docker_version.startswith('2')
|
||||
|
||||
- name: Reboot machine after nvidia-docker installed
|
||||
shell: 'sleep 1 && shutdown -r now "Reboot triggered by Ansible" && sleep 1'
|
||||
async: 1
|
||||
poll: 0
|
||||
|
||||
- name: Wait for system to become reachable
|
||||
wait_for_connection:
|
||||
delay: 60
|
||||
sleep: 30
|
||||
timeout: 600
|
||||
@@ -1,4 +0,0 @@
|
||||
Explanation: Pin added by Ansible role "{{ role_name }}"
|
||||
Package: nvidia-container-runtime
|
||||
Pin: version {{ nvidia_container_runtime_major_version }}+{{ nvidia_docker_version .split("+")[1] }}*
|
||||
Pin-Priority: 600
|
||||
@@ -1,4 +0,0 @@
|
||||
Explanation: Pin added by Ansible role "{{ role_name }}"
|
||||
Package: nvidia-docker2
|
||||
Pin: version {{ nvidia_docker_version }}*
|
||||
Pin-Priority: 600
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
|
||||
nvidia_docker_deb_url: https://github.com/nvidia/nvidia-docker/releases/download/v{{ nvidia_docker_version }}/nvidia-docker_{{ nvidia_docker_version | regex_replace('-', '.') }}-1_amd64.deb
|
||||
@@ -29,12 +29,6 @@
|
||||
# - role: cuda # CUDA Driver Setup
|
||||
# tags: [cuda]
|
||||
|
||||
- role: cudnn
|
||||
tags: [cudnn]
|
||||
|
||||
- role: ansible-role-nvidia-driver
|
||||
tags: [ansible-role-nvidia-driver]
|
||||
|
||||
# - role: nvidia # NVIDIA-Docker Runtime Setup
|
||||
# tags: [nvidia]
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
*.retry
|
||||
@@ -1,25 +0,0 @@
|
||||
Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,77 +0,0 @@
|
||||
# ansible-role-nvidia-driver
|
||||
|
||||
An Ansible role to install the NVIDIA driver from the NVIDIA CUDA repositories.
|
||||
|
||||
## Requirements
|
||||
|
||||
In the process of installing the NVIDIA driver, this role will reboot the nodes where it runs.
|
||||
Because of this, we strongly recommend that you run `ansible-playbook` from a separate node than the GPU nodes where you are installing the driver.
|
||||
|
||||
If you attempt to run Ansible on the same node where you are installing the driver, this role will either:
|
||||
|
||||
* Refuse to proceed with an error like `Running reboot with local connection would reboot the control node` (if running with the `local` connection)
|
||||
* Reboot the node you're running on, interrupting the playbook execution! (if running the an `ssh` connection against localhost)
|
||||
|
||||
## Installing
|
||||
|
||||
This role can be installed using [Ansible Galaxy](https://galaxy.ansible.com/nvidia/nvidia_driver):
|
||||
|
||||
```
|
||||
$ ansible-galaxy install nvidia.nvidia_driver
|
||||
```
|
||||
|
||||
## Role variables
|
||||
|
||||
|
||||
| Variable | Default value | Description |
|
||||
| -------- | ------------- | ----------- |
|
||||
| `nvidia_driver_package_state` | `"present"` | Package state for NVIDIA driver packages |
|
||||
| `nvidia_driver_package_version` | `""` | Package version to install. Note that this should match the actual version of the deb or RPM package to be installed. |
|
||||
| `nvidia_driver_persistence_mode_on` | `yes` | Whether to enable persistence mode (boolean) |
|
||||
| `nvidia_driver_skip_reboot` | `no` | Whether to skip rebooting the node during the install |
|
||||
| `nvidia_driver_module_file` | `"/etc/modprobe.d/nvidia.conf"` | Filename to use for NVIDIA driver parameters |
|
||||
| `nvidia_driver_module_params` | `""` | Parameters to pass to the NVIDIA driver |
|
||||
|
||||
### Red Hat specific variables
|
||||
|
||||
|
||||
| Variable | Default value | Description |
|
||||
| -------- | ------------- | ----------- |
|
||||
| `epel_package` | `"https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"` | Package to install to enable EPEL |
|
||||
| `nvidia_driver_rhel_cuda_repo_baseurl` | `"https://developer.download.nvidia.com/compute/cuda/repos/{{ _rhel_repo_dir }}/"` | Base URL to use for CUDA repo |
|
||||
| `nvidia_driver_rhel_cuda_repo_gpgkey` | `"https://developer.download.nvidia.com/compute/cuda/repos/{{ _rhel_repo_dir }}/7fa2af80.pub"` | GPG key for the CUDA repo |
|
||||
|
||||
### Ubuntu specific variables
|
||||
|
||||
For Ubuntu installs, you have the choice of installing from the Canonical repositories and the NVIDIA CUDA repositories.
|
||||
|
||||
By default, the Canonical repositories will be used, and the driver installed will be the headless server driver.
|
||||
|
||||
| Variable | Default value | Description |
|
||||
| -------- | ------------- | ----------- |
|
||||
| `nvidia_driver_ubuntu_install_from_cuda_repo` | `no` | Flag whether to use the CUDA repo |
|
||||
| `nvidia_driver_ubuntu_branch` | `450` | Driver branch to use for the install |
|
||||
| `nvidia_driver_ubuntu_packages` | `["nvidia-headless-450-server", "nvidia-headless-450-utils"]` | Package names to install from Canonical repo |
|
||||
| `nvidia_driver_ubuntu_cuda_repo_baseurl` | `"http://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}"` | Base URL to use for CUDA repo |
|
||||
| `nvidia_driver_ubuntu_cuda_repo_gpgkey_url` | `"https://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}/7fa2af80.pub"` | GPG key for the CUDA repo |
|
||||
| `nvidia_driver_ubuntu_cuda_repo_gpgkey_id` | `"7fa2af80"` | GPG key ID for the CUDA repo |
|
||||
| `nvidia_driver_ubuntu_cuda_package` | `"cuda-drivers"` | Package name to install from CUDA repo |
|
||||
|
||||
## Example playbook
|
||||
|
||||
```
|
||||
- hosts: gpu_nodes
|
||||
roles:
|
||||
- nvidia.nvidia_driver
|
||||
```
|
||||
|
||||
## Supported distributions
|
||||
|
||||
Currently, this role supports the following Linux distributions:
|
||||
|
||||
* NVIDIA DGX OS 4
|
||||
* NVIDIA DGX OS 5
|
||||
* Ubuntu 18.04 LTS
|
||||
* Ubuntu 20.04 LTS
|
||||
* CentOS 7
|
||||
* Red Hat Enterprise Linux 7
|
||||
@@ -1,36 +0,0 @@
|
||||
nvidia_driver_package_state: present
|
||||
nvidia_driver_package_version: ''
|
||||
nvidia_driver_persistence_mode_on: yes
|
||||
nvidia_driver_skip_reboot: no
|
||||
nvidia_driver_module_file: /etc/modprobe.d/nvidia.conf
|
||||
nvidia_driver_module_params: ''
|
||||
|
||||
|
||||
##############################################################################
|
||||
# RedHat family #
|
||||
##############################################################################
|
||||
epel_package: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
|
||||
nvidia_driver_rhel_cuda_repo_baseurl: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _rhel_repo_dir }}/"
|
||||
nvidia_driver_rhel_cuda_repo_gpgkey: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _rhel_repo_dir }}/7fa2af80.pub"
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Ubuntu #
|
||||
##############################################################################
|
||||
|
||||
# Determine if we should install from CUDA repo instead of Canonical repos
|
||||
nvidia_driver_ubuntu_install_from_cuda_repo: no
|
||||
|
||||
# Installing with Canonical repositories
|
||||
nvidia_driver_ubuntu_branch: "450"
|
||||
nvidia_driver_ubuntu_packages:
|
||||
- "nvidia-headless-{{ nvidia_driver_ubuntu_branch }}-server"
|
||||
- "nvidia-utils-{{ nvidia_driver_ubuntu_branch }}-server"
|
||||
- "nvidia-headless-no-dkms-{{ nvidia_driver_ubuntu_branch }}-server"
|
||||
- "nvidia-kernel-source-{{ nvidia_driver_ubuntu_branch }}-server"
|
||||
|
||||
# Installing with CUDA repositories
|
||||
nvidia_driver_ubuntu_cuda_repo_gpgkey_url: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}/7fa2af80.pub"
|
||||
nvidia_driver_ubuntu_cuda_repo_gpgkey_id: "7fa2af80"
|
||||
nvidia_driver_ubuntu_cuda_repo_baseurl: "http://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}"
|
||||
nvidia_driver_ubuntu_cuda_package: "cuda-drivers"
|
||||
@@ -1,3 +0,0 @@
|
||||
Package: *
|
||||
Pin: release l=NVIDIA CUDA
|
||||
Pin-Priority: 600
|
||||
@@ -1,3 +0,0 @@
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/nvidia-persistenced --user root --persistence-mode --verbose
|
||||
@@ -1,22 +0,0 @@
|
||||
galaxy_info:
|
||||
role_name: nvidia_driver
|
||||
author: Luke Yeager
|
||||
company: NVIDIA
|
||||
description: Install the NVIDIA driver
|
||||
license: 3-Clause BSD
|
||||
min_ansible_version: 2.7
|
||||
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- 'xenial'
|
||||
- 'bionic'
|
||||
- 'focal'
|
||||
- name: EL
|
||||
versions:
|
||||
- '7'
|
||||
|
||||
galaxy_tags:
|
||||
- 'nvidia'
|
||||
- 'cuda'
|
||||
- 'driver'
|
||||
@@ -1,57 +0,0 @@
|
||||
---
|
||||
# We have to do this because the CentOS mirrors don't keep kernel-headers, etc
|
||||
# for older kernels.
|
||||
- name: ensure we have kernel-headers installed for the current kernel
|
||||
block:
|
||||
- name: attempt to install kernel support packages for current version
|
||||
yum:
|
||||
name:
|
||||
- "kernel-headers-{{ ansible_kernel }}"
|
||||
- "kernel-tools-{{ ansible_kernel }}"
|
||||
- "kernel-tools-libs-{{ ansible_kernel }}"
|
||||
- "kernel-devel-{{ ansible_kernel }}"
|
||||
- "kernel-debug-devel-{{ ansible_kernel }}"
|
||||
state: present
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
rescue:
|
||||
- name: update the kernel to latest version so we have a supported version
|
||||
yum:
|
||||
name:
|
||||
- "kernel"
|
||||
- "kernel-headers"
|
||||
- "kernel-tools"
|
||||
- "kernel-tools-libs"
|
||||
- "kernel-devel"
|
||||
- "kernel-debug-devel"
|
||||
state: latest
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
- name: reboot to pick up the new kernel
|
||||
reboot:
|
||||
|
||||
- name: add epel repo
|
||||
become: true
|
||||
yum:
|
||||
name:
|
||||
- "{{ epel_package }}"
|
||||
state: latest
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
- name: install dependencies
|
||||
yum: name=dkms
|
||||
|
||||
- name: add repo
|
||||
yum_repository:
|
||||
name: cuda
|
||||
description: NVIDIA CUDA YUM Repo
|
||||
baseurl: "{{ nvidia_driver_rhel_cuda_repo_baseurl }}"
|
||||
gpgkey: "{{ nvidia_driver_rhel_cuda_repo_gpgkey }}"
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
- name: install driver packages
|
||||
yum:
|
||||
name: "{{ nvidia_driver_package_version | ternary('nvidia-driver-latest-dkms-'+nvidia_driver_package_version, 'nvidia-driver-latest-dkms') }}"
|
||||
state: "{{ nvidia_driver_package_state }}"
|
||||
autoremove: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
register: install_driver
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
---
|
||||
- name: remove ppa
|
||||
apt_repository:
|
||||
repo: ppa:graphics-drivers/ppa
|
||||
state: absent
|
||||
|
||||
- name: add pin file
|
||||
copy:
|
||||
src: "cuda-ubuntu.pin"
|
||||
dest: "/etc/apt/preferences.d/cuda-repository-pin-600"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
|
||||
- name: add key
|
||||
apt_key:
|
||||
url: "{{ nvidia_driver_ubuntu_cuda_repo_gpgkey_url }}"
|
||||
id: "{{ nvidia_driver_ubuntu_cuda_repo_gpgkey_id }}"
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
|
||||
- name: add repo
|
||||
apt_repository:
|
||||
repo: "deb {{ nvidia_driver_ubuntu_cuda_repo_baseurl }} /"
|
||||
update_cache: yes
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
- name: install driver packages
|
||||
apt:
|
||||
name: "{{ nvidia_driver_package_version | ternary(nvidia_driver_ubuntu_cuda_package+'='+nvidia_driver_package_version, nvidia_driver_ubuntu_cuda_package) }}"
|
||||
state: "{{ nvidia_driver_package_state }}"
|
||||
autoremove: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
purge: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
register: install_driver
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
- name: remove ppa
|
||||
apt_repository:
|
||||
repo: ppa:graphics-drivers/ppa
|
||||
state: absent
|
||||
|
||||
- name: install driver packages
|
||||
apt:
|
||||
name: "{{ nvidia_driver_package_version | ternary(item+'='+nvidia_driver_package_version, item) }}"
|
||||
state: "{{ nvidia_driver_package_state }}"
|
||||
autoremove: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
purge: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
with_items: "{{ nvidia_driver_ubuntu_packages }}"
|
||||
register: install_driver
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
@@ -1,52 +0,0 @@
|
||||
---
|
||||
- name: unload nouveau
|
||||
modprobe:
|
||||
name: nouveau
|
||||
state: absent
|
||||
ignore_errors: true
|
||||
|
||||
- name: ubuntu install tasks (canonical repos)
|
||||
include_tasks: install-ubuntu.yml
|
||||
when: ansible_distribution == 'Ubuntu' and (not nvidia_driver_ubuntu_install_from_cuda_repo)
|
||||
|
||||
- name: ubuntu install tasks (CUDA repo)
|
||||
include_tasks: install-ubuntu-cuda-repo.yml
|
||||
when: ansible_distribution == 'Ubuntu' and nvidia_driver_ubuntu_install_from_cuda_repo
|
||||
|
||||
- name: redhat family install tasks
|
||||
include_tasks: install-redhat.yml
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: create persistenced override dir
|
||||
file:
|
||||
path: /etc/systemd/system/nvidia-persistenced.service.d/
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
- name: configure persistenced service to turn on persistence mode
|
||||
copy:
|
||||
src: nvidia-persistenced-override.conf
|
||||
dest: /etc/systemd/system/nvidia-persistenced.service.d/override.conf
|
||||
when: nvidia_driver_persistence_mode_on
|
||||
|
||||
- name: remove persistenced service override
|
||||
file:
|
||||
path: /etc/systemd/system/nvidia-persistenced.service.d/override.conf
|
||||
state: absent
|
||||
when: not nvidia_driver_persistence_mode_on
|
||||
|
||||
- name: enable persistenced
|
||||
systemd:
|
||||
name: nvidia-persistenced
|
||||
enabled: yes
|
||||
when: nvidia_driver_package_state != 'absent'
|
||||
|
||||
- name: set module parameters
|
||||
template:
|
||||
src: nvidia.conf.j2
|
||||
dest: "{{ nvidia_driver_module_file }}"
|
||||
mode: '0644'
|
||||
|
||||
- name: reboot after driver install
|
||||
reboot:
|
||||
when: install_driver.changed and not nvidia_driver_skip_reboot
|
||||
@@ -1 +0,0 @@
|
||||
{{ nvidia_driver_module_params }}
|
||||
@@ -1,6 +0,0 @@
|
||||
Test like this:
|
||||
```
|
||||
ansible-playbook --inventory tests/inventory.yml tests/playbook.yml
|
||||
```
|
||||
By default, the test inventory operates on the localhost.
|
||||
You may want to change this.
|
||||
@@ -1 +0,0 @@
|
||||
localhost
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
- hosts: all
|
||||
become: yes
|
||||
roles:
|
||||
- ../..
|
||||
@@ -1,2 +0,0 @@
|
||||
_ubuntu_repo_dir: "{{ ansible_distribution | lower }}{{ ansible_distribution_version | replace('.', '') }}/{{ ansible_architecture }}"
|
||||
_rhel_repo_dir: "rhel{{ ansible_distribution_major_version }}/{{ ansible_architecture }}"
|
||||
@@ -1,29 +0,0 @@
|
||||
---
|
||||
language: python
|
||||
python: "2.7"
|
||||
|
||||
# Use the new container infrastructure
|
||||
sudo: false
|
||||
|
||||
# Install ansible
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python-pip
|
||||
|
||||
install:
|
||||
# Install ansible
|
||||
- pip install ansible
|
||||
|
||||
# Check ansible version
|
||||
- ansible --version
|
||||
|
||||
# Create ansible.cfg with correct roles_path
|
||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
||||
|
||||
script:
|
||||
# Basic role syntax check
|
||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
@@ -1,43 +0,0 @@
|
||||
Ansible Role: cuDNN
|
||||
=========
|
||||
|
||||
Install [cuDNN](https://developer.nvidia.com/cudnn) on Linux System.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
- [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit) installed.
|
||||
- Download [cuDNN](https://developer.nvidia.com/cudnn) to [`files`](files) folder with your NVIDIA Developer account.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
`cuda_version`: The version of CUDA Toolkit installed. (default: 8.0)
|
||||
|
||||
`cudnn_version`: The version cuDNN. (default: v5.1)
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
```yaml
|
||||
- hosts: gpu
|
||||
become: yes
|
||||
|
||||
roles:
|
||||
- { role: cudnn, cuda_version: 8.0, cudnn_version: v5.1}
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
This role was created by [Daniel D](https://github.com/djx339).
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
# defaults file for cudnn
|
||||
cuda_version: 8.0
|
||||
cuda_version_str: "v{{ cuda_version }}"
|
||||
|
||||
cudnn_version: v5.1
|
||||
@@ -1,2 +0,0 @@
|
||||
---
|
||||
# handlers file for cudnn
|
||||
@@ -1,26 +0,0 @@
|
||||
galaxy_info:
|
||||
author: Daniel D
|
||||
description: An engineer
|
||||
company:
|
||||
|
||||
license: BSD
|
||||
|
||||
min_ansible_version: 1.2
|
||||
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
- trusty
|
||||
- xenial
|
||||
- name: CentOS
|
||||
versions:
|
||||
- all
|
||||
|
||||
|
||||
galaxy_tags:
|
||||
- cudnn
|
||||
- nvidia
|
||||
- cuda
|
||||
|
||||
dependencies: []
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
# tasks file for cudnn
|
||||
- name: Create installer dir
|
||||
file: "path={{ cudnn_installer_dir }} state=directory mode=0755"
|
||||
|
||||
- name: Uncompressing cudnn lib
|
||||
unarchive: "src={{ cudnn_installer.local_file }} dest={{ cudnn_installer_dir }}"
|
||||
register: __cudnn_result
|
||||
|
||||
- name: Install cudnn
|
||||
shell: cp -rf {{ item.src }} {{ item.dest }}
|
||||
with_items:
|
||||
- { src: "{{ cudnn_installer_dir }}/cuda/lib64/*", dest: "/usr/local/cuda/lib64/" }
|
||||
- { src: "{{ cudnn_installer_dir }}/cuda/include/cudnn.h", dest: "/usr/local/cuda/include/" }
|
||||
when: __cudnn_result|changed
|
||||
@@ -1 +0,0 @@
|
||||
localhost
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- cudnn
|
||||
@@ -1,31 +0,0 @@
|
||||
---
|
||||
# vars file for cudnn
|
||||
cudnn_installer_map:
|
||||
v11.5:
|
||||
v8.2.0.53:
|
||||
url: https://developer.nvidia.com/rdp/assets/cudnn-11.3-linux-x64-v8.2.53.tgz
|
||||
local_file: cudnn-8.0-linux-x64-v5.1.tgz
|
||||
v8.0:
|
||||
v6.0:
|
||||
url: https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v6/prod/8.0_20170427/cudnn-8.0-linux-x64-v6.0-tgz
|
||||
local_file: cudnn-8.0-linux-x64-v6.0.tgz
|
||||
v5.1:
|
||||
url: https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v5.1/prod_20161129/8.0/cudnn-8.0-linux-x64-v5.1-tgz
|
||||
local_file: cudnn-8.0-linux-x64-v5.1.tgz
|
||||
v5.0:
|
||||
url: https://developer.nvidia.com/rdp/assets/cudnn-8.0-linux-x64-v5.0-ga-tgz
|
||||
local_file: cudnn-8.0-linux-x64-v5.0-ga.tgz
|
||||
v7.5:
|
||||
v6.0:
|
||||
url: https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v6/prod/7.5_20170427/cudnn-7.5-linux-x64-v6.0-tgz
|
||||
local_file: cudnn-7.5-linux-x64-v6.0.tgz
|
||||
v5.1:
|
||||
url: https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v5.1/prod_20161129/7.5/cudnn-7.5-linux-x64-v5.1-tgz
|
||||
local_file: cudnn-7.5-linux-x64-v5.1.tgz
|
||||
v5.0:
|
||||
url: https://developer.nvidia.com/rdp/assets/cudnn-7.5-linux-x64-v5.0-ga.tgz
|
||||
local_file: cudnn-7.5-linux-x64-v5.0-ga.tgz
|
||||
|
||||
|
||||
cudnn_installer: "{{ cudnn_installer_map[cuda_version_str][cudnn_version] }}"
|
||||
cudnn_installer_dir: "/tmp/cudnn_installer"
|
||||
@@ -11,5 +11,6 @@ general:
|
||||
- software-properties-common # known good with 0.96.24.32.7
|
||||
- git
|
||||
- golang
|
||||
- apt-utils
|
||||
pip:
|
||||
- docker>=3.7.0 # known good with 3.7.0
|
||||
|
||||
Reference in New Issue
Block a user