-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for a flexible container_args
to avoid implementing every docker run
command line argument
#60
Comments
@mhutter, I would appreciate your thoughts on this. Personally, I am just for a strict breaking change with changelog entry and migration guide + releasing a v1.X after this. Even with -alpha or -beta suffix at first. |
Hey, this is pretty much what I had in mind! Good catch with single string vs lists; I thought of just accepting both, but not all parameters can be specified once. I would however argue that we should not try to validate this in this module. It might even be possible to just have a
Yes I agree, for example mandatory things ( |
What abstraction do you have in mind? |
I think for a v3 I'd set up the following: Explicit variables for mandatory & positional parametersExamples: Explicit variables for "abstract" optionsThings like
|
Hello, I've cloned your role to make it work better for my usecase, and I am currently working on this feature. Here is the repo in case you want to have a look. I simplifies the template quite a bit in the process, tho I haven't tested it heavily yet to make sure it can handle all sorts of flags being passed. I can make a PR for it if you're interested. |
Context
This Ansible module uses its own parameters to support various
docker run
command line arguments.Out of those, multiple types are used:
Examples for single strings:
container_network
maps to--network
container_user
maps to--user
container_hostname
maps to--hostname
Examples for lists:
container_volumes
maps to--volume
container_ports
maps to--publish
container_hosts
maps to--add-host
This is great and marks explicitly how to use this module.
The big downside on this: You need to add additional support for each
docker run
command line argument into this module. And the docker run reference is looooong.One proposal would be to make this Ansible more flexible and avoid the burden of implementing every single
docker run
command line argument by offering ways to add arbitrarily--user
)--volume
)How a possible Ansible usage can look like in the future / Usage of the module:
The top-level keys under
container_single_args
andcontainer_multi_args
are not validated They can be defined to whatever you want.A few keys, like
container_image
might be good to keep separate, primarily when those are used in a different context (e.g., to craft the systems unit name).The same can be done for boolean flags via a list like
container_boolean_args
for keys like--rm
or--tty
:Open decisions
Additional notes
The text was updated successfully, but these errors were encountered: