- name: Add repository
  ansible.builtin.yum_repository:
    name: "{{ item.name }}"
    description: "Ansible repositories"
    baseurl: "{{ item.baseurl }}"
    async: yes
    gpgkey: "{{ item.gpgkey }}"
  with_items:  "{{ required_repository }}"     

- name: Update packages
  yum: 
    name: '*'
    state: latest
    update_cache: yes
    update_only: yes
  retries: 3
  delay: 10  

- name: Remove packates not needed anymore
  yum:
    autoremove: yes   
  retries: 3
  delay: 10

- name: Install required packages
  yum: 
    state: latest 
    update_cache: yes
    pkg: "{{ item }}"
  with_items:  "{{ required_packages }}" 
  retries: 3
  delay: 10    

- name: configure flatpak
  community.general.flatpak_remote:
    name: flathub
    state: present
    flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo

- name: install flatpak
  become_user: user
  community.general.flatpak:
    name: "{{ item }}"
  with_items:  "{{ required_flatpak_packages }}"     

- name: download fedora files
  ansible.builtin.get_url:
    url: "{{ item.url }}"
    dest: "/temp/{{ item.name }}"
    mode: '0777'
  with_items:  "{{ required_manual_packages }}"   

#wget https://dl.fedoraproject.org/pub/fedora/linux/releases/36/Everything/x86_64/os/Packages/h/helm-3.5.4-2.fc35.x86_64.rpm -O helm.rpm
#rpmrebuild helm.rpm
#yum install helm.rpm
       