]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
run rados cmd in container if containerized deployment
authorTom Barron <tpb@dyncloud.net>
Sat, 1 Sep 2018 14:32:51 +0000 (10:32 -0400)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Mon, 3 Sep 2018 17:06:00 +0000 (17:06 +0000)
When ceph-nfs is deployed containerized and ceph-common is not
installed on the host the start_nfs task fails because the rados
command is missing on the host.

Run rados commands from a ceph container instead so that
they will succeed.

Signed-off-by: Tom Barron <tpb@dyncloud.net>
roles/ceph-nfs/tasks/start_nfs.yml

index ab12a93dc5f52d433ebb0661fe303728a37b26a0..53850bb0e5f5a0e9ff7945709a7219ef22840f5e 100644 (file)
@@ -1,15 +1,23 @@
 ---
+- name: set_fact docker_exec_cmd_nfs
+  set_fact:
+    docker_exec_cmd_nfs: "docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
+  when:
+    - containerized_deployment
+
 - name: check if rados index object exists
-  shell: "rados -p {{ cephfs_data }} --cluster {{ cluster }} ls|grep {{ ceph_nfs_rados_export_index }}"
+  shell: "{{ docker_exec_cmd_nfs | default('') }} rados -p {{ cephfs_data }} --cluster {{ cluster }} ls|grep {{ ceph_nfs_rados_export_index }}"
   changed_when: false
   failed_when: false
   register: rados_index_exists
   check_mode: no
   when:
     - ceph_nfs_rados_backend
+  delegate_to: "{{ groups[mon_group_name][0] }}"
+  run_once: true
 
 - name: create an empty rados index object
-  shell: "echo | rados -p {{ cephfs_data }} --cluster {{ cluster }} put {{ ceph_nfs_rados_export_index }} -"
+  shell: "{{ docker_exec_cmd_nfs | default('') }} rados -p {{ cephfs_data }} --cluster {{ cluster }} put {{ ceph_nfs_rados_export_index }} /dev/null"
   when:
     - ceph_nfs_rados_backend
     - rados_index_exists.rc != 0