美文网首页
【ansible】CentOS7.x上ansible的离线安装包

【ansible】CentOS7.x上ansible的离线安装包

作者: Bogon | 来源:发表于2020-10-13 21:03 被阅读0次

    在一台CentOS7.x的联网机器上

    # yum -y install yum-utils createrepo epel-release

    # mkdir yum

    # repotrack ansible -p yum

    # createrepo -v yum

    # tar -zcf yum.tar.gz yum

    在离线机器上安装ansible

    # cat   install_ansible.sh

    ########################################################

    #!/bin/bash

    parent_path="$( cd "$(dirname "$0")"; pwd -P )"

    cd "$parent_path"

    rm -rf /tmp/yum

    tar -zxf yum.tar.gz -C /tmp

    echo "

    [YUM]

    name=yum

    baseurl=file:///tmp/yum

    enable=1

    gpgcheck=0 " > /etc/yum.repos.d/yum.repo

    yum clean all

    yum -y install ansible --disablerepo="*" --enablerepo="YUM"

    sed -i '/\[defaults\]/a \host_key_checking = False\' /etc/ansible/ansible.cfg

    rm -rf /etc/yum.repos.d/yum.repo

    rm -rf /tmp/yum

    ansible --version

    if [ $? -eq 0 ]; then

      echo -e "\033[32mInstall ansible successfullly! \033[0m"

    else

      echo -e "\033[31mInstall ansible failed! \033[0m"

    fi

    #########################################################

    相关文章

      网友评论

          本文标题:【ansible】CentOS7.x上ansible的离线安装包

          本文链接:https://www.haomeiwen.com/subject/mjjbpktx.html