- name: Get Composer installer signature.
  uri:
    url: https://composer.github.io/installer.sig
    return_content: true
  register: composer_installer_signature

- name: Download Composer installer
  get_url:
    url: https://getcomposer.org/installer
    dest: /tmp/composer-installer.php
    mode: 0755
    checksum: "sha384:{{ composer_installer_signature.content }}"
  register: reg_composer_installer

- name: Run Composer installer
  command: >
    php72 composer-installer.php
    chdir=/tmp
  when:
    - reg_composer_installer | changed

- name: Move Composer into globally-accessible location.
  command: >
    mv -f /tmp/composer.phar {{ composer_path }}
    creates={{ composer_path }}
  when:
    - reg_composer_installer | changed

- name: Remove Nodesource repositories for Node.js
  yum:
    name: "nodesource-release"
    state: removed

- name: Add Nodesource repositories for Node.js
  yum:
    name: "https://rpm.nodesource.com/pub_12.x/el/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/nodesource-release-el{{ ansible_distribution_major_version }}-1.noarch.rpm"
    state: present

- name: Ensure Node.js and npm are installed
  yum:
    name: "nodejs-12*"
    state: present
    enablerepo: nodesource

- name: Get Composer installer signature.
  uri:
    url: https://composer.github.io/installer.sig
    return_content: true
  register: composer_installer_signature

- name: Download Composer installer
  get_url:
    url: https://getcomposer.org/installer
    dest: /tmp/composer-installer.php
    mode: 0755
    checksum: "sha384:{{ composer_installer_signature.content }}"
  register: reg_composer_installer

- name: Run Composer installer
  command: >
    php72 composer-installer.php
    chdir=/tmp
  when:
    - reg_composer_installer.changed | bool

- name: Move Composer into globally-accessible location.
  command: >
    mv -f /tmp/composer.phar {{ composer_path }}
    creates={{ composer_path }}
  when:
    - reg_composer_installer.changed | bool

- name: Remove Nodesource repositories for Node.js
  yum:
    name: "nodesource-release"
    state: removed

- name: Add Nodesource repositories for Node.js
  yum:
    name: "https://rpm.nodesource.com/pub_12.x/el/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/nodesource-release-el{{ ansible_distribution_major_version }}-1.noarch.rpm"
    state: present

- name: Ensure Node.js and npm are installed
  yum:
    name: "nodejs-12*"
    state: present
    enablerepo: nodesource

Change | changed filter to .changed for Ansible compatibility
EB: Change | changed filter to .changed  for Ansible compatibility
