Commit 7674b99a authored by nanahira's avatar nanahira

docker is not supported by centos yet

parent 89ecfe64
---
- hosts: docker
remote_user: root
tasks:
- name: apt
become: true
apt:
update_cache: true
state: latest
name: curl,wget,apt-transport-https,lsb-release,gnupg,tar,unzip,rsync
- name: Docker key
become: true
apt_key:
url: https://mirrors.aliyun.com/docker-ce/linux/debian/gpg
when: "ansible_distribution == 'Debian'"
- name: Docker source clean
become: true
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
filename: docker
state: absent
when: "ansible_distribution == 'Debian'"
- name: Docker source
become: true
apt_repository:
repo: deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
filename: docker
when: "ansible_distribution == 'Debian'"
- name: Docker for Debian
become: true
apt:
state: latest
update_cache: true
name: docker-ce,python-backports-shutil-get-terminal-size,python-backports.ssl-match-hostname,python-pip
when: "ansible_distribution == 'Debian'"
- name: Docker for Ubuntu
become: true
apt:
state: latest
update_cache: true
name: docker.io,python-backports-shutil-get-terminal-size,python-backports.ssl-match-hostname,python-pip
when: "ansible_distribution == 'Ubuntu'"
- name: docker user group
become: true
user:
name: '{{ansible_user_id}}'
append: true
groups: docker
when: "ansible_user_id != 'root'"
- name: fake pip
become: true
file:
src: /usr/bin/pip3
dest: /usr/bin/pip
state: link
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int == 8"
- name: docker-compose pip
become: true
pip:
name: pip
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
when: "ansible_distribution != 'CentOS' or ansible_distribution_major_version|int != 8"
- name: docker-compose
become: true
pip:
name: docker-compose
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
update_cache: true update_cache: true
state: latest state: latest
name: curl,wget,apt-transport-https,lsb-release,gnupg,build-essential,tar,unzip,python,rsync name: curl,wget,apt-transport-https,lsb-release,gnupg,build-essential,tar,unzip,python,rsync
when: "ansible_distribution != 'CentOS'"
- name: nodesource - name: nodesource
with_items: with_items:
- deb - deb
...@@ -18,11 +17,13 @@ ...@@ -18,11 +17,13 @@
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)" when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)"
- name: nodejs from nodesource - name: nodejs from nodesource
apt: apt:
update_cache: true
state: latest state: latest
name: nodejs name: nodejs
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)" when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)"
- name: nodejs from apt - name: nodejs from apt
apt: apt:
update_cache: true
state: latest state: latest
name: npm name: npm
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int >= 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int >= 9)" when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int >= 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int >= 9)"
...@@ -32,7 +33,7 @@ ...@@ -32,7 +33,7 @@
when: "ansible_distribution == 'Debian'" when: "ansible_distribution == 'Debian'"
- name: Docker source - name: Docker source
apt_repository: apt_repository:
repo: deb [arch=amd64] https://mirrors.aliyun.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable repo: deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
filename: docker filename: docker
when: "ansible_distribution == 'Debian'" when: "ansible_distribution == 'Debian'"
- name: Docker for Debian - name: Docker for Debian
...@@ -47,28 +48,6 @@ ...@@ -47,28 +48,6 @@
update_cache: true update_cache: true
name: docker.io name: docker.io
when: "ansible_distribution == 'Ubuntu'" when: "ansible_distribution == 'Ubuntu'"
- name: epel 7
yum:
state: latest
update_cache: true
name: epel-release,curl
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int <= 7"
- name: yum
yum:
state: latest
update_cache: true
name: wget,npm,gcc,gcc-c++,make,tar,unzip,docker,python,rsync
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int <= 7"
- name: epel 8
dnf:
state: latest
name: epel-release
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int == 8"
- name: dnf
dnf:
state: latest
name: curl,wget,npm,gcc,gcc-c++,make,tar,unzip,docker,python,rsync
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int == 8"
- name: npm - name: npm
npm: npm:
name: 'n' name: 'n'
......
...@@ -2,37 +2,6 @@ ...@@ -2,37 +2,6 @@
- hosts: utility - hosts: utility
remote_user: root remote_user: root
tasks: tasks:
- name: pre packages
apt:
update_cache: true
name: curl,wget,apt-transport-https,lsb-release,gnupg
state: latest
- name: Docker key
apt_key:
url: https://mirrors.aliyun.com/docker-ce/linux/debian/gpg
- name: Docker source
apt_repository:
repo: deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
filename: docker
- name: apt
apt:
update_cache: true
name: docker-ce,python-backports-shutil-get-terminal-size,python-backports.ssl-match-hostname,python-pip,rsync
state: latest
- name: docker service
systemd:
name: docker
state: started
- name: docker-compose pip
pip:
name: pip
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
- name: docker-compose
pip:
name: docker-compose
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
- name: utility directory - name: utility directory
file: file:
path: /root/utility path: /root/utility
......
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