mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-03-12 08:28:44 +00:00
Remove /etc/docker/daemon.json
when no Docker options are set anymore
This commit is contained in:
parent
5aa8bf9c3d
commit
bd073bca74
@ -21,6 +21,8 @@ matrix_playbook_docker_installation_enabled: true
|
||||
|
||||
matrix_playbook_docker_installation_daemon_options: "{{ matrix_playbook_docker_installation_daemon_options_auto | combine(matrix_playbook_docker_installation_daemon_options_custom, recursive=True) }}"
|
||||
|
||||
matrix_playbook_docker_installation_daemon_options_file_path: /etc/docker/daemon.json
|
||||
|
||||
# Since Docker 27.0.1, Docker daemon options do not need to be changed to enable IPv6 support on the daemon side.
|
||||
# See: https://docs.docker.com/engine/release-notes/27/#ipv6
|
||||
# We only enable `ip6tables` and `experimental` for people who explicitly request it (perhaps due to running an old Docker version).
|
||||
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
|
||||
# ansible-role-docker creates the Docker daemon options file (`/etc/docker/daemon.json`) when options are set
|
||||
# via `matrix_playbook_docker_installation_daemon_options` (which influences the `docker_daemon_options` variable of the role).
|
||||
# See: https://github.com/geerlingguy/ansible-role-docker/blob/acade8d01f11bcd5efecba6d8211138d7567ce4b/tasks/main.yml#L53-L66
|
||||
#
|
||||
# However, it doesn't delete the file when the options list is empty.
|
||||
#
|
||||
# This means that people who previously force-disabled IPv6 (and injected `{'ipv6': false}` options, etc)
|
||||
# or had some other custom options had that file created for them.
|
||||
# Later, when they stopped setting these options, they were stuck with the configuration file that still retained them.
|
||||
#
|
||||
# Here, we make the file go away of no options are set.
|
||||
# Idealy, this task would be part of the `ansible-role-docker` role, but it's not (yet).
|
||||
- name: Ensure the Docker daemon options file is deleted when no longer needed
|
||||
when: matrix_playbook_docker_installation_daemon_options.keys() | length == 0
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_playbook_docker_installation_daemon_options_file_path }}"
|
||||
state: absent
|
||||
notify: restart docker
|
@ -28,6 +28,15 @@
|
||||
block:
|
||||
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/debian_docker_trusted_gpg_d_migration_migration.yml"
|
||||
|
||||
- when: matrix_playbook_docker_installation_enabled | bool
|
||||
tags:
|
||||
- setup-all
|
||||
- install-all
|
||||
- setup-docker
|
||||
- install-docker
|
||||
block:
|
||||
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/docker_daemon_options_file_cleanup.yml"
|
||||
|
||||
- tags:
|
||||
- setup-all
|
||||
- install-all
|
||||
|
Loading…
Reference in New Issue
Block a user