<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>

                ## Ansible使用筆記 (1)安裝及配置 * 軟件安裝:只需要在管理端安裝:yum install -y ansible * 秘鑰配置:私鑰放在管理端服務器,公鑰放在被管理端服務器,若有多臺被管理服務器則都需放置,使ssh能直接連接 * 配置:把被管理端的IP放入到hosts (2)連接和測試 * ansible 47.106.123.191 -m command -a 'df -h',運行正確則說明ansible配置完成 * ping全部被管理機:ansible all -m ping * ping測試[or]組 ``` [root@xinxi-server ansible]# ansible or -m ping 47.106.123.191 | SUCCESS => { "changed": false, "ping": "pong" } 120.79.83.150 | SUCCESS => { "changed": false, "ping": "pong" } 118.31.62.194 | SUCCESS => { "changed": false, "ping": "pong" } ``` (3)遠程命令模塊 * 執行命令 ``` ansible Client -m command -a "free -m" ``` * 執行腳本 ``` ansible Client -m script -a "/home/test.sh 12 34" ``` * 復制文件 ``` ansible Client -m copy -a "src=/home/test.sh dest=/tmp/ owner=root group=root mode=0755" ``` * 獲取遠程文件的詳細情況 ``` ansible 118.31.62.194 -m stat -a "path=/home/test.sh" ``` * 下載網絡文件到被管理機 ``` ansible 118.31.62.194 -m get_url -a "url=http://soft.vpser.net/lnmp/lnmp1.5.tar.gz dest=/home mode=0755 force=yes" ``` * 控制被管理機yum安裝軟件(示例中為安裝npm) ``` ansible 118.31.62.194 -m yum -a "name=npm state=latest" ``` * 配置crontab ``` ansible Client -m cron -a "name='check dirs' hour='5,2' job='ls / > /home/test.txt'" ``` > 在被管理機: ``` [root@iz tmp]# crontab -l #Ansible: check dirs * 5,2 * * * ls / > /home/test.txt ``` >[info] Playbook的使用 ``` --- - hosts: aliyun remote_user: root tasks: - name: install git yum: name=git state=latest - name: clone lnmp shell: "cd /home;git clone https://linzening:default123@gitee.com/linzening/lnmp" - name: install lnmp shell: "cd /home/lnmp/;bash install.sh lnmp" - name: install redis shell: "cd /home/lnmp/;bash addons.sh 5" - name: install mysql shell: "cd /home/lnmp/tools;bash rpm_mysql8_0_12.sh" - name: install myweb shell: "cd /home/lnmp/tools;bash deploy_myweb.sh" ... ``` + 運行:`ansible-book xxx.yml` * 遠程主機系統服務管理 >[success] 參考:http://www.cnblogs.com/wangxiaoqiangs/p/5685239.html > Date:2018-09-20
                  <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>

                              哎呀哎呀视频在线观看