---
- name: Update the system to the latest updates
  command: yum update -y

# Redhat/CentOS/Amazon common packages
- name: Ensure common packages are installed
  yum:  name={{ item }} state=present
  with_items: "{{ amazon_common_packages }}"

# Redhat/CentOS specific packages
- name: Ensure RHEL/CentOS specific packages are installed
  yum:  name={{ item }} state=present
  with_items: "{{ rhel_common_packages }}"

---
- name: Update the system to the latest updates
  command: yum update -y

# Redhat/CentOS/Amazon common packages
- name: Ensure common packages are installed
  yum:  name={{ item }} state=present
  with_items: "{{ amazon_common_packages }}"

# Redhat/CentOS specific packages
- name: Ensure RHEL/CentOS specific packages are installed
  yum:  name={{ item }} state=present
  with_items: "{{ rhel_common_packages }}"
  when: ansible_distribution == "CentOS" or ansible_distribution == "Red Hat Enterprise Linux"

Update logic for RHEL/CentOS vs Amazon Linux
Update logic for RHEL/CentOS vs Amazon Linux
