From 95ca89695c66c16918e379aa261428cd3f8c07b6 Mon Sep 17 00:00:00 2001 From: Yin Jifeng Date: Thu, 16 Apr 2015 15:09:55 +0800 Subject: [PATCH] use yum to install ceph noarch package command + creates prevent the package to be upgraded. rpm returns 0 when install success, and 1 (Error: Nothing to do) when reinstall the same package --- roles/ceph-common/tasks/install_on_redhat.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/ceph-common/tasks/install_on_redhat.yml b/roles/ceph-common/tasks/install_on_redhat.yml index 8a66e537f..0ce10dfeb 100644 --- a/roles/ceph-common/tasks/install_on_redhat.yml +++ b/roles/ceph-common/tasks/install_on_redhat.yml @@ -29,18 +29,18 @@ when: ceph_stable_ice - name: Add Ceph stable repository - command: > - rpm -U http://ceph.com/rpm-{{ ceph_stable_release }}/{{ ceph_stable_redhat_distro }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro|replace('rhel', 'el') }}.noarch.rpm - creates=/etc/yum.repos.d/ceph.repo + yum: name=http://ceph.com/rpm-{{ ceph_stable_release }}/{{ ceph_stable_redhat_distro }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro|replace('rhel', 'el') }}.noarch.rpm + register: repo_result when: ceph_stable - changed_when: False + failed_when: repo_result.rc > 1 + changed_when: repo_result.rc == 0 - name: Add Ceph development repository - command: > - rpm -U http://gitbuilder.ceph.com/ceph-rpm-{{ ceph_dev_redhat_distro }}-x86_64-basic/ref/{{ ceph_dev_branch }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro }}.noarch.rpm - creates=/etc/yum.repos.d/ceph.repo + yum: name=http://gitbuilder.ceph.com/ceph-rpm-{{ ceph_dev_redhat_distro }}-x86_64-basic/ref/{{ ceph_dev_branch }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro }}.noarch.rpm + register: repo_result when: ceph_dev - changed_when: False + failed_when: repo_result.rc > 1 + changed_when: repo_result.rc == 0 - name: Add Inktank Ceph Enterprise repository template: >