---
# tasks file for composer
- name: install
  shell: "curl -sS https://getcomposer.org/installer | php -- --install-dir={{ composer_install_dir }}"
  args:
    creates: "{{ composer_install_dir }}/composer"
  tags: [configuration, composer, composer-install]

- name: rename - composer.phar -> composer
  command: "mv {{ composer_install_dir }}/composer.phar {{ composer_install_dir }}/composer"
  args:
    creates: "{{ composer_install_dir }}/composer"
  tags: [configuration, composer, composer-move]

- name: check permissions
  file:
    path: "{{ composer_install_dir }}/composer"
    owner: root
    group: root
    mode: 0755
  tags: [configuration, composer, composer-permissions]

- name: update to the latest version
  command: "{{ composer_install_dir }}/composer self-update"
  register: composer_self_update
  changed_when: "'Updating to version' in composer_self_update.stdout"
  when: composer_self_update
  tags: [configuration, composer, composer-self-update]

---
# tasks file for composer
- name: install
  shell: "curl -sS https://getcomposer.org/installer | php -- --install-dir={{ composer_install_dir }}"
  args:
    creates: "{{ composer_install_dir }}/composer"
  tags: [configuration, composer, composer-install]

- name: rename - composer.phar -> composer
  command: "mv {{ composer_install_dir }}/composer.phar {{ composer_install_dir }}/composer"
  args:
    creates: "{{ composer_install_dir }}/composer"
  tags: [configuration, composer, composer-move]

- name: check permissions
  file:
    path: "{{ composer_install_dir }}/composer"
    owner: root
    group: root
    mode: 0755
  tags: [configuration, composer, composer-permissions]

- name: update to the latest version
  command: "{{ composer_install_dir }}/composer self-update"
  register: composer_self_update
  changed_when: "'Updating to version' in composer_self_update.stderr"
  when: composer_self_update
  tags: [configuration, composer, composer-self-update]

Check stderr instead of stdout
Check stderr instead of stdout

Fixes #7
