From b34a04ea41f622f636e3cf7cdcd4d0ffa187373d Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Thu, 28 Sep 2017 00:11:53 +0200 Subject: [PATCH] site-docker.yml try to fetch images in // MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The container deployment is serialized, adding this task as a best effort. If docker is already present we pull the image otherwise we wait for the role to play. Signed-off-by: Sébastien Han --- roles/ceph-docker-common/tasks/main.yml | 4 +++ site-docker.yml.sample | 34 ++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/roles/ceph-docker-common/tasks/main.yml b/roles/ceph-docker-common/tasks/main.yml index 48fc3a56c..20e7d0ea6 100644 --- a/roles/ceph-docker-common/tasks/main.yml +++ b/roles/ceph-docker-common/tasks/main.yml @@ -12,6 +12,8 @@ - name: set_fact is_atomic set_fact: is_atomic: '{{ stat_ostree.stat.exists }}' + tags: + - always - name: include pre_requisites/prerequisites.yml include: pre_requisites/prerequisites.yml @@ -88,6 +90,8 @@ - name: include fetch_image.yml include: fetch_image.yml + tags: + - fetch_container_image - name: get ceph version command: docker run --entrypoint /usr/bin/ceph {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} --version diff --git a/site-docker.yml.sample b/site-docker.yml.sample index 2a9b12cc3..548ea20a1 100644 --- a/site-docker.yml.sample +++ b/site-docker.yml.sample @@ -13,16 +13,44 @@ - clients - iscsigws - mgrs - gather_facts: false - - tasks: + become: True + pre_tasks: - name: gather and delegate facts setup: delegate_to: "{{ item }}" delegate_facts: True with_items: "{{ groups['all'] }}" + - name: check if it is atomic host + stat: + path: /run/ostree-booted + register: stat_ostree + tags: + - always + + - name: set_fact is_atomic + set_fact: + atomic: '{{ stat_ostree.stat.exists }}' + tags: + - always + + roles: + - { role: ceph-defaults, + tags: [with_pkg, fetch_container_image], + when: "(containerized_deployment | bool) and not (atomic | bool)" } + - { role: ceph-docker-common, + tags: [with_pkg, fetch_container_image], + when: "(containerized_deployment | bool) and not (atomic | bool)" } + + post_tasks: + - name: "pull {{ ceph_docker_image }} image" + command: "docker pull {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" + changed_when: false + when: + - atomic + - (ceph_docker_dev_image is undefined or not ceph_docker_dev_image) + - hosts: mons become: True gather_facts: false -- 2.39.5