Ansible Pilot

Install Zoom flatpak in RedHat-like systems - Ansible module flatpak

How to automate the installation of Zoom flatpak system-wide in RedHat-like systems using Ansible module flatpak.

How to install Zoom flatpak in RedHat-like systems with Ansible?

I’m going to show you a live demo with some simple Ansible code. I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible install Zoom flatpak in RedHat-like systems

Today we are going to talk about the Ansible module flatpak. The full name is community.general.flatpak, it’s part of community.general modules maintained by the Ansible Community. The purpose of the flatpak module is to Manage flatpaks in the target system.

Parameters

Let me summarize the parameters of flatpak module. The only required is “name”, where you specify the flatpak name to install or remove. The parameter “state” specifies if you would like to perform the install action (“present” option) or the remove action (“absent” option). The parameter “method” specifies if you would like to install the flatpak system-wide (default) or only for the current user. The following parameters are more for advanced users. For example specify a different source with remote parameter other than the default “flathub”; not install the dependency “no_dependencies” parameter or if the executable is different than the usual flatpak.

demo

How to install Zoom flatpak in RedHat-like systems with Ansible Playbook.

code

---
- name: flatpak module demo
  hosts: all
  become: true
  gather_facts: false
  tasks:
    - name: flatpak present
      ansible.builtin.yum:
        name: flatpak
        state: present
    - name: flathub flatpak repo
      community.general.flatpak_remote:
        name: flathub
        state: present
        flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo
        method: system
    - name: install Zoom via flatpak
      community.general.flatpak:
        name: us.zoom.Zoom
        state: present
        method: system

execution

ansible-pilot $ ansible-playbook -i virtualmachines/fedora35/inventory container/flatpak_redhat.yml
PLAY [flatpak module demo] ************************************************************************
TASK [flatpak present] ****************************************************************************
changed: [fedora.example.com]
TASK [flathub flatpak repo] ***********************************************************************
changed: [fedora.example.com]
TASK [install Zoom via flatpak] *******************************************************************
changed: [fedora.example.com]
PLAY RECAP ****************************************************************************************
fedora.example.com         : ok=3    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
ansible-pilot $

idempotency

ansible-pilot $ ansible-playbook -i virtualmachines/fedora35/inventory container/flatpak_redhat.yml
PLAY [flatpak module demo] ************************************************************************
TASK [flatpak present] ****************************************************************************
ok: [fedora.example.com]
TASK [flathub flatpak repo] ***********************************************************************
ok: [fedora.example.com]
TASK [install Zoom via flatpak] *******************************************************************
ok: [fedora.example.com]
PLAY RECAP ****************************************************************************************
fedora.example.com         : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
ansible-pilot $

before execution

ansible-pilot $ ssh [email protected]
[[email protected] ~]$ cat /etc/os-release
NAME="Fedora Linux"
VERSION="35 (Cloud Edition)"
ID=fedora
VERSION_ID=35
VERSION_CODENAME=""
PLATFORM_ID="platform:f35"
PRETTY_NAME="Fedora Linux 35 (Cloud Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:35"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f35/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=35
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=35
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Cloud Edition"
VARIANT_ID=cloud
[[email protected] ~]$ flatpak list
-bash: flatpak: command not found
[[email protected] ~]$ flatpak remotes
-bash: flatpak: command not found
[[email protected] ~]$ rpm -qa | grep flatpak

after execution

ansible-pilot $ ssh [email protected]
[[email protected] ~]$ flatpak list
Name                   Application ID                        Version      Branch   Installation
Freedesktop Platform   org.freedesktop.Platform              21.08.11     21.08    system
Mesa                   org.freedesktop.Platform.GL.default   21.3.6       21.08    system
openh264               org.freedesktop.Platform.openh264     2.1.0        2.0      system
Zoom                   us.zoom.Zoom                          5.9.6.2225   stable   system
[[email protected] ~]$ flatpak remotes
Name    Options
flathub system
[[email protected] ~]$

code with ❤️ in GitHub

Recap

Now you know how to install Zoom flatpak in RedHat-like systems with Ansible. Subscribe to the YouTube channel, Medium, Website and Twitter to not miss the next episode of the Ansible Pilot.

Academy

Learn the Ansible automation technology with some real-life examples in my

My book Ansible By Examples: 100+ Automation Examples For Linux and Windows System Administrator and DevOps

Want to keep this project going? Please donate

Trustpilot
Follow me

Subscribe not to miss any new releases

March 2, 2022

FREE Top 10 Best Practices

Top 10 Best Practices of Ansible Automation: save time, reduce errors and stress