]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
facts: isolate container_binary facts
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 26 Nov 2019 15:10:17 +0000 (16:10 +0100)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Tue, 3 Dec 2019 14:57:11 +0000 (09:57 -0500)
in order to be able to call container_binary without having to run the
whole ceph-facts role.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit fe5ffe589e3cf19d1b03d73f3e2867a870c86192)

infrastructure-playbooks/purge-docker-cluster.yml
roles/ceph-facts/tasks/container_binary.yml [new file with mode: 0644]
roles/ceph-facts/tasks/facts.yml

index bef5da01c2be257ff126eae52deab2792c646932..21d6d9112f795ec0c6c5e836d56c44e1c81ed184 100644 (file)
   become: true
 
   tasks:
-    - name: set ceph_docker_registry value if not set
-      set_fact:
-        ceph_docker_registry: "docker.io"
-      when: ceph_docker_registry is not defined
+    - import_role:
+        name: ceph-defaults
+    - import_role:
+        name: ceph-facts
+        tasks_from: container_binary
 
     - name: disable node_exporter service
       service:
       - alertmanager
 
   tasks:
-    - name: set ceph_docker_registry value if not set
-      set_fact:
-        ceph_docker_registry: "docker.io"
-      when: ceph_docker_registry is not defined
+    - import_role:
+        name: ceph-defaults
+    - import_role:
+        name: ceph-facts
+        tasks_from: container_binary
 
     - name: stop services
       service:
   tasks:
     - import_role:
         name: ceph-defaults
-    - import_role:
-        name: ceph-facts
 
     - name: check if it is Atomic host
       stat: path=/run/ostree-booted
       set_fact:
         is_atomic: "{{ stat_ostree.stat.exists }}"
 
+    - import_role:
+        name: ceph-facts
+        tasks_from: container_binary
+
     - name: remove ceph container image
       command: "{{ container_binary }} rmi {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
       tags:
diff --git a/roles/ceph-facts/tasks/container_binary.yml b/roles/ceph-facts/tasks/container_binary.yml
new file mode 100644 (file)
index 0000000..8e866bc
--- /dev/null
@@ -0,0 +1,9 @@
+---
+- name: check if podman binary is present
+  stat:
+    path: /usr/bin/podman
+  register: podman_binary
+
+- name: set_fact container_binary
+  set_fact:
+    container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_distribution == 'Fedora') or (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8') else 'docker' }}"
\ No newline at end of file
index 6020ce1d519dd31b1fd0dacb146a94af889afda8..789ecd635be32c18f0715bbf4ada31fe0d8a3444 100644 (file)
@@ -8,19 +8,13 @@
   set_fact:
     is_atomic: "{{ stat_ostree.stat.exists }}"
 
-- name: check if podman binary is present
-  stat:
-    path: /usr/bin/podman
-  register: podman_binary
+- name: import_tasks container_binary.yml
+  import_tasks: container_binary.yml
 
 - name: set_fact is_podman
   set_fact:
     is_podman: "{{ podman_binary.stat.exists }}"
 
-- name: set_fact container_binary
-  set_fact:
-    container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_distribution == 'Fedora') or (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8') else 'docker' }}"
-
 # In case ansible_python_interpreter is set by the user,
 # ansible will not discover python and discovered_interpreter_python
 # will not be set