---
# File: docker.yml - Docker tasks for nomad

## Docker items

# Fix for https://github.com/docker/docker/issues/23347
- name: Install dmsetup for Ubuntu 16.04
  apt:
    pkg: dmsetup
    state: installed
    update_cache: true
    cache_valid_time: 600
  register: dmsetup_result
  when:
    - ansible_os_family == "Debian"
    - ansible_distribution_version is version_compare(16.04, '=')
    - nomad_docker_dmsetup | bool

- name: Run dmsetup for Ubuntu 16.04
  command: dmsetup mknodes
  when:
    - nomad_docker_dmsetup | bool
    - dmsetup_result

- name: Add Nomad user to docker group
  user:
    name: "{{ nomad_user }}"
    groups: docker
    append: true
  when:
    - nomad_user != 'root'

---
# File: docker.yml - Docker tasks for nomad

## Docker items

# Fix for https://github.com/docker/docker/issues/23347
- name: Install dmsetup for Ubuntu 16.04
  apt:
    pkg: dmsetup
    state: present
    update_cache: true
    cache_valid_time: 600
  register: dmsetup_result
  when:
    - ansible_os_family == "Debian"
    - ansible_distribution_version is version_compare(16.04, '=')
    - nomad_docker_dmsetup | bool

- name: Run dmsetup for Ubuntu 16.04
  command: dmsetup mknodes
  when:
    - nomad_docker_dmsetup | bool
    - dmsetup_result

- name: Add Nomad user to docker group
  user:
    name: "{{ nomad_user }}"
    groups: docker
    append: true
  when:
    - nomad_user != 'root'

Fix apt package state to present
Fix apt package state to present
