--- - name: Container Setup vars: lxc_base: ansible-alpine3.11 lxc_name: docker-registry import_playbook: ../common/tasks/lxc.yml - name: Installing Docker Registry on Alpine LXC Container hosts: docker_registry vars_files: - ../variables.yml tasks: - name: Including docker bootstrap for alpine include: ../common/tasks/docker/alpine.yml - name: Creating docker registry folder file: path: /opt/docker/registry state: directory - name: Working around docker registry not restarting after reboot blockinfile: path: /etc/local.d/2-docker-registry.start block: | while true; do [ -e /run/docker.sock ] && break; sleep 3; done docker stop $(docker ps -aq); docker container prune --force; docker run -d \ --publish=5000:5000 \ --volume=/opt:/var/lib/registry \ --env=REGISTRY_HTTP_SECRET={{ secret_key }} \ --restart=always \ --name=registry \ registry:{{ docker_registry_version }} \ create: yes - name: Setting rc.local executable file: path: /etc/local.d/2-docker-registry.start mode: '0755' - name: Starting docker registry service: name: local state: restarted enabled: yes