2017-11-11 19:14:21 +08:00
|
|
|
## ---------docker daemon配置部分-----------
|
|
|
|
- name: 下载 docker 二进制文件
|
|
|
|
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755
|
|
|
|
with_items:
|
|
|
|
- docker-containerd
|
|
|
|
- docker-containerd-shim
|
|
|
|
- docker-init
|
|
|
|
- docker-runc
|
|
|
|
- docker
|
|
|
|
- docker-containerd-ctr
|
|
|
|
- dockerd
|
|
|
|
- docker-proxy
|
|
|
|
|
|
|
|
- name: docker命令自动补全
|
|
|
|
copy: src=docker dest=/etc/bash_completion.d/docker mode=0644
|
|
|
|
|
|
|
|
- name: docker国内镜像加速
|
|
|
|
copy: src=daemon.json dest=/etc/docker/daemon.json
|
|
|
|
|
|
|
|
- name: 创建docker的systemd unit文件
|
|
|
|
template: src=docker.service.j2 dest=/etc/systemd/system/docker.service
|
|
|
|
|
|
|
|
- name: daemon-reload
|
|
|
|
shell: systemctl daemon-reload
|
|
|
|
|
|
|
|
- name: enable-docker
|
|
|
|
shell: systemctl enable docker
|
|
|
|
|
|
|
|
- name: flush-iptables
|
2017-11-28 23:27:38 +08:00
|
|
|
shell: "iptables -F && iptables -X \
|
|
|
|
&& iptables -F -t nat && iptables -X -t nat \
|
|
|
|
&& iptables -F -t raw && iptables -X -t raw \
|
|
|
|
&& iptables -F -t mangle && iptables -X -t mangle"
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
|
|
- name: start-docker
|
|
|
|
shell: systemctl restart docker
|