]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
common: use discovered_interpreter_python fact
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 14 Aug 2019 07:56:41 +0000 (09:56 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 14 Aug 2019 14:42:02 +0000 (16:42 +0200)
in order to use the right binary name when using python cli in command
or shell module.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
infrastructure-playbooks/shrink-mon.yml
roles/ceph-facts/tasks/facts.yml
roles/ceph-handler/templates/restart_mon_daemon.sh.j2
roles/ceph-handler/templates/restart_osd_daemon.sh.j2
roles/ceph-mon/tasks/deploy_monitors.yml
roles/ceph-osd/tasks/openstack_config.yml

index e0101c39ef81e5fd3bde2c9c4417341fd8ffcf38..c5759a2807b6ccc109a431a9b0e24e9917373c62 100644 (file)
     # 'sleep 5' is not that bad and should be sufficient
     - name: verify the monitor is out of the cluster
       shell: |
-        {{ container_exec_cmd }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["quorum_names"])'
+        {{ container_exec_cmd }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python }} -c 'import sys, json; print(json.load(sys.stdin)["quorum_names"])'
       delegate_to: "{{ mon_host }}"
       failed_when: false
       register: result
index bd86a98b269039d1a313d1913272c401f67e2e35..8cb8dab912816a910750ee0943d1e49e35b67a6b 100644 (file)
     - not rolling_update | bool
   block:
   - name: generate cluster fsid
-    shell: python -c 'import uuid; print(str(uuid.uuid4()))'
+    shell: "{{ discovered_interpreter_python }} -c 'import uuid; print(str(uuid.uuid4()))'"
     register: cluster_uuid
     delegate_to: "{{ groups[mon_group_name][0] }}"
     run_once: true
index 301cb10a38677d3a761215d6f2a402d4864c5af1..e8344cbef29d19f3a65719440be5a780da2b23cb 100644 (file)
@@ -19,7 +19,7 @@ $DOCKER_EXEC test -S /var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok
 
 check_quorum() {
 while [ $RETRIES -ne 0 ]; do
-  $DOCKER_EXEC ceph --cluster {{ cluster }} -s --format json | python -c 'import sys, json; exit(0) if "{{ monitor_name }}" in json.load(sys.stdin)["quorum_names"] else exit(1)' && exit 0
+  $DOCKER_EXEC ceph --cluster {{ cluster }} -s --format json | "{{ discovered_interpreter_python }}" -c 'import sys, json; exit(0) if "{{ monitor_name }}" in json.load(sys.stdin)["quorum_names"] else exit(1)' && exit 0
   sleep $DELAY
   let RETRIES=RETRIES-1
 done
index 3e5b79daa3f53dffd15eef31461c0ae50f3a159d..31de8864017afb7f478f62778ec59cec39b80182 100644 (file)
@@ -4,12 +4,12 @@ DELAY="{{ handler_health_osd_check_delay }}"
 CEPH_CLI="--name client.bootstrap-osd --keyring /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring --cluster {{ cluster }}"
 
 check_pgs() {
-  num_pgs=$($container_exec ceph $CEPH_CLI -s -f json|python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')
+  num_pgs=$($container_exec ceph $CEPH_CLI -s -f json | "{{ discovered_interpreter_python }}" -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')
   if [[ "$num_pgs" == "0" ]]; then
     return 0
   fi
   while [ $RETRIES -ne 0 ]; do
-    test "$($container_exec ceph $CEPH_CLI -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')" -eq "$($container_exec ceph $CEPH_CLI -s -f json | python -c 'import sys, json; print(sum ( [ i["count"] for i in json.load(sys.stdin)["pgmap"]["pgs_by_state"] if "active+clean" in i["state_name"]]))')"
+    test "$($container_exec ceph $CEPH_CLI -s -f json | "{{ discovered_interpreter_python }}" -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')" -eq "$($container_exec ceph $CEPH_CLI -s -f json | "{{ discovered_interpreter_python }}" -c 'import sys, json; print(sum ( [ i["count"] for i in json.load(sys.stdin)["pgmap"]["pgs_by_state"] if "active+clean" in i["state_name"]]))')"
     RET=$?
     test $RET -eq 0 && return 0
     sleep $DELAY
index d1a7ba2bf3bc675e8f088059240b7ed21a352d9b..cf83466668e49399b330799528f6e6c0bf2846a5 100644 (file)
@@ -11,7 +11,7 @@
 
 - name: generate monitor initial keyring
   shell: >
-    python -c "import os ; import struct ;
+    {{ discovered_interpreter_python }} -c "import os ; import struct ;
     import time; import base64 ; key = os.urandom(16) ;
     header = struct.pack('<hiih',1,int(time.time()),0,len(key)) ;
     print(base64.b64encode(header + key).decode())"
index ad9a67e58fa8d9df5059f998bd70a54e2205c74c..f82fd9bafc14cc0b9903c4bf8f7cfc5dc7cc859a 100644 (file)
@@ -1,9 +1,9 @@
 ---
 - name: wait for all osd to be up
   shell: >
-    test "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["num_osds"])')" -gt 0 &&
-    test "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["num_osds"])')" =
-    "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["num_up_osds"])')"
+    test "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python }} -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["num_osds"])')" -gt 0 &&
+    test "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["num_osds"])')" =
+    "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python }} -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["num_up_osds"])')"
   register: wait_for_all_osds_up
   retries: "{{ nb_retry_wait_osd_up }}"
   delay: "{{ delay_wait_osd_up }}"