Ansible Pilot

Install Visual Studio Code for Mac Universal (Intel Chip and Apple Silicon) - Manual, Homebrew and Ansible

Three ways to install Visual Studio Code for Mac Universal in a MacBook Pro Apple Silicon M1Pro: Manual, Homebrew, and Ansible using community.general.homebrew Ansible module.

September 27, 2022
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

Visual Studio Code

Visual Studio Code is an excellent Free and Built Open Source IDE that speeds up any software development nowadays. It runs everywhere. The main four feature are:

Manual way

Manually download and install from the official website https://code.visualstudio.com/.

Install Visual Studio Code Manual way

Homebrew way

Using the Homebrew package manager, you can easily search and install the visual-studio-code package.

Install Visual Studio Code Homebrew way

Ansible way

Using Ansible, you can quickly deploy an Ansible Playbook to install the visual-studio-code package via Homebrew.

The Best Resources For Ansible

Video Course

Books

code

---
- name: install Visual Studio Code Mac Universal
  hosts: all
  tasks:
    - name: install visual-studio-code
      community.general.homebrew:
        name: visual-studio-code
        state: latest
        update_homebrew: true
localhost ansible_connection=local

execution

There is currently a bug in the module report, but it successfully installs Visual Studio Code.

[email protected] macos % ansible-playbook -i inventory install-visualstudiocode.yml
PLAY [install Visual Studio Code Mac Universal] ***************************************
TASK [Gathering Facts] ****************************************************************
[WARNING]: Platform darwin on host localhost is using the discovered Python
interpreter at /opt/homebrew/bin/python3.10, but future installation of another Python
interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-
core/2.13/reference_appendices/interpreter_discovery.html for more information.
ok: [localhost]
TASK [community.general.homebrew] *****************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": ""}
PLAY RECAP ****************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
[email protected] macos %

Install Visual Studio Code Ansible way

idempotency

[email protected] macos % ansible-playbook -i inventory install-visualstudiocode.yml
PLAY [install Visual Studio Code Mac Universal] ***************************************
TASK [Gathering Facts] ****************************************************************
[WARNING]: Platform darwin on host localhost is using the discovered Python
interpreter at /opt/homebrew/bin/python3.10, but future installation of another Python
interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-
core/2.13/reference_appendices/interpreter_discovery.html for more information.
ok: [localhost]
TASK [community.general.homebrew] *****************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Warning: Cask 'visual-studio-code' is already installed.\n\nTo re-install visual-studio-code, run:\n  brew reinstall --cask visual-studio-code"}
PLAY RECAP ****************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
[email protected] macos %

Recap

Now you know three ways to install and maintain up-to-date Visual Studio Code for Mac Universal (Intel Chip and Apple Silicon): Manual, Homebrew and Ansible.

Subscribe to the YouTube channel, Medium, Website, Twitter, and Substack 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: 200+ Automation Examples For Linux and Windows System Administrator and DevOps

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

Want to keep this project going? Please donate

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons
Trustpilot
Follow me

Subscribe not to miss any new releases

FREE Top 10 Best Practices

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