ansible/roles/docker/tasks/services/docker_registry.yml

41 lines
1.2 KiB
YAML
Raw Normal View History

# 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:
src: vhost/docker_registry
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
2023-09-30 16:15:27 +00:00
- name: Generate htpasswd file
shell: "docker compose exec registry htpasswd -Bbn docker {{ docker_password }} > auth/htpasswd"
args:
2023-09-30 16:15:27 +00:00
chdir: "{{ services.docker_registry.volume_folder }}"
creates: "{{ services.docker_registry.volume_folder }}/auth/htpasswd"
- name: log in to registry
docker_login:
registry: "{{ 'docker.data.coop' if vagrant else services.docker_registry.domain }}"
username: "docker"
password: "{{ docker_password }}"