Docker host and docker registry

This commit is contained in:
2016-12-28 13:13:35 -05:00
parent a519e04791
commit 96087c2295
23 changed files with 361 additions and 27 deletions

View File

@@ -0,0 +1,37 @@
---
# Main task for creating a docker registry
- name: clean up old config
command: "rm -rf /opt/dkrepository"
# create folders for certs, data,
- name: create data folders (/opt/dkregistry)
file:
path: "{{ item }}"
state: directory
owner: root
group: docker
mode: 0770
with_items:
- /opt/dkregistry/data
- /opt/dkregistry/auth
# make auth files using docker container
- name: create auth file
shell: echo '' > /opt/dkregistry/auth/htpasswd
- name: add user to auth file
shell: "docker run --entrypoint htpasswd registry:2 -Bbn {{ item.name }} {{ item.pass }} >> /opt/dkregistry/auth/htpasswd"
with_items:
- { "name" : "richard", "pass" : "richard" }
- { "name" : "testuser", "pass" : "testpassword" }
- name: copy composer file
copy:
src: docker-compose.yml
dest: /opt/dkregistry/docker-compose.yml
- name: run docker up
shell: "docker-compose up -d"
args:
chdir: /opt/dkregistry