美文网首页
Ansible部署

Ansible部署

作者: 古寒飞 | 来源:发表于2017-07-21 20:29 被阅读32次

    ============================================================================

    //从bao文件里上传安装包

    [root@001 ansible]# yum -y localinstall *.rpm

    [root@001 ansible]# ssh-keygen

    [root@001 ansible]# ssh-copy-id root@192.168.88.102

    [root@001 ansible]# ssh-copy-id 192.168.88.103

    [root@001 ansible]# cd /etc/ansible/

    [root@001 ansible]# vim ansible.cfg

    ---private_key_file=/root/.ssh/id_rsa # 定义ssh信任文件所在位置

    [root@001 ansible]# vim hosts # 在配置文件内追加以下内容

    ---[tay]

    ---192.168.88.102

    ---192.168.88.103

    [root@001 ansible]# ansible tay -m command -a "uptime"

    =========================================================================

    yum安装版

    第一步:安装163源,因为本地光盘中没有epel源的安装包---加载163源缓存

    第二步:安装epel源,因为只有epel源中才有ansible的yum安装---加载epel源缓存

    第三步:yum install -y ansible

    第四步:修改/etc/ansible/ansible.cfg

    第五步:修改/etc/ansible/hosts

    第六步:ssh-keygen(生成本地ssh秘钥)

    第七步:ssh-copy-id root@xxx.xxx.xxx.xxx(与远程主机建立连接)

    第八步:ansible tay -m command -a "uptime"

    相关文章

      网友评论

          本文标题:Ansible部署

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