Browse Source

Prepull etcd image

Vadim Rutkovsky 6 years ago
parent
commit
cc5c6c3518
2 changed files with 23 additions and 0 deletions
  1. 15 0
      roles/etcd/tasks/static.yml
  2. 8 0
      roles/openshift_control_plane/tasks/main.yml

+ 15 - 0
roles/etcd/tasks/static.yml

@@ -2,6 +2,21 @@
 # Set some facts to reference from hostvars
 - import_tasks: set_facts.yml
 
+- name: Check that etcd image is present
+  command: 'docker images -q "{{ etcd_image }}"'
+  register: etcd_image_exists
+
+- name: Pre-pull etcd image
+  docker_image:
+    name: "{{ etcd_image }}"
+  environment:
+    NO_PROXY: "{{ openshift.common.no_proxy | default('') }}"
+  when: etcd_image_exists.stdout_lines == []
+  # 10 minutes to pull the image
+  async: 600
+  poll: 0
+  register: etcd_prepull
+
 - name: setup firewall
   import_tasks: firewall.yml
 

+ 8 - 0
roles/openshift_control_plane/tasks/main.yml

@@ -153,6 +153,14 @@
   when: control_plane_image.stdout_lines == []
   retries: 30
 
+- name: Check status of etcd image pre-pull
+  async_status:
+    jid: "{{ etcd_prepull.ansible_job_id }}"
+  register: job_result
+  until: job_result.finished
+  when: etcd_image_exists.stdout_lines == []
+  retries: 30
+
 - name: Start and enable self-hosting node
   systemd:
     name: "{{ openshift_service_type }}-node"