From 0f09bb0691ffad52c58d210cf71faa9ef0d1247d Mon Sep 17 00:00:00 2001 From: Gitea Date: Tue, 19 Jan 2021 10:27:34 +0800 Subject: [PATCH] update --- roles/game_py38.yml | 9 +++++++ roles/game_pytho38/files/Python-3.8.6.tgz | 3 +++ roles/game_pytho38/files/pip.conf | 3 +++ roles/game_pytho38/tasks/install.yml | 33 +++++++++++++++++++++++ roles/game_pytho38/tasks/install_pkg.yml | 6 +++++ roles/game_pytho38/tasks/main.yml | 14 ++++++++++ roles/game_pytho38/tasks/setpip.yml | 5 ++++ 7 files changed, 73 insertions(+) create mode 100644 roles/game_py38.yml create mode 100644 roles/game_pytho38/files/Python-3.8.6.tgz create mode 100644 roles/game_pytho38/files/pip.conf create mode 100644 roles/game_pytho38/tasks/install.yml create mode 100644 roles/game_pytho38/tasks/install_pkg.yml create mode 100644 roles/game_pytho38/tasks/main.yml create mode 100644 roles/game_pytho38/tasks/setpip.yml diff --git a/roles/game_py38.yml b/roles/game_py38.yml new file mode 100644 index 0000000..7194185 --- /dev/null +++ b/roles/game_py38.yml @@ -0,0 +1,9 @@ +--- + +- hosts: dev + gather_facts: false + remote_user: root + roles: + - dependencies + - openssh + - python diff --git a/roles/game_pytho38/files/Python-3.8.6.tgz b/roles/game_pytho38/files/Python-3.8.6.tgz new file mode 100644 index 0000000..4e5467e --- /dev/null +++ b/roles/game_pytho38/files/Python-3.8.6.tgz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:313562ee9986dc369cd678011bdfd9800ef62fbf7b1496228a18f86b36428c21 +size 24377280 diff --git a/roles/game_pytho38/files/pip.conf b/roles/game_pytho38/files/pip.conf new file mode 100644 index 0000000..1da561c --- /dev/null +++ b/roles/game_pytho38/files/pip.conf @@ -0,0 +1,3 @@ +[global] +index-url = https://pypi.douban.com/simple +trusted-host = pypi.douban.com diff --git a/roles/game_pytho38/tasks/install.yml b/roles/game_pytho38/tasks/install.yml new file mode 100644 index 0000000..2f9663a --- /dev/null +++ b/roles/game_pytho38/tasks/install.yml @@ -0,0 +1,33 @@ +--- + +- name: 创建下载目录 + file: + path: /data/xdata_software + state: directory + +- name: 解压缩 + unarchive: + src: Python-3.8.6.tgz + dest: /data/xdata_software + +- name: 设置编译 + shell: + chdir: /data/xdata_software/Python-3.8.6 + cmd: ./configure --prefix=/usr/local/python3 --enable-optimizations --with-openssl=/usr/local/openssl + +- name: 编译安装 + shell: + chdir: /data/xdata_software/Python-3.8.6 + cmd: make && make install + +- name: python3软连接 + file: + src: /usr/local/python3/bin/python3 + dest: /usr/local/bin/python3 + state: link + +- name: pip3软连接 + file: + src: /usr/local/python3/bin/pip3 + dest: /usr/local/bin/pip3 + state: link \ No newline at end of file diff --git a/roles/game_pytho38/tasks/install_pkg.yml b/roles/game_pytho38/tasks/install_pkg.yml new file mode 100644 index 0000000..249eb86 --- /dev/null +++ b/roles/game_pytho38/tasks/install_pkg.yml @@ -0,0 +1,6 @@ +--- +- name: 安装pymongo + shell: + chdir: ~ + cmd: pip3 install pymongo==3.11.1 + diff --git a/roles/game_pytho38/tasks/main.yml b/roles/game_pytho38/tasks/main.yml new file mode 100644 index 0000000..5135b95 --- /dev/null +++ b/roles/game_pytho38/tasks/main.yml @@ -0,0 +1,14 @@ +--- + +- name: 检查Python安装 + stat: + path: /usr/local/python3 + register: python3_stat_result + +- name: 安装Python3 + include: install.yml + when: not python3_stat_result.stat.exists + + +- name: 安装必须的Python包 + include: install_pkg.yml diff --git a/roles/game_pytho38/tasks/setpip.yml b/roles/game_pytho38/tasks/setpip.yml new file mode 100644 index 0000000..8bb9f68 --- /dev/null +++ b/roles/game_pytho38/tasks/setpip.yml @@ -0,0 +1,5 @@ +--- +- name: 设置pip源 + copy: + src: pip.conf + dest: /root/.pip/pip.conf