---
### DNS FIXES
- name: create custom dns config
  template:
    src: 99-custom-dns.yaml
    dest: /etc/netplan/99-custom-dns.yaml
    mode: 0644
  become: yes

- name: create custom docker daemon.json
  template:
    src: docker_daemon.json
    dest: /etc/docker/daemon.json
  become: yes


### LUSTRE CLIENT FOR FSx
- name: add fsx lustre repository key
  apt_key:
    url: "https://fsx-lustre-client-repo-public-keys.s3.amazonaws.com/fsx-ubuntu-public-key.asc"
    state: present
  become: yes

- name: add lustre repo
  apt_repository:
    repo: "deb https://fsx-lustre-client-repo.s3.amazonaws.com/ubuntu bionic main"
  become: yes

- name: install lustre client
  apt:
    name: lustre-client-modules-4.15.0-1080-aws
    update_cache: yes
  become: yes

- name: create fsx mount directories
  file:
    path: "{{item}}"
    state: directory
    mode: 0777
    owner: root
    group: root
  become: yes
  with_items:
    - "/mnt/fsx-readonly"
    - "/mnt/fsx-temp"
    - "/mnt/fsx-persistent"

### INSTALL NVIDIA Fabric Manager
- name: add nvidia
  apt_key:
    url: "https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub"
    state: present
  become: yes

- name: add nvidia repo
  apt_repository:
    repo: "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /"
  become: yes

- name: install nvidia-fabricmanager
  apt:
    name: nvidia-fabricmanager-450
    update_cache: yes
  become: yes

- name: start nvidia-fabricmanager
  service:
    name: nvidia-fabricmanager
    enabled: yes
  become: yes

