ez_docker/plugins/module_utils/service/docker_socket_proxy.py
2024-12-11 18:42:59 +01:00

41 lines
894 B
Python

# Copyright: (c) 2024, Luca Bilke <luca@bil.ke>
# MIT License (see LICENSE)
from __future__ import annotations
from typing import TYPE_CHECKING
from ansible_collections.snailed.ez_compose.plugins.module_utils.service import common as service
if TYPE_CHECKING:
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import State
def helper(state: State) -> State:
read_only = state.module.params.get("read_only", True)
volumes = [
{
"type": "bind",
"source": "/var/run/docker.sock",
"target": "/var/run/docker.sock",
"read_only": read_only,
}
]
update = {
"volumes": volumes,
}
return service.update(state, update)
def main():
extra_args = {
"read_only": {"type": "bool"},
}
service.run(extra_args, helper)
if __name__ == "__main__":
main()