2022-12-29 21:13:31 +00:00
|
|
|
# vim: ft=yaml.ansible
|
2019-03-02 17:29:15 +00:00
|
|
|
---
|
2023-09-30 16:15:27 +00:00
|
|
|
- name: Create Docker registry volume folders
|
|
|
|
file:
|
|
|
|
path: "{{ services.docker_registry.volume_folder }}/{{ volume }}"
|
|
|
|
state: directory
|
|
|
|
loop:
|
|
|
|
- auth
|
|
|
|
- registry
|
|
|
|
loop_control:
|
|
|
|
loop_var: volume
|
|
|
|
|
|
|
|
- name: Copy docker registry vhost configuration
|
2019-03-02 17:29:15 +00:00
|
|
|
copy:
|
2023-07-09 19:08:42 +00:00
|
|
|
src: vhost/docker_registry
|
2023-07-09 18:27:32 +00:00
|
|
|
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.docker_registry.domain }}"
|
2019-03-02 17:29:15 +00:00
|
|
|
mode: "0644"
|
|
|
|
|
2023-09-30 16:15:27 +00:00
|
|
|
- name: Upload Compose file for Docker registry
|
|
|
|
template:
|
|
|
|
src: compose-files/docker_registry.yml.j2
|
|
|
|
dest: "{{ services.docker_registry.volume_folder }}/docker-compose.yml"
|
|
|
|
|
|
|
|
- name: Deploy Docker registry
|
|
|
|
docker_compose:
|
|
|
|
project_src: "{{ services.docker_registry.volume_folder }}"
|
|
|
|
pull: true
|
|
|
|
state: present
|
2019-03-02 18:15:37 +00:00
|
|
|
|
2023-09-30 16:15:27 +00:00
|
|
|
- name: Generate htpasswd file
|
|
|
|
shell: "docker compose exec registry htpasswd -Bbn docker {{ docker_password }} > auth/htpasswd"
|
2019-03-02 18:15:37 +00:00
|
|
|
args:
|
2023-09-30 16:15:27 +00:00
|
|
|
chdir: "{{ services.docker_registry.volume_folder }}"
|
2022-11-26 08:15:18 +00:00
|
|
|
creates: "{{ services.docker_registry.volume_folder }}/auth/htpasswd"
|
2019-03-02 18:15:37 +00:00
|
|
|
|
2022-11-25 13:07:09 +00:00
|
|
|
- name: log in to registry
|
2019-03-02 18:15:37 +00:00
|
|
|
docker_login:
|
2022-11-26 08:15:18 +00:00
|
|
|
registry: "{{ 'docker.data.coop' if vagrant else services.docker_registry.domain }}"
|
2019-03-02 18:15:37 +00:00
|
|
|
username: "docker"
|
|
|
|
password: "{{ docker_password }}"
|