diff options
Diffstat (limited to 'roles/docker')
-rw-r--r-- | roles/docker/tasks/main.yml | 9 | ||||
-rw-r--r-- | roles/docker/tasks/systemcontainer_docker.yml | 30 | ||||
-rw-r--r-- | roles/docker/templates/daemon.json | 12 | ||||
-rw-r--r-- | roles/docker/templates/systemcontainercustom.conf.j2 | 6 |
4 files changed, 34 insertions, 23 deletions
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index e60dbe2d6..0c2b16acf 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -5,12 +5,13 @@ - include: udev_workaround.yml when: docker_udev_workaround | default(False) | bool +- set_fact: + l_use_system_container: "{{ openshift.docker.use_system_container | default(False) }}" + - name: Use Package Docker if Requested include: package_docker.yml - when: openshift.docker.use_system_container is not defined or openshift.docker.use_system_container == False + when: not l_use_system_container - name: Use System Container Docker if Requested include: systemcontainer_docker.yml - when: - - openshift.docker.use_system_container is defined - - openshift.docker.use_system_container is True + when: l_use_system_container diff --git a/roles/docker/tasks/systemcontainer_docker.yml b/roles/docker/tasks/systemcontainer_docker.yml index 6db95bf12..722232a9b 100644 --- a/roles/docker/tasks/systemcontainer_docker.yml +++ b/roles/docker/tasks/systemcontainer_docker.yml @@ -53,29 +53,29 @@ - name: Set to default prepend set_fact: - l_docker_image_prepend: "gscrivano/" + l_docker_image_prepend: "gscrivano" - name: Use Red Hat Registry for image when distribution is Red Hat set_fact: - l_docker_image_prepend: "registry.access.redhat.com/openshift3/" + l_docker_image_prepend: "registry.access.redhat.com/openshift3" when: ansible_distribution == 'RedHat' - name: Use Fedora Registry for image when distribution is Fedora set_fact: - l_docker_image_prepend: "registry.fedoraproject.org/" + l_docker_image_prepend: "registry.fedoraproject.org" when: ansible_distribution == 'Fedora' # For https://github.com/openshift/openshift-ansible/pull/4049#discussion_r114478504 - name: Use a testing registry if requested set_fact: - l_docker_image_prepend: "{{ openshift.docker.systemcontainer_image_registry_override }}/" + l_docker_image_prepend: "{{ openshift_docker_systemcontainer_image_registry_override }}" when: - - openshift.docker.systemcontainer_image_registry_override is defined - - openshift.docker.systemcontainer_image_registry_override != "" + - openshift_docker_systemcontainer_image_registry_override is defined + - openshift_docker_systemcontainer_image_registry_override != "" - name: Set the full image name set_fact: - l_docker_image: "{{ l_docker_image_prepend }}container-engine-docker:latest" + l_docker_image: "{{ l_docker_image_prepend }}/{{ openshift.docker.service_name }}:latest" - name: Pre-pull Container Enginer System Container image command: "atomic pull --storage ostree {{ l_docker_image }}" @@ -103,21 +103,29 @@ - name: Install Container Enginer System Container oc_atomic_container: - name: container-engine-docker - image: "container-engine-docker" + name: "{{ openshift.docker.service_name }}" + image: "{{ l_docker_image }}" state: latest values: - - "system-package no" + - "system-package=no" - name: Configure Container Engine Service File template: dest: "{{ docker_systemd_dir }}/custom.conf" src: systemcontainercustom.conf.j2 +# Set local versions of facts that must be in json format for daemon.json +# NOTE: When jinja2.9+ is used the daemon.json file can move to using tojson +- set_fact: + l_docker_insecure_registries: "{{ docker_insecure_registries | default([]) | to_json }}" + l_docker_log_options: "{{ docker_log_options | default({}) | to_json }}" + l_docker_additional_registries: "{{ docker_additional_registries | default([]) | to_json }}" + l_docker_blocked_registries: "{{ docker_blocked_registries | default([]) | to_json }}" + # Configure container-engine using the daemon.json file - name: Configure Container Engine template: - dest: "{{ docker_conf }}/daemon.json" + dest: "{{ docker_conf_dir }}/daemon.json" src: daemon.json # Enable and start the container-engine service diff --git a/roles/docker/templates/daemon.json b/roles/docker/templates/daemon.json index bd085d2be..7ea8164b3 100644 --- a/roles/docker/templates/daemon.json +++ b/roles/docker/templates/daemon.json @@ -12,7 +12,7 @@ "default-gateway": "", "default-gateway-v6": "", "default-runtime": "oci", - "containerd": "/var/run/containerd.sock", + "containerd": "/run/containerd.sock", "default-ulimits": {}, "disable-legacy-registry": false, "dns": [], @@ -26,7 +26,7 @@ "group": "", "hosts": [], "icc": false, - "insecure-registries": {{ docker_insecure_registries|default([]) }}, + "insecure-registries": {{ l_docker_insecure_registries }}, "ip": "0.0.0.0", "iptables": false, "ipv6": false, @@ -34,9 +34,11 @@ "ip-masq": false, "labels": [], "live-restore": true, +{% if docker_log_driver is defined %} "log-driver": "{{ docker_log_driver }}", +{%- endif %} "log-level": "", - "log-opts": {{ docker_log_options|default({}) }}, + "log-opts": {{ l_docker_log_options }}, "max-concurrent-downloads": 3, "max-concurrent-uploads": 5, "mtu": 0, @@ -58,7 +60,7 @@ "tlskey": "", "tlsverify": true, "userns-remap": "", - "add-registry": {{ docker_additional_registries|default([]) }}, - "blocked-registries": {{ docker_blocked_registries|defaukt([]) }}, + "add-registry": {{ l_docker_additional_registries }}, + "blocked-registries": {{ l_docker_blocked_registries }}, "userland-proxy-path": "/usr/libexec/docker/docker-proxy-current" } diff --git a/roles/docker/templates/systemcontainercustom.conf.j2 b/roles/docker/templates/systemcontainercustom.conf.j2 index a2cfed8a9..a4fb01d2b 100644 --- a/roles/docker/templates/systemcontainercustom.conf.j2 +++ b/roles/docker/templates/systemcontainercustom.conf.j2 @@ -1,13 +1,13 @@ # {{ ansible_managed }} [Service] -{%- if docker_http_proxy %} +{%- if "http_proxy" in openshift.common %} ENVIRONMENT=HTTP_PROXY={{ docker_http_proxy }} {%- endif -%} -{%- if docker_https_proxy %} +{%- if "https_proxy" in openshift.common %} ENVIRONMENT=HTTPS_PROXY={{ docker_http_proxy }} {%- endif -%} -{%- if docker_no_proxy %} +{%- if "no_proxy" in openshift.common %} ENVIRONMENT=NO_PROXY={{ docker_no_proxy }} {%- endif %} {%- if os_firewall_use_firewalld|default(true) %} |