<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] ## 概述 批量操作多臺服務器 ## 安裝 ansible ``` yum -y install epel-release yum -y install ansible ``` ## 管理機的秘鑰發給其他 節點 ``` # ssh-keygen -t rsa -P '' # ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.0.111 # ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.0.229 ``` ## 命令 格式: ![UTOOLS1575621688577.png](http://yanxuan.nosdn.127.net/5de2151adc7253b72e81a968f50a179c.png) ``` - m command:這是個默認模塊,不寫-m xx模塊的時候,默認會當成command模塊,表示執行主機指令 copy user group ansible web 指定某個組 ansible all 自定所有節點 ``` ## 場景 先配置參數 ``` # cat /etc/ansible/hosts | grep -v ^# | grep -v ^$ [web] 192.168.0.111 192.168.0.229 ``` ### 批量執行遠程腳本命令 ``` ansible web -m shell -a '/bin/echo hello ansible' //nodex 下面的節點 ansible all -m shell -a '/bin/echo hello ansible' //所有節點 ``` ### script 在遠程主機上運行本機腳本,只支持用相對路徑 ``` ansible web -m script -a 'test.sh' ``` ### 文件操作 ``` ansible web -m copy -a 'src="/home/zing/Documents/源.txt" dest="/home/xxserver/目標.txt" [owner="root"] [mode=640'] ``` ### 發送批量數據 ``` ansible web -a 'echo "hello word"' ``` ### user 操作用戶 ``` # 創建用戶 ansible local -m user -a 'name="zing1" password="自定義的密碼" groups="root,system,sys" home="/home/zing1" ' # 刪除用戶 ansible local -m user -a 'name="zing1" state=absent fource=yes' ``` ### group 操作用戶組 ``` ansible local -m group -a 'name="mysql" gid=306 system=yes ' ansible local -m group -a 'name="mysql" state=absent fource=yes' ``` ### service 指定服務的運行狀態 ``` ansible local -m service -a 'name="httpd" enabled=true state=started ' #enable表示是否開機啟動 #state 參數有started stopped restarted ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看