---

- name: check if Atom is installed?
  command: "dnf list installed | grep atom | grep {{ atom.version }}"
  register: current_version
  changed_when: false
  ignore_errors: true
  args:
    warn: no

- debug:
    msg: "current_version : {{ current_version.stdout }}"

- block:

  - name : unistall older version
    package:
      name: atom
      state: absent

  - name: install the atom packages
    package:
      name: {{ item }}
      state: present
    with_items:
      - "{{ atom.url_rpm}}"
    become: yes

  when: current_version.stdout | version_compare(atom.version, '>')

---

- name: check if Atom is installed?
  command: "dnf list installed atom"
  register: current_version
  changed_when: false
  ignore_errors: true
  args:
    warn: no

- debug:
    msg: "current_version : {{ current_version.stdout }}"

- block:

  - name : unistall older version
    package:
      name: atom
      state: absent
    become: yes

  - name: install the atom packages
    package:
      name: "{{ item }}"
      state: present
    with_items:
      - "{{ atom.url_rpm}}"
    become: yes

  when: current_version.stdout == "" or current_version.stdout | version_compare(atom.version, '>')

FIX : atom - command modified as grep with multiple pipelines not working + quotes missing on item variable + when's condition modified as version_compare not accepting empty values
[LAI] FIX : atom - command modified as grep with multiple pipelines not working + quotes missing on item variable + when's condition modified as version_compare not accepting empty values
