
11 Mar
2021
11 Mar
'21
3:28 p.m.
On Thu, Mar 11, 2021 at 03:18:29PM +0800, Wu Fengguang wrote:
+install_ansible() +{ + if [ "$os" == "openeuler" ]; then + yum -y reinstall git + yum -y install python3 + pip3 install ansible + elif [ "$os" == "centos" ]; then + yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + yum -y reinstall git + yum -y install ansible + elif [ "$os" == "debian" ]; then + apt-get install -y ansible + fi + + command -v ansible > /dev/null && { + ansible localhost -m ping + [ $? -eq 0 ] && { + echo "Ansible is successfully deployed!"
No need to show successful message. Instead, please show error message and abort if failed.
Ok. got it.
Thanks, Fengguang
+ } + } +}