From ea0e409b51deb6a217ba5d4576ed80ae9859650f Mon Sep 17 00:00:00 2001 From: "Alistair A. Israel" Date: Tue, 14 Apr 2015 14:30:32 +0800 Subject: [PATCH 1/2] Added `when: restapi` --- roles/ceph-restapi/tasks/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/ceph-restapi/tasks/main.yml b/roles/ceph-restapi/tasks/main.yml index 5bf69816f..01820fa7f 100644 --- a/roles/ceph-restapi/tasks/main.yml +++ b/roles/ceph-restapi/tasks/main.yml @@ -1,12 +1,14 @@ --- - include: pre_requisite.yml + when: restapi - name: Check if Ceph REST API is already started shell: "ps aux|grep [c]eph-rest-api" register: restapi_status + when: restapi ignore_errors: True - name: Start Ceph REST API shell: "nohup ceph-rest-api &" - when: restapi_status.rc != 0 + when: restapi and restapi_status.rc != 0 changed_when: False From 40e6dd8e4f5222ad9b2164e35bc69340c8908301 Mon Sep 17 00:00:00 2001 From: "Alistair A. Israel" Date: Tue, 14 Apr 2015 17:40:58 +0800 Subject: [PATCH 2/2] Place "when: restapi" in site.yml --- roles/ceph-restapi/tasks/main.yml | 4 +--- site.yml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/roles/ceph-restapi/tasks/main.yml b/roles/ceph-restapi/tasks/main.yml index 01820fa7f..5bf69816f 100644 --- a/roles/ceph-restapi/tasks/main.yml +++ b/roles/ceph-restapi/tasks/main.yml @@ -1,14 +1,12 @@ --- - include: pre_requisite.yml - when: restapi - name: Check if Ceph REST API is already started shell: "ps aux|grep [c]eph-rest-api" register: restapi_status - when: restapi ignore_errors: True - name: Start Ceph REST API shell: "nohup ceph-rest-api &" - when: restapi and restapi_status.rc != 0 + when: restapi_status.rc != 0 changed_when: False diff --git a/site.yml b/site.yml index e7d10b0d7..72704be59 100644 --- a/site.yml +++ b/site.yml @@ -14,7 +14,7 @@ sudo: True roles: - ceph-mon - - ceph-restapi + - { role: ceph-restapi, when: restapi } - hosts: osds sudo: True