75 lines
2.3 KiB
YAML
75 lines
2.3 KiB
YAML
---
|
|
|
|
- name: Check if requested version parameters are valid
|
|
fail:
|
|
msg: You cannot request a specific version AND keep the composer up to date.
|
|
Set either composer_version or composer_keep_updated, but not both.
|
|
when: composer_version != '' and composer_keep_updated
|
|
|
|
- name: Set php_executable variable to a default if not defined.
|
|
ansible.builtin.set_fact:
|
|
php_executable: php
|
|
when: php_executable is not defined
|
|
|
|
- name: Safe Directory
|
|
command: git config --global --add safe.directory {{ path_yealink_phonebook }}
|
|
check_mode: no
|
|
|
|
- name: Clone Phonebook generation script
|
|
ansible.builtin.git: # noqa: latest
|
|
repo: "{{ repo_phonebook }}"
|
|
dest: "{{ path_yealink_phonebook }}"
|
|
force: true
|
|
accept_hostkey: true
|
|
key_file: "{{ deploy_key_file }}"
|
|
|
|
- name: Change directory owner
|
|
ansible.builtin.file:
|
|
path: "{{ path_yealink_phonebook }}"
|
|
recurse: yes
|
|
owner: "{{ asterisk_user }}"
|
|
group: "{{ asterisk_group }}"
|
|
|
|
- name: Check if Composer is installed.
|
|
ansible.builtin.stat:
|
|
path: "{{ composer_path }}"
|
|
register: composer_bin
|
|
|
|
- name: Get Composer installer signature.
|
|
ansible.builtin.uri:
|
|
url: https://composer.github.io/installer.sig
|
|
return_content: true
|
|
check_mode: false
|
|
register: composer_installer_signature
|
|
when: not composer_bin.stat.exists
|
|
|
|
- name: Download Composer installer.
|
|
ansible.builtin.get_url:
|
|
url: https://getcomposer.org/installer
|
|
dest: /tmp/composer-installer.php
|
|
mode: "0755"
|
|
checksum: "sha384:{{ composer_installer_signature.content }}"
|
|
when: not composer_bin.stat.exists
|
|
|
|
- name: Run Composer installer.
|
|
ansible.builtin.command: >
|
|
{{ php_executable }} composer-installer.php {% if composer_version_branch %} {{ composer_version_branch }}{% elif composer_version %} --version={{ composer_version }}{% endif %}
|
|
chdir=/tmp
|
|
when: not composer_bin.stat.exists
|
|
become: true
|
|
become_user: asterisk
|
|
|
|
- name: Move Composer into globally-accessible location.
|
|
ansible.builtin.command: >
|
|
mv /tmp/composer.phar {{ composer_path }}
|
|
creates={{ composer_path }}
|
|
when: not composer_bin.stat.exists
|
|
|
|
- name: Install dependencies
|
|
community.general.composer:
|
|
command: update
|
|
composer_executable: "{{ composer_path }}"
|
|
working_dir: "{{ path_yealink_phonebook }}"
|
|
become: true
|
|
become_user: asterisk
|