免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
ansible安裝docker腳本

使用ansible批量在服務(wù)器安裝docker

注意:

1. ansible版本是2.8,其他版本也都是支持的,低版本請自行百度下,看下模塊的使用方法

2. 我修改了docker的存儲路徑,默認(rèn)是在/var/lib/docker,系統(tǒng)盤太小,所以單獨掛載了一塊數(shù)據(jù)盤,掛載到了/data,執(zhí)行腳本請確定有/data此目錄

3. 使用直接修改 yourhosts即可

4. 配置范例

cat /etc/ansible/hosts

[yourhosts]

web01 ansible_host=192.168.10.30 ansible_port=22 ansible_user=root ansible_password=1qaz

web02 ansible_host=192.168.10.23 ansible_port=22 ansible_user=root ansible_password=2wsx

5. 執(zhí)行腳本

ansible-playbook docker_install.yml

6. 腳本內(nèi)容:

cat /usr/local/srcipt/docker_install.yml

---

  - hosts: yourhosts

    remote_user: root

    tasks:

      - name: Add epel-release repository

        yum_repository:

          name: epel

          description: EPEL YUM repo

          baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/

          gpgcheck: no

      - name: Installing System Dependency Packages

        yum:

          name:

            - yum-utils

            - device-mapper-persistent-data

            - lvm2

          state: present

          disable_gpg_check: yes

      - name: Add Docker Yum Repo

        shell: yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

      - name: Install docker

        yum:

          name: docker-ce

          state: present

          disable_gpg_check: yes

        notify: install docker

    handlers:

      - name: Created symlink from docker.services

        listen: install docker

        shell: systemctl enable docker

      - name: Create docker configuration file paths

        listen: install docker

        file:

          path: /etc/docker

          state: directory

      - name: Create docker data paths

        listen: install docker

        file:

          path: /data/docker

          state: directory

      # 注意 marker中不能有值,因為docker配置文件的#不是注釋,有可能啟動失敗

      - name: Create configuration

        listen: install docker

        blockinfile:

          path: /etc/docker/daemon.json

          create: yes

          content: |

              {

              "live-restore": true,

              "registry-mirrors": ["https://pee6w651.mirror.aliyuncs.com"]

              }

          marker: " "

          # marker: "#{mark} ansible aliyun config"

      - name: Modify the data file path

        listen: install docker

        lineinfile:

          path: /usr/lib/systemd/system/docker.service

          regexp: "^ExecStart"

          line: ExecStart=/usr/bin/dockerd --graph /data/docker

      - name: daemon reload

        listen: install docker

        shell: systemctl disable docker && systemctl enable docker && systemctl daemon-reload

      - name: start docker server

        listen: install docker

        service:

          name: docker

          state: started

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
linux下SSH服務(wù)利用shell腳本實現(xiàn)密鑰的批量分發(fā)與執(zhí)行
ansible playbook 安裝docker
centos7安裝docker
如何創(chuàng)建CentOS系統(tǒng)的Docker基礎(chǔ)鏡像?
一 安裝docker(詳解)
163yum源
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服