目录
[root@db1 server]# tree . ├── ans-docker │ ├── dockerfile │ └── hosts ├── group_vars │ └── all ├── hosts ├── sys_basic │ ├── ~ │ ├── files │ │ ├── daemon.json │ │ └── hosts │ ├── handlers │ ├── tasks │ │ └── main.yml │ └── templates └── top.yml
top.yml- hosts: dbvars:python_interpreter: /usr/bin/python2roles:- role: sys_basic- hosts: dbvars:python_interpreter: /usr/bin/python3
daemon.json {"registry-mirrors": ["https://docker-proxy.741001.xyz","https://registry.docker-cn.com"] }
[root@db1 server]# cat sys_basic/tasks/main.yml - name: 1yum安装yum:name:- tree- vim- wget- bash-completion- bash-completion-extras- lrzsz - net-tools- unzip- bind-utils- httpd-tools- telnet- python3-pip- name: pei hoscopy:src: hostsdest: /etc/hostsbackup: yes- name: 3.安装oython3 docker依赖command: pip3 install docker==2.6.1- name: 4.开启内核转发shell: cmd:echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.confsysctl -p - name: 5 安装docker-ce,docker-compose 源get_url: url: https://mirrors.aliyun.com/repo/Centos-7.repodest: /etc/yum.repos.d/CentOS-Base.repovalidate_certs: no- name: 6 安装yum:name: - docker-ce- docker-compose - name: 6 pez docke加速copy:src: daemon.jsondest: /etc/docker/daemon.jsonbackup: yes- name: 7 qidongsystemd:name: dockerenabled: yesstate: started