mirror of https://github.com/ceph/ceph-ansible.git
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
parent
28bf3aab44
commit
c65a9f9dc4
|
@ -10,7 +10,6 @@ if [[ $EUID -ne 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -x $(which lsb_release 2>/dev/null) ]]; then
|
|
||||||
os_VENDOR=$(lsb_release -i -s)
|
os_VENDOR=$(lsb_release -i -s)
|
||||||
os_VERSION=$(lsb_release -c -s)
|
os_VERSION=$(lsb_release -c -s)
|
||||||
if [[ "Debian" =~ $os_VENDOR ]]; then
|
if [[ "Debian" =~ $os_VENDOR ]]; then
|
||||||
|
@ -25,16 +24,17 @@ if [[ -x $(which lsb_release 2>/dev/null) ]]; then
|
||||||
add-apt-repository -y ppa:ansible/ansible
|
add-apt-repository -y ppa:ansible/ansible
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y ansible
|
apt-get install -y ansible
|
||||||
elif [[ "RedHatEnterpriseServer" =~ $os_VENDOR || "CentOS" =~ $os_VENDOR ]]; then
|
elif [[ "RedHatEnterpriseServer" =~ $os_VENDOR || "CentOS" =~ $os_VENDOR || -r /etc/redhat-release ]]; then
|
||||||
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
rpm -q epel-release-* || rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||||
yum install -y ansible
|
yum install -y ansible
|
||||||
else
|
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
|
||||||
echo "Unsupported platform ${os_VENDOR}: ${os_VERSION}"
|
echo "Unsupported platform ${os_VENDOR}: ${os_VERSION}"
|
||||||
echo "Please send a pull-request or open an issue"
|
echo "Please send a pull-request or open an issue"
|
||||||
echo "on https://github.com/ceph/ceph-ansible/"
|
echo "on https://github.com/ceph/ceph-ansible/"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in New Issue