---
- name: 'Copy config for "{{ service }}"'
  template:
    src: "{{ service_path }}/config/config.yml"
    dest: "{{ remote_service_path }}/config/config.yml"
  register: registry_config
  tags:
    - config

- name: 'Generate passwords file for "{{ service }}"'
  community.general.htpasswd:
    path: "{{ remote_service_path }}/config/htpasswd"
    name: "{{ registry_user.name }}"
    crypt_scheme: bcrypt
    password: "{{ registry_user.password }}"
  loop: "{{ registry_users }}"
  loop_control:
    loop_var: registry_user
    label: "{{ registry_user.name }}"
  tags:
    - config

- name: 'Compute config hash for passwords file of "{{ service }}"'
  ansible.builtin.stat:
    path: "{{ remote_service_path }}/config/htpasswd"
    get_mime: no
    get_attributes: no
    get_checksum: yes
  register: registry_htpasswd