• 1 Post
  • 51 Comments
Joined 1 year ago
cake
Cake day: June 13th, 2023

help-circle




  • I distinctly remember yum/dnf should be using a loop. Forget why but it’s recommended. Here’s a snippet from my playbook. Simply make the vars as you need and run.

      - name: Install flathub as remote
        ansible.builtin.shell:
          cmd: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
        tags:
          - apps
    
      - name: Install flatpak apps
        community.general.flatpak:
          name: "{{ item }}"
          state: present
        loop: "{{ flatpaks }}"
        tags:
          - apps
    
      - name: Remove some default unused packages
        ansible.builtin.dnf:
          name: "{{ item }}"
          state: absent
          update_cache: no
        loop: "{{ remove }}"
        ignore_errors: true
        tags:
          - apps
    
      - name: Install our packages
        ansible.builtin.dnf:
          name: "{{ item }}"
          state: present
          update_cache: yes
        loop: "{{ rpms }}"
        ignore_errors: true
        tags:
          - apps```
    
    On mobile. Apologies if formatting is off.