Skip to content
Permalink
Browse files

[debops.docker_server] Get storage driver via fact

  • Loading branch information...
drybjed committed Aug 13, 2019
1 parent 495906c commit 6fbf2e093ab7f02b27678f3e517ebfa9fab03256
@@ -386,9 +386,12 @@ docker_server__registry_mirrors: []
# .. envvar:: docker_server__storage_driver [[[
#
# Storage driver for docker volumes.
docker_server__storage_driver: '{{ "aufs"
if (ansible_distribution_release in ["wheezy", "jessie" ])
else "overlay" }}'
docker_server__storage_driver: '{{ ansible_local.docker_server.storage_driver
if (ansible_local|d() and ansible_local.docker_server|d() and
ansible_local.docker_server.storage_driver|d())
else ("aufs"
if (ansible_distribution_release in ["wheezy", "jessie" ])
else "overlay") }}'

# ]]]
# .. envvar:: docker_server__storage_options [[[
@@ -3,13 +3,14 @@
# {{ ansible_managed }}

from __future__ import print_function
from json import loads, dumps
from json import load, loads, dumps
from sys import exit
import subprocess
import os
import re

docker_pkg = loads('''{{ docker_server__packagename | to_nice_json }}''')
daemon_json = '/etc/docker/daemon.json'


def cmd_exists(cmd):
@@ -46,4 +47,13 @@ try:
except Exception:
pass

print(dumps(output, sort_keys=True, indent=2))
if os.path.exists(daemon_json) and os.path.isfile(daemon_json):
try:
with open(daemon_json, 'r') as f:
daemon_config = load(f)
output['storage_driver'] = daemon_config['storage-driver']

except Exception:
pass

print(dumps(output, sort_keys=True, indent=4))

0 comments on commit 6fbf2e0

Please sign in to comment.
You can’t perform that action at this time.