How to Install Microsoft Edge in Debian-like systems with Ansible?

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

Microsoft Edge on Linux

Microsoft Edge is available in the following channels:

  • Stable Channel
  • Beta Channel - Major update every 4 weeks
  • Dev Channel - Updated weekly
  • Canary Channel - Updated daily

More information https://www.microsoftedgeinsider.com/en-us/download/

Ansible install Microsoft Edge in Debian-like systems

  • Add Microsoft Edge key => ansible.builtin.apt_key
  • Add Microsoft Edge repository => ansible.builtin.apt_repository
  • Update apt cache and install Microsoft Edge => ansible.builtin.apt

In order to install Microsoft Edge on a Debian-like system, we need to perform three different steps. The first step is to download the GPG signature key for the repository. You are going to use the ansible.builtin.apt_key Ansible module. This encrypted key verifies the genuinity of the packages and the repository and guarantees that the software is the same as Microsoft releases. The second step is to add the add Microsoft Edge repository to the distribution. It’s an extra website were apt, your distribution package manager looks like for software. You are going to use the ansible.builtin.apt_repository Ansible module. The third step is to update the apt cache for the available packages and install Microsoft Edge using the ansible.builtin.apt Ansible module.

Parameters

  • apt-key url string - URL
  • apt-key state string - present/absent
  • apt_repository repo string - repository
  • apt_repository state string - present/absent
  • apt name string - name or package-specific
  • apt state string - latest/present/absent
  • apt update_cache boolean - no/yes

For the ansible.builtin.apt_key Ansible module I’m going to use two parameters: “url” and “state”. The “url” parameter specifies the URL of the repository GPG signature key and the “state” verify that is present in our system after the execution. For the ansible.builtin.apt_repository Ansible module I’m going to use two parameters: “repo” and “state”. The “repo” parameter specifies the repository parameters and the “state” verify that is present in our system after the execution. For the ansible.builtin.apt Ansible module I’m going to use three parameters: “name”, “state”, and “update_cache”. The “name” parameter specifies the package name (Microsoft Edge in our use-case) and the “state” verify that is present in our system after the execution. Before installing the package the “update_cache” performs an update of the apt cache to ensure that the latest version of the package is going to be downloaded.

Join 50+ hours of courses in our exclusive community

Playbook

Let’s jump in a real-life Ansible Playbook to install Microsoft Edge in Debian-like systems.

code

  • install_microsoft_edge_debian.yml
---
- name: install Microsoft Edge
  hosts: all
  become: true
  tasks:
    - name: Install apt-transport-https
      ansible.builtin.apt:
        name: apt-transport-https
        state: latest
        update_cache: true
- name: Add apt signing key
      ansible.builtin.apt_key:
        url: "https://packages.microsoft.com/keys/microsoft.asc"
        state: present
- name: Add repository into sources list
      ansible.builtin.apt_repository:
        repo: deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main
        state: present
        filename: microsoft-edge
- name: Install microsoft-edge-stable
      ansible.builtin.apt:
        name: "microsoft-edge-stable"
        state: latest
        update_cache: true

execution

$ ansible-playbook -i ubuntu/inventory install\ edge/debian.yml

PLAY [install Microsoft Edge] *********************************************************************

TASK [Gathering Facts] ****************************************************************************
ok: [ubuntu.example.com]

TASK [Install apt-transport-https] ****************************************************************
ok: [ubuntu.example.com]

TASK [Add apt signing key] ************************************************************************
changed: [ubuntu.example.com]

TASK [Add repository into sources list] ***********************************************************
changed: [ubuntu.example.com]

TASK [Install microsoft-edge-stable] **************************************************************
changed: [ubuntu.example.com]

PLAY RECAP ****************************************************************************************
ubuntu.example.com         : ok=5    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

verification

$ ssh [email protected]
$ sudo su
root@ubuntu:/home/devops# apt-cache search microsoft-edge
microsoft-edge-beta - The web browser from Microsoft
microsoft-edge-dev - The web browser from Microsoft
microsoft-edge-stable - The web browser from Microsoft
root@ubuntu:/home/devops# apt-cache show microsoft-edge-stable
Package: microsoft-edge-stable
Priority: optional
Section: web
Installed-Size: 378122
Maintainer: Microsoft Edge for Linux Team <[email protected]>
Architecture: amd64
Version: 95.0.1020.40-1
Provides: www-browser
Depends: ca-certificates, fonts-liberation, libasound2 (>= 1.0.16), libatk-bridge2.0-0 (>= 2.5.3), libatk1.0-0 (>= 2.2.0), libatomic1 (>= 4.8), libatspi2.0-0 (>= 2.9.90), libc6 (>= 2.17), libcairo2 (>= 1.6.0), libcups2 (>= 1.6.0), libcurl3-gnutls | libcurl3-nss | libcurl4 | libcurl3, libdbus-1-3 (>= 1.5.12), libdrm2 (>= 2.4.38), libexpat1 (>= 2.0.1), libgbm1 (>= 8.1~0), libgcc1 (>= 1:3.0), libglib2.0-0 (>= 2.39.4), libgtk-3-0 (>= 3.9.10) | libgtk-4-1, libnspr4 (>= 2:4.9-2~), libnss3 (>= 2:3.22), libpango-1.0-0 (>= 1.14.0), libuuid1 (>= 2.16), libx11-6 (>= 2:1.4.99.1), libxcb1 (>= 1.9.2), libxcomposite1 (>= 1:0.4.4-1), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxkbcommon0 (>= 0.4.1), libxrandr2, libxshmfence1, wget, xdg-utils (>= 1.0.2)
Pre-Depends: dpkg (>= 1.14.0)
Recommends: libu2f-udev, libvulkan1
Filename: pool/main/m/microsoft-edge-stable/microsoft-edge-stable_95.0.1020.40-1_amd64.deb
Size: 115596848
MD5sum: c2f860b685aec9dcc4bc7fc62c74c934
SHA1: 49a9f94818cad81e8694eaf1570a11de92ac9fec
SHA256: c5d4965c2216803874bca1b03a354b887e1a468d3a494462f24eb1c7efc4c66a
SHA512: 687a3e8e547dc8f66f252f0afc9edf1dcc1aa01f4b3bf43a36c5971f3f2853dea8c5ed78a1a5f97e082f5342bf7bdd111d5c3ef69052c2c3d3689d05cc43b514
Description: The web browser from Microsoft
Microsoft Edge is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.
Description-md5: 5b904ee7bee9a072fea390fb6ed74471

Package: microsoft-edge-stable
Priority: optional
Section: web
Installed-Size: 378115
Maintainer: Microsoft Edge for Linux Team <[email protected]>
Architecture: amd64
Version: 95.0.1020.38-1
Provides: www-browser
Depends: ca-certificates, fonts-liberation, libasound2 (>= 1.0.16), libatk-bridge2.0-0 (>= 2.5.3), libatk1.0-0 (>= 2.2.0), libatomic1 (>= 4.8), libatspi2.0-0 (>= 2.9.90), libc6 (>= 2.17), libcairo2 (>= 1.6.0), libcups2 (>= 1.6.0), libcurl3-gnutls | libcurl3-nss | libcurl4 | libcurl3, libdbus-1-3 (>= 1.5.12), libdrm2 (>= 2.4.38), libexpat1 (>= 2.0.1), libgbm1 (>= 8.1~0), libgcc1 (>= 1:3.0), libglib2.0-0 (>= 2.39.4), libgtk-3-0 (>= 3.9.10) | libgtk-4-1, libnspr4 (>= 2:4.9-2~), libnss3 (>= 2:3.22), libpango-1.0-0 (>= 1.14.0), libuuid1 (>= 2.16), libx11-6 (>= 2:1.4.99.1), libxcb1 (>= 1.9.2), libxcomposite1 (>= 1:0.4.4-1), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxkbcommon0 (>= 0.4.1), libxrandr2, libxshmfence1, wget, xdg-utils (>= 1.0.2)
Pre-Depends: dpkg (>= 1.14.0)
Recommends: libu2f-udev, libvulkan1
Filename: pool/main/m/microsoft-edge-stable/microsoft-edge-stable_95.0.1020.38-1_amd64.deb
Size: 115540916
MD5sum: 23dfaa1940f354652112bf7ae3b30d7a
SHA1: 4060640128a97353c7ee492aca058a12ecb187b1
SHA256: a33b5aa228a015b44c7665df1e27560b515185fcefb6191adfd9b8c714489f41
SHA512: 896d9fc55331763f0db87065d63b67a02b861d429f18288dd3bbe01e51b7cb5315b59400489f1522ffa57d202db21f6df99f56666fec42fd6be1db054ce951be
Description: The web browser from Microsoft
Microsoft Edge is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.
Description-md5: 5b904ee7bee9a072fea390fb6ed74471

root@ubuntu:/home/devops# ls -al /etc/apt/sources.list.d/
total 20
drwxr-xr-x 2 root root 4096 Nov  1 07:06 .
drwxr-xr-x 7 root root 4096 Nov  1 07:06 ..
-rw-r--r-- 1 root root  265 Nov  1 07:06 microsoft-edge.list
root@ubuntu:/home/devops# cat /etc/apt/sources.list.d/microsoft-edge.list
# ## THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] https://packages.microsoft.com/repos/edge/ stable main
deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main
root@ubuntu:/home/devops# apt list microsoft-edge-stable
Listing... Done
microsoft-edge-stable/stable,now 95.0.1020.40-1 amd64 [installed]
N: There is 1 additional version. Please use the '-a' switch to see it
root@ubuntu:/home/devops# apt list microsoft-edge-stable -a
Listing... Done
microsoft-edge-stable/stable,now 95.0.1020.40-1 amd64 [installed]
microsoft-edge-stable/stable 95.0.1020.38-1 amd64

code with ❤️ in GitHub

Conclusion

Now you know how to install Microsoft Edge in Debian-like systems with Ansible. Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.

Academy

Learn the Ansible automation technology with some real-life examples in my Udemy 300+ Lessons Video Course.

BUY the Complete Udemy 300+ Lessons Video Course

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

BUY the Complete PDF BOOK to easily Copy and Paste the 250+ Ansible code

Want to keep this project going? Please donate

Patreon Buy me a Pizza