This repository has been archived on 2022-05-30. You can view files and clone it, but cannot push or open issues or pull requests.
autonomic.php/tasks/composer.yml

37 lines
962 B
YAML

---
- name: Check if Composer is installed
tags: composer
stat:
path: /usr/local/bin/composer
register: composer_bin
- block:
- name: Download Composer into tmp directory
get_url:
url: https://getcomposer.org/installer
dest: "{{ php_composer_install_file }}"
checksum: "{{ php_composer_checksum }}"
- name: Run Composer installer
command: "
php {{ php_composer_install_file }}
--install-dir=/usr/local/bin
--filename=composer
--version={{ php_composer_version }}
"
- name: Delete composer installer
file:
path: "{{ php_composer_install_file }}"
state: absent
tags: composer
when: not composer_bin.stat.exists
- name: Update composer if necessary
tags: composer
shell: composer selfupdate
register: composer_update_output
changed_when: "'Updating to version' in composer_update_output.stdout"
when: php_composer_update | bool