37 lines
1.3 KiB
YAML
37 lines
1.3 KiB
YAML
# vim: ft=yaml.ansible
|
|
---
|
|
- name: copy docker registry vhost configuration
|
|
copy:
|
|
src: vhost/docker_registry
|
|
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.docker_registry.domain }}"
|
|
mode: "0644"
|
|
|
|
- name: docker registry container
|
|
docker_container:
|
|
name: registry
|
|
image: registry:{{ services.docker_registry.version }}
|
|
restart_policy: always
|
|
volumes:
|
|
- "{{ services.docker_registry.volume_folder }}/registry:/var/lib/registry"
|
|
- "{{ services.docker_registry.volume_folder }}/auth:/auth"
|
|
networks:
|
|
- name: external_services
|
|
env:
|
|
VIRTUAL_HOST: "{{ services.docker_registry.domain }}"
|
|
LETSENCRYPT_HOST: "{{ services.docker_registry.domain }}"
|
|
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
|
|
REGISTRY_AUTH: "htpasswd"
|
|
REGISTRY_AUTH_HTPASSWD_PATH: "/auth/htpasswd"
|
|
REGISTRY_AUTH_HTPASSWD_REALM: "data.coop docker registry"
|
|
|
|
- name: generate htpasswd file
|
|
shell: "docker exec -it registry htpasswd -Bbn docker {{ docker_password }} > {{ services.docker_registry.volume_folder }}/auth/htpasswd"
|
|
args:
|
|
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 }}"
|