- name: setup registry
  hosts: registry
  user: root
  vars:
    path: /var/tmp/wise2c/registry
  tasks:
  - name: make registry dir
    file:
      path: '{{ item }}'
      state: directory
      mode: 0755
    with_items:
    - '{{ cpath }}'
    - '{{ path }}'

  - name: unarchive harbor
    unarchive:
      src: file/harbor-offline-installer-{{ version }}.tgz
      dest: '{{ cpath }}'

  - name: generate registry config
    template:
      src: '{{ item.src }}'
      dest: '{{ item.dest }}'
    with_items:
    - { src: 'template/harbor.cfg.j2', dest: '{{ cpath }}/harbor/harbor.cfg' }

  - name: launch registry
    shell: ./install.sh
    args:
      chdir: '{{ cpath }}/harbor'