Skip to content

Commit

Permalink
Merge pull request #39 from andygrunwald/container_cmd_list
Browse files Browse the repository at this point in the history
container_cmd: Switch from string to list to support long cmds in a more readable way
  • Loading branch information
mhutter authored Mar 22, 2022
2 parents be61d93 + 18280f6 commit 3b8da4b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ This will create:

* `container_image` (**required**) - Docker image the service uses
* `container_args` - arbitrary list of arguments to the `docker run` command as a string
* `container_cmd` - optional command to the container run command (the part after the
image name)
* `container_cmd` (default: _[]_) - optional list of commands to the container run command (the part after the image name)
* `container_env` - key/value pairs of ENV vars that need to be present
* `container_volumes` (default: _[]_) - List of `-v` arguments
* `container_host_network` (default: _false_) - Whether the host network should be used
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
container_name: "{{ name }}"
container_docker_pull: true
container_labels: []
container_cmd: []
container_host_network: false
container_network: ""
container_links: []
Expand Down
2 changes: 1 addition & 1 deletion templates/unit.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ExecStart={{ docker_path }} run \
{{ params('--device', container_devices) }}\
{% if container_privileged == true %}--privileged{% endif %}\
{{ container_args | trim }} \
{{ container_image }} {{ container_cmd | default('') | trim }}
{{ container_image }} {% if container_cmd is string %}{{ container_cmd | trim }}{% else %}{{ container_cmd | join(' ') | trim }}{% endif %}
{% endif %}
{% if not 'ExecStop' in service_systemd_options_keys %}
ExecStop={{ docker_path }} stop {{ container_name }}
Expand Down

0 comments on commit 3b8da4b

Please sign in to comment.