Skip to content

Commit

Permalink
Docker: Add docker daemon.json config file
Browse files Browse the repository at this point in the history
  • Loading branch information
quartje committed Nov 23, 2023
1 parent 4947136 commit 1a74d9c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions roles/docker/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: restart docker
ansible.builtin.systemd:
name: docker
state: restarted
15 changes: 13 additions & 2 deletions roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
---
- 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
ansible.builtin.package:
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
Expand Down
7 changes: 7 additions & 0 deletions roles/docker/templates/daemon.json.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"live-restore": true,
"log-driver": "journald",
"log-opts" : {
"tag" : "{{ '{{' }}.Name{{ '}}' }}"
}
}

0 comments on commit 1a74d9c

Please sign in to comment.