Skip to content

Commit

Permalink
Added Ansible scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmbnv committed Dec 12, 2019
1 parent d92789b commit 0d0a89d
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 0 deletions.
53 changes: 53 additions & 0 deletions Ansible/anaconda3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
- hosts: "{{ host | default('localhost')}}"
become: yes
vars:
version: "2019.10"
environment:
PATH: /opt/anaconda3/bin:/snap/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
tasks:
- stat: path=/opt/anaconda3/bin
register: anaconda3
- name: install anaconda3
block:
- apt:
name: "{{ item }}"
state: present
with_items:
- libgl1-mesa-glx
- libegl1-mesa
- libxrandr2
- libxss1
- libxcursor1
- libxcomposite1
- libasound2
- libxi6
- libxtst6
- name: downloading
get_url:
url: "https://repo.continuum.io/archive/Anaconda3-{{ version }}-Linux-x86_64.sh"
dest: /tmp/anaconda3.sh
- shell: rm -rf /opt/anaconda3
- shell: mkdir -p /opt
- name: unpacking
shell: bash /tmp/anaconda3.sh -b -p /opt/anaconda3
- shell: rm -rf /tmp/anaconda3.sh
when: anaconda3.stat.isdir is not defined
- name: update anaconda
shell: conda update -y --prefix /opt/anaconda3 anaconda
- name: packages
shell: conda install -y -c anaconda pip
- shell: conda install -y -c conda-forge jupyterlab
- shell: conda install -y -c conda-forge pyzmq
- shell: conda install -y -c conda-forge editdistance
- shell: conda install -y -c conda-forge braceexpand
- shell: conda install -y -c conda-forge rise
- shell: conda install -y -c conda-forge bash_kernel
- shell: conda install -y -c conda-forge scikit-image
- shell: conda install -y -c conda-forge scikit-learn
- shell: conda install -y pytorch torchvision cudatoolkit=10.1 -c pytorch
- shell: conda install -y -c conda-forge nvidia-apex
- shell: python3 -m pip install git+git://github.com/tmbdev/webdataset
- shell: python3 -m pip install git+git://github.com/tmbdev/torchmore
- shell: python3 -m pip install git+git://github.com/tmbdev/tarproc
- shell: python3 -m pip install git+git://github.com/NVlabs/tensorcom
40 changes: 40 additions & 0 deletions Ansible/docker-nv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# Step 1: $ apt-get install ansible
# Step 2: $ ansible-playbook docker-nv.yml
- hosts: "localhost"
tasks:
- add_host: name="{{ host | default('localhost')}}"
- hosts: "{{ host | default('localhost')}}"
become: yes
tasks:
- apt: name=docker state=absent
- apt: name=docker.io state=absent
# - shell: curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
- shell: /etc/init.d/docker stop || true
- name: remove old docker dir
shell: test -d /var/lib/docker/. && mkdir /tmp/empty$$ && rsync -a --delete /tmp/empty$$/. /var/lib/docker/.
- name: install new docker
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
state: present
- apt_key:
url: https://nvidia.github.io/nvidia-docker/gpgkey
state: present
- get_url:
url: https://nvidia.github.io/nvidia-docker/ubuntu18.04/nvidia-docker.list
dest: /etc/apt/sources.list.d/nvidia-docker.list
- apt: update_cache=yes upgrade=full # autoremove=yes purge=yes
- apt: name=docker-ce state=latest
- apt: name=nvidia-docker2 state=latest force=yes
- pip: name=nvidia-docker-compose state=latest
- shell: /etc/init.d/docker start
- apt: name=snapd state=latest
#- snap: name=microk8s
#- shell: microk8s.stop || true
#- shell: snap install --classic microk8s
#- shell: microk8s.start
#- pause: seconds=45
#- shell: microk8s.enable dns dashboard storage ingress gpu
23 changes: 23 additions & 0 deletions Ansible/gui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- hosts: "{{ host | default('localhost')}}"
become: yes
become_method: sudo
tasks:
- name: GUI
apt:
state: latest
name:
- git-gui
- icewm
- imagemagick
- rxvt-unicode
- tigervnc-scraping-server
- tigervnc-standalone-server
- tigervnc-viewer
- tigervnc-xorg-extension
- ttf-ubuntu-font-family
- ttf-unifont
- vim-gtk
- xclip
- xterm
ignore_errors: true
14 changes: 14 additions & 0 deletions Ansible/microk8s.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- hosts: "localhost"
tasks:
- add_host: name="{{ host | default('localhost')}}"
- hosts: "{{ host | default('localhost')}}"
become: yes
tasks:
- apt: name=snapd state=latest
#- snap: name=microk8s
- shell: microk8s.stop || true
- shell: snap install --classic microk8s
- shell: microk8s.start
- pause: seconds=45
- shell: microk8s.enable dns dashboard storage ingress gpu registry
10 changes: 10 additions & 0 deletions Ansible/nvidia-driver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- hosts: "{{ host | default('localhost')}}"
become: yes
become_method: sudo
tasks:
- shell: wget -nd https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.2.89-1_amd64.deb
- shell: dpkg -i cuda-repo-ubuntu1804_10.2.89-1_amd64.deb
- shell: apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
- shell: apt-get update
- shell: apt-get install -y cuda

0 comments on commit 0d0a89d

Please sign in to comment.