Added capabilty to configure docker/containerd root path

This commit is contained in:
Bill Metangmo 2020-11-17 18:07:33 +01:00
parent e5adc9a528
commit d5e959d15c
4 changed files with 57 additions and 0 deletions

View File

@ -29,3 +29,9 @@ docker_yum_gpg_key: https://download.docker.com/linux/centos/gpg
# A list of users who will be added to the docker group.
docker_users: []
# configuration
docker_default_config: true
docker_root_path: ""
containerd_root_path: ""
docker_native_cgroup: ""

View File

@ -25,3 +25,19 @@
- include_tasks: docker-users.yml
when: docker_users | length > 0
- name: Configure docker
template:
src: daemon.json.j2
dest: /etc/docker/daemon.json
mode: 0666
notify: restart docker
when: not docker_default_config
- name: Configure containerd
template:
src: config.toml.j2
dest: /etc/containerd/config.toml
mode: 0666
notify: restart docker
when: not docker_default_config

31
templates/config.toml.j2 Normal file
View File

@ -0,0 +1,31 @@
# Copyright 2018-2020 Docker Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
disabled_plugins = ["cri"]
root = "{{ containerd_root_path }}"
#state = "/run/containerd"
#subreaper = true
#oom_score = 0
#[grpc]
# address = "/run/containerd/containerd.sock"
# uid = 0
# gid = 0
#[debug]
# address = "/run/containerd/debug.sock"
# uid = 0
# gid = 0
# level = "info"

4
templates/daemon.json.j2 Normal file
View File

@ -0,0 +1,4 @@
{
"data-root": "{{docker_root_path}}",
"exec-opts": ["native.cgroupdriver={{docker_native_cgroup}}"]
}