This playbook automates the installation of tools and applications on MacOS using Homebrew and Homebrew Cask. It performs the following tasks:
Install MacOS tools: Installs the command line tools listed in the loop using the Homebrew module.
Create ~/.zshrc file: Creates the ~/.zshrc file using the touch command.
Add alias to kubectl: Adds an alias k to the kubectl command in the ~/.zshrc file using the lineinfile module.
Install MacOs tools with cask: Installs GUI applications listed in the loop using the homebrew_cask module.
You can customise the list of tools and applications by modifying the loop elements. Make sure you have Homebrew and Homebrew Cask installed on your system before running this playbook.
Disclaimer: This script has been tested on MacOS Sonoma on Intel.
- Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install Ansible
sudo pip3 install ansible
- Apply the configuration
ansible-playbook macos-tools/macos.yml --ask-become-pass
You must have root privileges to install applications.