def task_enable_docker(distribution):
 docker_tls_options = '--tlsverify --tlscacert=/etc/flocker/cluster.crt --tlscert=/etc/flocker/node.crt --tlskey=/etc/flocker/node.key -H=0.0.0.0:2376'
 unixsock_opt = '-H unix:///var/run/docker.sock'
 if is_systemd_distribution(distribution):
  conf_path = '/etc/systemd/system/docker.service.d/01-TimeoutStartSec.conf'
  return sequence([run('mkdir -p /etc/systemd/system/docker.service.d'), put(path=conf_path, content=dedent('                    [Service]\n                    TimeoutStartSec=10min\n                    ')), put(path='/etc/systemd/system/docker.service.d/02-TLS.conf', content=dedent('                    [Service]\n                    ExecStart=\n                    ExecStart=/usr/bin/dockerd {} {}\n                    '.format(unixsock_opt, docker_tls_options))), run_from_args(['systemctl', 'enable', 'docker.service'])])
 elif is_ubuntu(distribution):
  return sequence([put(path='/etc/default/docker', content='DOCKER_OPTS="{} {}"'.format(unixsock_opt, docker_tls_options))])
 else:
  raise DistributionNotSupported(distribution=distribution)

def task_enable_docker ( distribution ) : docker_tls_options = '--tlsverify --tlscacert=/etc/flocker/cluster.crt --tlscert=/etc/flocker/node.crt --tlskey=/etc/flocker/node.key -H=0.0.0.0:2376' unixsock_opt = '-H unix:///var/run/docker.sock' if is_systemd_distribution ( distribution ) : conf_path = '/etc/systemd/system/docker.service.d/01-TimeoutStartSec.conf' return sequence ( [ run ( 'mkdir -p /etc/systemd/system/docker.service.d' ) , put ( path = conf_path , content = dedent ( '                    [Service]\n                    TimeoutStartSec=10min\n                    ' ) ) , put ( path = '/etc/systemd/system/docker.service.d/02-TLS.conf' , content = dedent ( '                    [Service]\n                    ExecStart=\n                    ExecStart=/usr/bin/dockerd {} {}\n                    ' . format ( unixsock_opt , docker_tls_options ) ) ) , run_from_args ( [ 'systemctl' , 'enable' , 'docker.service' ] ) ] ) elif is_ubuntu ( distribution ) : return sequence ( [ put ( path = '/etc/default/docker' , content = 'DOCKER_OPTS="{} {}"' . format ( unixsock_opt , docker_tls_options ) ) ] ) else : raise DistributionNotSupported ( distribution = distribution )
configure docker .