install-ansible: refactor install on Red Hat

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>
pull/756/head
Sébastien Han 2016-05-04 17:33:07 +02:00
parent 28bf3aab44
commit c65a9f9dc4
1 changed files with 25 additions and 25 deletions

View File

@ -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