Browse Source

Bugfix for extra --add-registry in docker config

Jason DeTiberus 9 years ago
parent
commit
886fab0967
1 changed files with 13 additions and 11 deletions
  1. 13 11
      roles/openshift_node/tasks/main.yml

+ 13 - 11
roles/openshift_node/tasks/main.yml

@@ -66,7 +66,7 @@
 - name: Secure OpenShift Registry
   lineinfile:
     dest: /etc/sysconfig/docker
-    regexp: '^OPTIONS=.*'
+    regexp: '^OPTIONS=.*$'
     line: "OPTIONS='--insecure-registry={{ openshift.node.portal_net }} \
 {% if ansible_selinux and ansible_selinux.status == '''enabled''' %}--selinux-enabled{% endif %}'"
   when: docker_check.stat.isreg
@@ -74,27 +74,29 @@
     - restart docker
 
 - set_fact:
-    docker_additional_registries: "registry.access.redhat.com,{{ lookup('oo_option', 'docker_additional_registries') }}"
-  when: deployment_type == 'enterprise'
+    docker_additional_registries: "{{ lookup('oo_option', 'docker_additional_registries')
+                                      | oo_split() | union(['registry.access.redhat.com'])
+                                      | difference(['']) }}"
+  when: openshift.common.deployment_type == 'enterprise'
 - set_fact:
-    docker_additional_registries: "{{ lookup('oo_option', 'docker_additional_registries') }}"
-  when: deployment_type != 'enterprise'
+    docker_additional_registries: "{{ lookup('oo_option', 'docker_additional_registries')
+                                      | oo_split() | difference(['']) }}"
+  when: openshift.common.deployment_type != 'enterprise'
 
 - name: Add personal registries
   lineinfile:
     dest: /etc/sysconfig/docker
-    regexp: '^ADD_REGISTRY=.*'
-    line: "ADD_REGISTRY='{{ docker_additional_registries | oo_split()
-                              | oo_prepend_strings_in_list('--add-registry ') | join(' ') }}'"
-  when: docker_check.stat.isreg and
-        docker_additional_registries != ''
+    regexp: '^ADD_REGISTRY=.*$'
+    line: "ADD_REGISTRY='{{ docker_additional_registries
+                            | oo_prepend_strings_in_list('--add-registry ') | join(' ') }}'"
+  when: docker_check.stat.isreg and docker_additional_registries
   notify:
     - restart docker
 
 - name: Block registries
   lineinfile:
     dest: /etc/sysconfig/docker
-    regexp: '^BLOCK_REGISTRY=.*'
+    regexp: '^BLOCK_REGISTRY=.*$'
     line: "BLOCK_REGISTRY='{{ lookup('oo_option', 'docker_blocked_registries') | oo_split()
                               | oo_prepend_strings_in_list('--block-registry ') | join(' ') }}'"
   when: docker_check.stat.isreg and