54 lines
970 B
Python
54 lines
970 B
Python
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Copyright: (c) 2024, Luca Bilke <luca@bil.ke>
|
|
# MIT License (see LICENSE)
|
|
|
|
# TODO: write ansible sections
|
|
|
|
DOCUMENTATION = r"""
|
|
"""
|
|
|
|
EXAMPLES = r"""
|
|
"""
|
|
|
|
RETURN = r"""
|
|
"""
|
|
|
|
from __future__ import annotations # pyright: ignore[reportGeneralTypeIssues]
|
|
|
|
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
|
|
State,
|
|
run_service,
|
|
update_service,
|
|
)
|
|
|
|
|
|
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 update_service(state, update)
|
|
|
|
|
|
def main():
|
|
extra_args = {
|
|
"read_only": {"type": "bool"},
|
|
}
|
|
run_service(extra_args, helper)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|