Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions roles/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ None.
| `docker_repo_key` | `str` | `False` | - | URL for the GPG key used to validate the Docker repository. If not specified, the value is taken from the role's default variables. |
| `docker_packages` | `list` of `str` | `False` | `["docker-ce", "docker-ce-cli", "docker-ce-rootless-extras", "containerd.io", "docker-buildx-plugin"]` | List of Docker packages to install. This allows customization of installed components. |
| `docker_users` | `list` of `str` | `False` | `[]` | List of usernames that should be added to the `docker` system group. These users will then be able to run Docker commands without `sudo`. |
| `docker_daemon_config` | `dict` | `False` | `{}` | Configuration options for the Docker daemon. |

# Example Playbook

Expand Down
2 changes: 2 additions & 0 deletions roles/docker/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ docker_packages:

# A list of users who will be added to the docker group.
docker_users: []

docker_daemon_config: {}
4 changes: 4 additions & 0 deletions roles/docker/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ argument_specs:
type: list
elements: str
default: []
docker_daemon_config:
description: Configuration options for the Docker daemon
type: dict
default: {}
10 changes: 10 additions & 0 deletions roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,13 @@
loop_control:
loop_var: docker_user
loop: "{{ docker_users }}"

- name: Create /etc/docker/daemon.json from YAML variable
when: docker_daemon_config is defined and docker_daemon_config | length > 0
ansible.builtin.copy:
content: "{{ docker_daemon_config | to_nice_json }}"
dest: "/etc/docker/daemon.json"
owner: root
group: docker
mode: '0644'
notify: Restart Docker
Loading