]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
use yum to install ceph noarch package
authorYin Jifeng <jifeng.yin@gmail.com>
Thu, 16 Apr 2015 07:09:55 +0000 (15:09 +0800)
committerYin Jifeng <jifeng.yin@gmail.com>
Thu, 16 Apr 2015 07:16:18 +0000 (15:16 +0800)
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

index 8a66e537f1500cb4890ad8d58ea9cf0cf055278e..0ce10dfeb0e79d77f768f12dfa769945754f678c 100644 (file)
   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: >