Commit 96f397df authored by nanahira's avatar nanahira

add docker

parent 83454e19
...@@ -6,4 +6,6 @@ mirror_debian: http://deb.debian.org ...@@ -6,4 +6,6 @@ mirror_debian: http://deb.debian.org
mirror_debian_security: http://security.debian.org mirror_debian_security: http://security.debian.org
mirror_ubuntu: http://archive.ubuntu.com mirror_ubuntu: http://archive.ubuntu.com
mirror_ubuntu_security: http://security.ubuntu.com mirror_ubuntu_security: http://security.ubuntu.com
mirror_docker: https://download.docker.com
china_mirror: false china_mirror: false
install_docker: false
- name: China mirror for Docker
set_fact:
mirror_docker: https://mirrors.ustc.edu.cn/docker-ce
when: "china_mirror"
- name: Docker 源公钥
become: true
apt_key:
url: '{{mirror_docker}}/linux/{{ ansible_distribution|lower }}/gpg'
- name: Docker 源
become: true
apt_repository:
repo: 'deb [arch=amd64] {{mirror_docker}}/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable'
filename: docker
- name: 安装 Docker
become: true
apt:
name: docker-ce,python-backports-shutil-get-terminal-size,python-backports.ssl-match-hostname,python-pip
update_cache: yes
state: latest
- name: docker user group
become: true
user:
name: '{{ansible_user_id}}'
append: true
groups: docker
when: "ansible_user_id != 'root'"
- name: docker-compose 清理 pip
file:
path: ~/.pip
state: absent
- name: docker-compose 清理 easy install
become: true
file:
path: /usr/local/lib/python2.7/dist-packages/easy-install.pth
state: absent
- name: docker-compose pip
become: true
pip:
name: pip
state: latest
when: "not china_mirror"
- name: docker-compose
become: true
pip:
name: docker-compose
state: latest
when: "not china_mirror"
- name: docker-compose 国内
become: true
pip:
name: pip
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
when: "china_mirror"
- name: docker-compose 国内
become: true
pip:
name: docker-compose
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
when: "china_mirror"
- name: docker 配置 创建目录
become: true
file:
name: /etc/docker
state: directory
- name: docker 配置
become: true
copy:
content: |
{
"live-restore": true
}
dest: /etc/docker/daemon.json
- name: docker 启动
become: true
systemd:
name: docker
enabled: yes
state: started
when: ansible_virtualization_type != 'docker'
...@@ -19,8 +19,9 @@ ...@@ -19,8 +19,9 @@
file: file:
name: '~/.config/fish/completions' name: '~/.config/fish/completions'
state: directory state: directory
#- name: 终端环境 fish 自动填充 docker - name: 终端环境 fish 自动填充 docker
# copy: copy:
# src: /usr/share/fish/vendor_completions.d/docker.fish src: /usr/share/fish/vendor_completions.d/docker.fish
# dest: '~/.config/fish/completions/docker.fish' dest: '~/.config/fish/completions/docker.fish'
# remote_src: yes remote_src: yes
when: "install_docker"
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
- name: redhat configures - name: redhat configures
include_tasks: redhat_configures.yml include_tasks: redhat_configures.yml
when: "ansible_os_family == 'RedHat'" when: "ansible_os_family == 'RedHat'"
- name: docker
include_tasks: docker.yml
when: "ansible_os_family == 'Debian' and install_docker"
- name: fish - name: fish
include_tasks: fish.yml include_tasks: fish.yml
when: "ansible_os_family == 'Debian'" # RedHat has too many problems on fish, so aborted when: "ansible_os_family == 'Debian'" # RedHat has too many problems on fish, so aborted
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment