]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
install-ansible: refactor install on Red Hat 756/head
authorSébastien Han <seb@redhat.com>
Wed, 4 May 2016 15:33:07 +0000 (17:33 +0200)
committerSébastien Han <seb@redhat.com>
Wed, 4 May 2016 15:33:07 +0000 (17:33 +0200)
Merge both lsb_release and /etc/redhat-release cases.
Also testing if epel is already installed or not.

Signed-off-by: Sébastien Han <seb@redhat.com>
install-ansible.sh

index 8954b3ac7e64de5e195827d1b8d81ac153fea5ec..b3127d7b8e13ffea63cb3a846e2dd89d4eb96526 100755 (executable)
@@ -10,31 +10,31 @@ if [[ $EUID -ne 0 ]]; then
     exit 1
 fi
 
-if [[ -x $(which lsb_release 2>/dev/null) ]]; then
-  os_VENDOR=$(lsb_release -i -s)
-  os_VERSION=$(lsb_release -c -s)
-  if [[ "Debian" =~ $os_VENDOR ]]; then
-    apt-get update
-    apt-get install -y python-pip python-dev git build-essential
-    pip install PyYAML jinja2 paramiko
-    git clone https://github.com/ansible/ansible.git
-    cd ansible
-    make install
-    mkdir /etc/ansible
-  elif [[ "Ubuntu" =~ $os_VENDOR ]]; then
-    add-apt-repository -y ppa:ansible/ansible
-    apt-get update
-    apt-get install -y ansible
-  elif [[ "RedHatEnterpriseServer" =~ $os_VENDOR || "CentOS" =~ $os_VENDOR ]]; then
-    rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-    yum install -y ansible
-  else
-    echo "Unsupported platform ${os_VENDOR}: ${os_VERSION}"
-    echo "Please send a pull-request or open an issue"
-    echo "on https://github.com/ceph/ceph-ansible/"
+os_VENDOR=$(lsb_release -i -s)
+os_VERSION=$(lsb_release -c -s)
+if [[ "Debian" =~ $os_VENDOR ]]; then
+  apt-get update
+  apt-get install -y python-pip python-dev git build-essential
+  pip install PyYAML jinja2 paramiko
+  git clone https://github.com/ansible/ansible.git
+  cd ansible
+  make install
+  mkdir /etc/ansible
+elif [[ "Ubuntu" =~ $os_VENDOR ]]; then
+  add-apt-repository -y ppa:ansible/ansible
+  apt-get update
+  apt-get install -y ansible
+elif [[ "RedHatEnterpriseServer" =~ $os_VENDOR || "CentOS" =~ $os_VENDOR || -r /etc/redhat-release ]]; then
+  rpm -q epel-release-* || rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+  yum install -y ansible
+else
+  if [[ ! -x $(which lsb_release 2>/dev/null) ]]; then
+    echo "lsb_release is not installed"
+    echo "Can not evaluate the platform"
     exit 1
   fi
-elif [[ -r /etc/redhat-release ]]; then
-  rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-  yum install -y ansible
+  echo "Unsupported platform ${os_VENDOR}: ${os_VERSION}"
+  echo "Please send a pull-request or open an issue"
+  echo "on https://github.com/ceph/ceph-ansible/"
+  exit 1
 fi