---
- name: Upgrade the system
  sudo: yes
  yum:
    name: "*"
    state: latest
  when: essentials["upgrade"]  
    
- name: Ensure essentials packages are present using apt
  sudo: yes
  apt:
    name: "{{ item }}"
    state: present
  with_items: essentials["packages"]

---
- name: Upgrade the system
  sudo: yes
  yum:
    name: "*"
    state: latest
  when: essentials["upgrade"]  
    
- name: Ensure essentials packages are present using yum
  sudo: yes
  yum:
    name: "{{ item }}"
    state: present
  with_items: essentials["packages"]

Fix module to download yum packages
Fix module to download yum packages
