diff --git a/roles/docker/handlers/main.yml b/roles/docker/handlers/main.yml new file mode 100644 index 000000000..4c92b0395 --- /dev/null +++ b/roles/docker/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: restart docker + ansible.builtin.systemd: + name: docker + state: restarted diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 8baed5516..493d1c6d9 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -1,8 +1,10 @@ --- -- include_tasks: setup-rocky.yml +- name: Include Rocky specific tasks + ansible.builtin.include_tasks: setup-rocky.yml when: ansible_os_family == 'RedHat' -- include_tasks: setup-debian.yml +- name: Include Debian specific tasks + ansible.builtin.include_tasks: setup-debian.yml when: ansible_os_family == 'Debian' - name: Install docker @@ -10,6 +12,15 @@ name: docker-ce state: present +- name: Install docker config file + ansible.builtin.template: + src: daemon.json.j2 + dest: /etc/docker/daemon.json + owner: root + group: root + mode: "0744" + notify: "restart docker" + - name: Start and enable the docker daemon ansible.builtin.systemd: name: docker diff --git a/roles/docker/templates/daemon.json.j2 b/roles/docker/templates/daemon.json.j2 new file mode 100644 index 000000000..469cfe4fc --- /dev/null +++ b/roles/docker/templates/daemon.json.j2 @@ -0,0 +1,7 @@ +{ + "live-restore": true, + "log-driver": "journald", + "log-opts" : { + "tag" : "{{ '{{' }}.Name{{ '}}' }}" + } +}