docker: add support for additional sockets

Add support to configure additional sockets with a new parameter (must
be an array):
container_registry_additional_sockets

Example of value:
container_registry_additional_sockets:
  - /var/lib/openstack/docker.sock
  - /var/run/some-other/docker.sock

Change-Id: I0da7f5f1005532b8ba68c46ed6ca065cc333d0d5
This commit is contained in:
Emilien Macchi 2018-05-07 12:49:25 -07:00
parent 64371928c2
commit 7753bfd408
3 changed files with 10 additions and 1 deletions

View File

@ -13,3 +13,4 @@ container_registry_port: 8787
container_registry_mirror: ''
container_registry_storage_options: '-s overlay2'
container_registry_selinux: false
container_registry_additional_sockets: []

View File

@ -49,6 +49,14 @@
vars:
registry_flags: "{% for reg in container_registry_insecure_registries %}--insecure-registry {{ reg }}{% if not loop.last %} {% endif %}{% endfor %}"
- name: Create additional socket directories
file:
path: "{{ item | dirname }}"
state: directory
notify: restart docker service
with_items: "{{ container_registry_additional_sockets }}"
when: container_registry_additional_sockets | length > 0
- name: manage /etc/docker/daemon.json
template:
src: docker-daemon.json.j2

View File

@ -1 +1 @@
_full_docker_options: "{% if container_registry_selinux|bool %}--selinux-enabled {% endif %}{{ container_registry_docker_options }}"
_full_docker_options: "{% if container_registry_selinux|bool %}--selinux-enabled {% endif %}{% if container_registry_additional_sockets | length > 0 %}-H unix:///run/docker.sock {% for soc in container_registry_additional_sockets %}-H unix://{{ soc }}{% if not loop.last %} {% endif %}{% endfor %}{% endif %} {{ container_registry_docker_options }}"