Commit a76d3700 authored by nanahira's avatar nanahira

pip

parent 6ec2a84f
......@@ -12,6 +12,7 @@ china_mirror: false
install_docker: false
upgrade: false
reboot: false
pip_executable: pip
pip_executable_install: pip
china_mirror_docker: false
china_mirror_pip: false
cpufreq: none
......@@ -2,7 +2,7 @@
become: true
apt:
update_cache: true
name: curl,wget,git,vim,sudo,byobu,iftop,iotop,build-essential,p7zip-full,p7zip-rar,xclip,astyle,python3-setuptools,python3-dev,python3-pip,tcpdump,rsync,htop,locales,mtr,dnsutils,net-tools,traceroute,tar,unzip,iperf,iperf3,nmap,mosh,subversion,nfs-common,fish,haveged,ipset
name: curl,wget,git,vim,sudo,byobu,iftop,iotop,build-essential,p7zip-full,p7zip-rar,xclip,astyle,tcpdump,rsync,htop,locales,mtr,dnsutils,net-tools,traceroute,tar,unzip,iperf,iperf3,nmap,mosh,subversion,nfs-common,fish,haveged,ipset
- name: ctags in old Ubuntu
become: true
apt:
......@@ -21,10 +21,15 @@
apt:
name: universal-ctags
when: ansible_distribution == 'Debian' or ansible_distribution_release == 'focal'
- name: non-focal packages
become: true
apt:
name: python-setuptools,python-dev,python-pip
when: ansible_distribution_release != 'focal'
- name: focal packages
become: true
apt:
name: python-is-python3,wireguard
name: python3-setuptools,python3-dev,python-is-python3,wireguard,python3-pip
when: ansible_distribution_release == 'focal'
- name: open vm tools
become: true
......
......@@ -6,7 +6,7 @@
- name: dnf
become: true
dnf:
name: curl,wget,git,vim,sudo,byobu,iftop,iotop,gcc,gcc-c++,make,autoconf,p7zip,p7zip-plugins,python3-pip,tcpdump,rsync,htop,mtr,net-tools,ctags,astyle,xclip,traceroute,tar,unzip,nmap,python3-libselinux,mosh,subversion,haveged,nfs-utils,ipset # nfs-common,fish
name: curl,wget,git,vim,sudo,byobu,iftop,iotop,gcc,gcc-c++,make,autoconf,p7zip,p7zip-plugins,python3-pip,python3-devel,tcpdump,rsync,htop,mtr,net-tools,ctags,astyle,xclip,traceroute,tar,unzip,nmap,python3-libselinux,mosh,subversion,haveged,nfs-utils,ipset # nfs-common,fish
update_cache: yes
- name: Fedora packages
become: true
......
......@@ -43,14 +43,14 @@
- name: 安装 Docker (apt)
become: true
apt:
name: docker-ce,python-backports-shutil-get-terminal-size,python-backports.ssl-match-hostname,python-pip
name: docker-ce,python-backports-shutil-get-terminal-size,python-backports.ssl-match-hostname
update_cache: yes
when: ansible_os_family == 'Debian' and ansible_distribution_release != 'focal'
notify: restart_docker
- name: 安装 Docker (focal)
become: true
apt:
name: docker.io,python3-pip
name: docker.io
update_cache: yes
when: ansible_os_family == 'Debian' and ansible_distribution_release == 'focal'
notify: restart_docker
......@@ -87,21 +87,21 @@
- name: 安装 Docker (yum)
become: true
yum:
name: python3-pip,docker-ce,docker-ce-cli,containerd.io
name: docker-ce,docker-ce-cli,containerd.io
update_cache: yes
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int < 8
notify: restart_docker
- name: 安装 Docker (CentOS 8)
become: true
dnf:
name: python3-pip,docker-ce,docker-ce-cli,containerd.io
name: docker-ce,docker-ce-cli,containerd.io
update_cache: yes
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int == 8
notify: restart_docker
- name: 安装 Docker (Fedora)
become: true
dnf:
name: python3-pip,moby-engine
name: moby-engine
update_cache: yes
when: ansible_distribution == 'Fedora'
notify: restart_docker
......@@ -112,55 +112,19 @@
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/python{{item}}/dist-packages/easy-install.pth'
state: absent
with_items:
- 2.7
- 3.5
- 3.6
- 3.7
- 3.8
- name: 'use pip3'
set_fact:
pip_executable: pip3
when: ansible_os_family == 'RedHat' or ansible_distribution_release == 'focal'
- name: docker-compose pip
become: true
pip:
name: pip
executable: '{{pip_executable}}'
state: latest
when: not china_mirror_docker
- name: docker-compose
become: true
pip:
name: docker-compose
executable: '{{pip_executable}}'
state: latest
when: not china_mirror_docker
- name: docker-compose 国内
become: true
pip:
name: pip
executable: '{{pip_executable}}'
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
when: china_mirror_docker
when: not china_mirror_pip
- name: docker-compose 国内
become: true
pip:
name: docker-compose
executable: '{{pip_executable}}'
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
when: china_mirror_docker
when: china_mirror_pip
- name: docker 配置 创建目录
become: true
file:
......
......@@ -33,6 +33,8 @@
- name: redhat configures
include_tasks: redhat_configures.yml
when: ansible_os_family == 'RedHat'
- name: pip
include_tasks: pip.yml
- name: docker
include_tasks: docker.yml
when: install_docker
......
- name: 'use pip3'
set_fact:
pip_executable_install: pip3
when: ansible_python.version.major == 3
- name: 'use pip'
set_fact:
pip_executable_install: pip
when: ansible_python.version.major == 2
- name: china mirror pip
set_fact:
china_mirror_pip: true
when: china_mirror
- name: clean pip dir
file:
path: ~/.pip
state: absent
- name: clean easy install
become: true
file:
path: '/usr/local/lib/python{{item}}/dist-packages/easy-install.pth'
state: absent
with_items:
- 2.7
- 3.5
- 3.6
- 3.7
- 3.8
- name: upgrade pip
become: true
pip:
name: pip
executable: '{{pip_executable_install}}'
state: latest
when: not china_mirror_pip
- name: upgrade pip China
become: true
pip:
name: pip
executable: '{{pip_executable_install}}'
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
when: china_mirror_pip
- name: pip package list
set_fact:
pip_package_list: 'autopep8'
- name: pip packages
become: true
pip:
name: '{{pip_package_list}}'
when: not china_mirror_pip
- name: pip packages China
become: true
pip:
name: '{{pip_package_list}}'
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
when: china_mirror_pip
......@@ -5,7 +5,7 @@
- name: yum
become: true
yum:
name: curl,wget,git,vim,sudo,byobu,iftop,iotop,gcc,gcc-c++,make,autoconf,p7zip,p7zip-plugins,python-pip,tcpdump,rsync,htop,mtr,net-tools,ctags,xclip,traceroute,tar,unzip,iperf,iperf3,nmap,libselinux-python,mosh,subversion,fish,haveged,mtr,rsync,nfs-utils,ipset # astyle
name: curl,wget,git,vim,sudo,byobu,iftop,iotop,gcc,gcc-c++,make,autoconf,p7zip,p7zip-plugins,python-pip,python-devel,tcpdump,rsync,htop,mtr,net-tools,ctags,xclip,traceroute,tar,unzip,iperf,iperf3,nmap,libselinux-python,mosh,subversion,fish,haveged,mtr,rsync,nfs-utils,ipset # astyle
update_cache: yes
- name: open vm tools
become: true
......
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