Skip to content

Commit

Permalink
feat: 修改安装包下载逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
daixijun committed Jan 4, 2020
1 parent 60aca05 commit fb941b1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__pycache__/
files/php-7.3.13.tar.gz
Empty file added files/.gitkeep
Empty file.
14 changes: 0 additions & 14 deletions molecule/default/Dockerfile.j2

This file was deleted.

22 changes: 0 additions & 22 deletions molecule/default/INSTALL.rst

This file was deleted.

2 changes: 1 addition & 1 deletion molecule/default/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
hosts: all
roles:
- role: daixijun.php
php_version: 7.3.9
php_version: 7.3.13
# php_force_install: true
27 changes: 23 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,34 @@
tags:
- skip_ansible_lint

- name: Unarchive php-{{ php_version }} source from remote
- name: Check php package is already exists
stat:
path: "{{ role_path }}/files/{{ php_download_url | basename }}"
become: false
run_once: true
delegate_to: localhost
register: _php_package_stat

- name: Download php package
get_url:
url: "{{ php_download_url }}"
dest: "{{ role_path }}/files/"
become: false
run_once: true
delegate_to: localhost
when:
- not _php_package_stat.stat.exists
register: _php_package

- name: Unarchive php-{{ php_version }}
unarchive:
src: "{{ php_download_url }}"
src: "files/{{ php_download_url | basename }}"
dest: /usr/local/src/
creates: /usr/local/src/php-{{ php_version }}
remote_src: "{{ php_remote_src }}"
remote_src: false
register: php_unarchive
when:
- php_force_install|bool or not php_installed_stat.stat.exists
- php_force_install|bool or _php_package is not skipped or (_php_package_stat.stat.exists and not php_installed_stat.stat.exists)

- name: Compile and Install
shell: "{{ php_build_parameters }}"
Expand Down

0 comments on commit fb941b1

Please sign in to comment.