- name: Synchronize docker-compose directory synchronize: src: registry-docker/ dest: /etc/registry-docker/ - name: Ensure registry volume directories exists file: state: directory path: "/var/registry/{{ item }}" loop: - data - certs - auth - name: Install passlib package: name: - python3-passlib - python3-bcrypt state: present - name: Write htpassword file htpasswd: create: true crypt_scheme: bcrypt path: /var/registry/auth/htpasswd name: "{{ registry_user }}" password: "{{ registry_password }}" - name: Write TLS private key copy: content: "{{ registry_tls_key }}" dest: /var/registry/certs/domain.key - name: Write TLS certificate copy: content: "{{ registry_tls_cert }}{{ registry_tls_chain | default('') }}" dest: /var/registry/certs/domain.crt - name: Install docker-compose package: name: - docker-compose state: present - name: Run docker-compose pull shell: cmd: docker-compose pull chdir: /etc/registry-docker/ - name: Run docker-compose up shell: cmd: docker-compose up -d chdir: /etc/registry-docker/ - name: Install cron to garbage collect the registry daily cron: name: "docker registry garbage-collect" minute: "0" hour: "0" job: "/usr/bin/docker exec registrydocker_registry_1 registry garbage-collect /etc/docker/registry/config.yml > /dev/null"