--- - name: Install configured globally-required packages. command: > {{ composer_path }} global require {{ item.name }}:{{ item.release | default('@stable') }} --no-progress creates={{ composer_home_path }}/vendor/{{ item.name }} environment: COMPOSER_HOME: "{{ composer_home_path }}" become: yes become_user: "{{ composer_home_owner }}" register: composer_global_require_result with_items: "{{ composer_global_packages }}" - name: Add composer_home_path bin directory to global $PATH. template: src: composer.sh.j2 dest: /etc/profile.d/composer.sh mode: 0644 when: composer_add_to_path