Browse Source

Fix 1448368, and some other minors issues

Gan Huang 8 years ago
parent
commit
e360372dca

+ 5 - 4
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

+ 11 - 11
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,11 +103,11 @@
 
 - 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:
@@ -117,7 +117,7 @@
 # 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

+ 3 - 1
roles/docker/templates/daemon.json

@@ -34,7 +34,9 @@
     "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({}) }},
     "max-concurrent-downloads": 3,
@@ -59,6 +61,6 @@
     "tlsverify": true,
     "userns-remap": "",
     "add-registry": {{  docker_additional_registries|default([]) }},
-    "blocked-registries": {{ docker_blocked_registries|defaukt([]) }},
+    "blocked-registries": {{ docker_blocked_registries|default([]) }},
     "userland-proxy-path": "/usr/libexec/docker/docker-proxy-current"
 }

+ 3 - 3
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) %}

+ 1 - 0
roles/openshift_docker_facts/tasks/main.yml

@@ -16,6 +16,7 @@
       disable_push_dockerhub: "{{ openshift_disable_push_dockerhub | default(None) }}"
       hosted_registry_insecure: "{{ openshift_docker_hosted_registry_insecure | default(openshift.docker.hosted_registry_insecure | default(False)) }}"
       hosted_registry_network: "{{ openshift_docker_hosted_registry_network | default(None) }}"
+      use_system_container: "{{ openshift_docker_use_system_container | default(False) }}"
 
 - set_fact:
     docker_additional_registries: "{{ openshift.docker.additional_registries

+ 4 - 5
roles/openshift_facts/library/openshift_facts.py

@@ -59,8 +59,7 @@ def migrate_docker_facts(facts):
             'additional_registries',
             'insecure_registries',
             'blocked_registries',
-            'options',
-            'use_system_container',
+            'options'
         ),
         'node': (
             'log_driver',
@@ -1795,9 +1794,9 @@ def set_container_facts_if_unset(facts):
     facts['common']['is_atomic'] = os.path.isfile('/run/ostree-booted')
     # If openshift_docker_use_system_container is set and is True ....
     if 'use_system_container' in list(facts['docker'].keys()):
-        if facts['docker']['use_system_container'] is True:
-            # ... set the service name to container-engine-docker
-            facts['docker']['service_name'] = 'container-engine-docker'
+        if facts['docker']['use_system_container']:
+            # ... set the service name to container-engine
+            facts['docker']['service_name'] = 'container-engine'
 
     if 'is_containerized' not in facts['common']:
         facts['common']['is_containerized'] = facts['common']['is_atomic']