---
- name: Upgrade all packages
  yum:
    name: '*'
    state: latest
  become: yes

---
- name: Upgrade all packages
  yum:
    name: '*'
    state: latest
  become_user: "{{ ansible_user_id }}"

Change become to become_user for same user
Change become to become_user for same user
