library/roles/docker: Install and customize /etc/default/docker.

This commit is contained in:
Andrea Dell'Amico 2017-03-30 01:47:09 +02:00
parent 691b10ad28
commit 51b03d7d7d
3 changed files with 23 additions and 0 deletions

View File

@ -13,3 +13,7 @@ docker_packages:
docker_run_as_docker_user: True
docker_user_home: /home/docker
docker_defaults_file: /etc/default/docker
docker_enable_tcp_socket: False
docker_tcp_socket_port: 2375
docker_tcp_socket_host: 127.0.0.1

View File

@ -14,6 +14,10 @@
apt: pkg={{ item }} state={{ docker_pkg_status }} update_cache=yes cache_valid_time=3600
with_items: '{{ docker_packages }}'
- name: Install the Docker default options
template: src=docker-default.j2 dest={{ docker_defaults_file }} owner=root group=root mode=0644
notify: Restart docker
- name: Ensure that the service is started and enabled
service: name=docker state=started enabled=yes

View File

@ -0,0 +1,15 @@
# Customize location of Docker binary (especially for development testing).
#DOCKERD="/usr/local/bin/dockerd"
CUSTOM_DOCKER_SOCKET="-H tcp://{{ docker_tcp_socket_host }}:{{ docker_tcp_socket_port }} -H unix:///var/run/docker.sock"
#CUSTOM_DOCKER_DNS_SERVERS="--dns 8.8.8.8 --dns 8.8.4.4"
# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="{% if docker_enable_tcp_socket %}$CUSTOM_DOCKER_SOCKET {% endif %}"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"
# This is also a handy place to tweak where Docker's temporary files go.
#export DOCKER_TMPDIR="/mnt/bigdrive/docker-tmp"