- name: Copy registry config file
  template:
    src: files/registry-config.yml.j2
    dest: /home/jingrow/registry/config.yml
    owner: jingrow
    group: jingrow
    mode: '0644'
  vars:
    is_mirror: "{{ is_mirror }}"
    username: "{{ registry_username }}"
    password: "{{ registry_password }}"
    proxy_pass: "{{ proxy_pass }}"


- name: Copy docker compose file
  template:
    src: files/registry-docker-compose.yml.j2
    dest: /home/jingrow/registry/docker-compose.yml
    owner: jingrow
    group: jingrow
    mode: '0644'
  vars:
    docker_data_mountpoint: "{{ docker_data_mountpoint }}"
    container_registry_config_path: "{{ container_registry_config_path }}"
    is_mirror: "{{ is_mirror }}"


- name: Start docker registry with docker compose
  command: docker compose up -d
  args:
    chdir: /home/jingrow/registry
