2019-03-02 17:29:15 +00:00
|
|
|
---
|
|
|
|
- name: copy docker registry nginx configuration
|
2022-11-26 08:52:41 +00:00
|
|
|
ansible.builtin.copy:
|
|
|
|
src: files/configs/docker_registry/nginx.conf
|
|
|
|
dest: /docker-volumes/nginx/vhost/{{ services.docker_registry.domain }}
|
|
|
|
mode: '0644'
|
2019-03-02 17:29:15 +00:00
|
|
|
|
|
|
|
- name: docker registry container
|
2022-11-26 08:52:41 +00:00
|
|
|
community.docker.docker_container:
|
2019-03-02 17:29:15 +00:00
|
|
|
name: registry
|
2022-11-26 08:15:18 +00:00
|
|
|
image: registry:{{ services.docker_registry.version }}
|
2019-03-02 17:29:15 +00:00
|
|
|
restart_policy: always
|
|
|
|
volumes:
|
2022-11-26 08:52:41 +00:00
|
|
|
- '{{ services.docker_registry.volume_folder }}/registry:/var/lib/registry'
|
|
|
|
- '{{ services.docker_registry.volume_folder }}/auth:/auth'
|
2019-03-02 17:29:15 +00:00
|
|
|
networks:
|
|
|
|
- name: external_services
|
|
|
|
env:
|
2022-11-26 08:52:41 +00:00
|
|
|
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
|
2019-03-02 18:15:37 +00:00
|
|
|
|
|
|
|
- name: generate htpasswd file
|
2022-11-26 09:47:37 +00:00
|
|
|
shell: docker exec -it registry htpasswd -Bbn docker {{ docker_password }} > services.docker_registry.volume_folder
|
|
|
|
}}/auth/htpasswd
|
2019-03-02 18:15:37 +00:00
|
|
|
args:
|
2022-11-26 08:52:41 +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:52:41 +00:00
|
|
|
registry: "{{ 'docker.data.coop' if vagrant else services.docker_registry.domain\
|
|
|
|
\ }}"
|
|
|
|
username: docker
|
|
|
|
password: '{{ docker_password }}'
|