Commit a76d3700 authored by nanahira's avatar nanahira

pip

parent 6ec2a84f
...@@ -12,6 +12,7 @@ china_mirror: false ...@@ -12,6 +12,7 @@ china_mirror: false
install_docker: false install_docker: false
upgrade: false upgrade: false
reboot: false reboot: false
pip_executable: pip pip_executable_install: pip
china_mirror_docker: false china_mirror_docker: false
china_mirror_pip: false
cpufreq: none cpufreq: none
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
become: true become: true
apt: apt:
update_cache: true 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 - name: ctags in old Ubuntu
become: true become: true
apt: apt:
...@@ -21,10 +21,15 @@ ...@@ -21,10 +21,15 @@
apt: apt:
name: universal-ctags name: universal-ctags
when: ansible_distribution == 'Debian' or ansible_distribution_release == 'focal' 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 - name: focal packages
become: true become: true
apt: apt:
name: python-is-python3,wireguard name: python3-setuptools,python3-dev,python-is-python3,wireguard,python3-pip
when: ansible_distribution_release == 'focal' when: ansible_distribution_release == 'focal'
- name: open vm tools - name: open vm tools
become: true become: true
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
- name: dnf - name: dnf
become: true become: true
dnf: 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 update_cache: yes
- name: Fedora packages - name: Fedora packages
become: true become: true
......
...@@ -43,14 +43,14 @@ ...@@ -43,14 +43,14 @@
- name: 安装 Docker (apt) - name: 安装 Docker (apt)
become: true become: true
apt: 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 update_cache: yes
when: ansible_os_family == 'Debian' and ansible_distribution_release != 'focal' when: ansible_os_family == 'Debian' and ansible_distribution_release != 'focal'
notify: restart_docker notify: restart_docker
- name: 安装 Docker (focal) - name: 安装 Docker (focal)
become: true become: true
apt: apt:
name: docker.io,python3-pip name: docker.io
update_cache: yes update_cache: yes
when: ansible_os_family == 'Debian' and ansible_distribution_release == 'focal' when: ansible_os_family == 'Debian' and ansible_distribution_release == 'focal'
notify: restart_docker notify: restart_docker
...@@ -87,21 +87,21 @@ ...@@ -87,21 +87,21 @@
- name: 安装 Docker (yum) - name: 安装 Docker (yum)
become: true become: true
yum: yum:
name: python3-pip,docker-ce,docker-ce-cli,containerd.io name: docker-ce,docker-ce-cli,containerd.io
update_cache: yes update_cache: yes
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int < 8 when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int < 8
notify: restart_docker notify: restart_docker
- name: 安装 Docker (CentOS 8) - name: 安装 Docker (CentOS 8)
become: true become: true
dnf: dnf:
name: python3-pip,docker-ce,docker-ce-cli,containerd.io name: docker-ce,docker-ce-cli,containerd.io
update_cache: yes update_cache: yes
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int == 8 when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int == 8
notify: restart_docker notify: restart_docker
- name: 安装 Docker (Fedora) - name: 安装 Docker (Fedora)
become: true become: true
dnf: dnf:
name: python3-pip,moby-engine name: moby-engine
update_cache: yes update_cache: yes
when: ansible_distribution == 'Fedora' when: ansible_distribution == 'Fedora'
notify: restart_docker notify: restart_docker
...@@ -112,55 +112,19 @@ ...@@ -112,55 +112,19 @@
append: true append: true
groups: docker groups: docker
when: ansible_user_id != 'root' 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 - name: docker-compose
become: true become: true
pip: pip:
name: docker-compose name: docker-compose
executable: '{{pip_executable}}' executable: '{{pip_executable}}'
state: latest when: not china_mirror_pip
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
- name: docker-compose 国内 - name: docker-compose 国内
become: true become: true
pip: pip:
name: docker-compose name: docker-compose
executable: '{{pip_executable}}' executable: '{{pip_executable}}'
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/ extra_args: -i https://mirrors.aliyun.com/pypi/simple/
when: china_mirror_docker when: china_mirror_pip
- name: docker 配置 创建目录 - name: docker 配置 创建目录
become: true become: true
file: file:
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
- 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: pip
include_tasks: pip.yml
- name: docker - name: docker
include_tasks: docker.yml include_tasks: docker.yml
when: install_docker 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 @@ ...@@ -5,7 +5,7 @@
- name: yum - name: yum
become: true become: true
yum: 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 update_cache: yes
- name: open vm tools - name: open vm tools
become: true 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