mirror of
https://github.com/geerlingguy/ansible-role-docker.git
synced 2024-11-18 19:10:43 +01:00
Merge pull request #256 from Zempashi/issue-90
Ability to configure Docker daemon options
This commit is contained in:
commit
7afdc965a1
@ -60,6 +60,13 @@ Usually in combination with changing `docker_yum_repository` as well.
|
|||||||
|
|
||||||
A list of system users to be added to the `docker` group (so they can use Docker on the server).
|
A list of system users to be added to the `docker` group (so they can use Docker on the server).
|
||||||
|
|
||||||
|
docker_daemon_options:
|
||||||
|
storage-driver: "devicemapper"
|
||||||
|
log-opts:
|
||||||
|
max-size: "100m"
|
||||||
|
|
||||||
|
Custom `dockerd` options can be configured through this dictionary representing the json file `/etc/docker/daemon.json`.
|
||||||
|
|
||||||
## Use with Ansible (and `docker` Python library)
|
## Use with Ansible (and `docker` Python library)
|
||||||
|
|
||||||
Many users of this role wish to also use Ansible to then _build_ Docker images and manage Docker containers on the server where Docker is installed. In this case, you can easily add in the `docker` Python library using the `geerlingguy.pip` role:
|
Many users of this role wish to also use Ansible to then _build_ Docker images and manage Docker containers on the server where Docker is installed. In this case, you can easily add in the `docker` Python library using the `geerlingguy.pip` role:
|
||||||
|
@ -31,3 +31,6 @@ docker_yum_gpg_key: "{{ docker_repo_url }}/centos/gpg"
|
|||||||
|
|
||||||
# A list of users who will be added to the docker group.
|
# A list of users who will be added to the docker group.
|
||||||
docker_users: []
|
docker_users: []
|
||||||
|
|
||||||
|
# Docker daemon options as a dict
|
||||||
|
docker_daemon_options: {}
|
||||||
|
@ -12,6 +12,21 @@
|
|||||||
notify: restart docker
|
notify: restart docker
|
||||||
ignore_errors: "{{ ansible_check_mode }}"
|
ignore_errors: "{{ ansible_check_mode }}"
|
||||||
|
|
||||||
|
- name: Ensure /etc/docker/ directory exists.
|
||||||
|
file:
|
||||||
|
path: /etc/docker
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
when: docker_daemon_options.keys() | length > 0
|
||||||
|
|
||||||
|
- name: Configure Docker daemon options.
|
||||||
|
copy:
|
||||||
|
content: "{{ docker_daemon_options | to_nice_json }}"
|
||||||
|
dest: /etc/docker/daemon.json
|
||||||
|
mode: 0644
|
||||||
|
when: docker_daemon_options.keys() | length > 0
|
||||||
|
notify: restart docker
|
||||||
|
|
||||||
- name: Ensure Docker is started and enabled at boot.
|
- name: Ensure Docker is started and enabled at boot.
|
||||||
service:
|
service:
|
||||||
name: docker
|
name: docker
|
||||||
|
Loading…
Reference in New Issue
Block a user