diff --git a/ansible/plays/common.yaml b/ansible/plays/common.yaml index a588ef0..7dfa617 100644 --- a/ansible/plays/common.yaml +++ b/ansible/plays/common.yaml @@ -202,6 +202,11 @@ become: true become_user: root tasks: + - ansible.builtin.file: + path: /etc/docker + owner: root + state: directory + mode: '0700' - name: Template Config ansible.builtin.template: src: "docker-daemon.json.j2" @@ -210,17 +215,23 @@ group: root mode: '0600' notify: Restart Docker - - name: Setup default ulimts + - name: Check if sysconfig exists + ansible.builtin.stat: + path: /etc/sysconfig/docker + register: sysconfig + - name: Remove ulimits from sysconfig ansible.builtin.lineinfile: path: /etc/sysconfig/docker search_string: '--default-ulimit nofile=' - line: ' --default-ulimit nofile=4096:4096 \' + state: absent + when: sysconfig.stat.exists notify: Restart Docker - name: Remove log-driver from sysconfig ansible.builtin.lineinfile: path: /etc/sysconfig/docker search_string: '--log-driver=' state: absent + when: sysconfig.stat.exists notify: Restart Docker - name: Restart Docker if necessary meta: flush_handlers diff --git a/ansible/plays/templates/docker-daemon.json.j2 b/ansible/plays/templates/docker-daemon.json.j2 index e6ed031..c5c0378 100644 --- a/ansible/plays/templates/docker-daemon.json.j2 +++ b/ansible/plays/templates/docker-daemon.json.j2 @@ -10,6 +10,13 @@ { "base":"10.254.0.0/17","size":26 }, { "base": "fd64:2::/104", "size": 112 } ], + "default-ulimits": { + "nofile": { + "Name": "nofile", + "Hard": 65535, + "Soft": 65535 + } + }, "experimental": true, "ipv6": true, "fixed-cidr-v6": "fd64:1::/64",