---
# tasks file for docker-distribution

- name: install docker-distribution
  action: "{{ ansible_pkg_mgr }} name=docker-distribution state=present"
  tags:
  - docker-distribution

- name: start and enable docker-distribution
  service: name=docker-distribution state=started enabled=yes
  tags:
  - docker-distribution

- name: configure docker-distribution
  template:
    src: config.yml.j2
    dest: "{{ conf_path }}"
  notify: restart docker-distribution
  tags:
  - docker-distribution

- name: ensure docker certs dir exists
  file:
    path: "{{ cert.dest_dir }}"
    state: directory
  when: tls.enabled
  tags:
  - docker-distribution

- debug: var=cert
  tags:
  - docker-distribution

- name: install tls cert for docker
  copy:
    src: "{{ cert.cert_src }}"
    dest: "{{ cert.dest_dir}}/{{ cert.cert_dest }}"
  when: tls.enabled
  tags:
  - docker-distribution

- name: install tls key for docker
  copy:
    src: "{{ cert.key_src }}"
    dest: "{{ cert.dest_dir}}/{{ cert.key_dest }}"
  when: tls.enabled
  tags:
  - docker-distribution

