add darwin support to install homebrew deps
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
# Darwin (macOS)
|
||||||
|
|
||||||
|
Baseline macOS hosts through Homebrew. No-op on non-Darwin targets.
|
||||||
|
|
||||||
|
Configure in `inventory/host_vars/<host>/vars.yml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
darwin_homebrew_update: false # update formula metadata before installing
|
||||||
|
darwin_taps:
|
||||||
|
- anomalyco/tap
|
||||||
|
darwin_formulae:
|
||||||
|
- jq
|
||||||
|
- ripgrep
|
||||||
|
darwin_casks:
|
||||||
|
- iterm2
|
||||||
|
```
|
||||||
|
|
||||||
|
Casks install GUI apps; leave the list empty if you don't want them managed.
|
||||||
|
Requires the `community.general` collection (`homebrew`, `homebrew_tap`,
|
||||||
|
`homebrew_cask`). Must run as the Homebrew-owning user — never with `become`.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
# macOS baseline managed through Homebrew. No-op on non-Darwin hosts.
|
||||||
|
darwin_homebrew_update: false
|
||||||
|
darwin_taps: []
|
||||||
|
darwin_formulae: []
|
||||||
|
darwin_casks: []
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
author: Jokester <main@jokester.fr>
|
||||||
|
description: macOS baseline via Homebrew (taps, formulae, casks)
|
||||||
|
license: MIT
|
||||||
|
min_ansible_version: "2.15"
|
||||||
|
galaxy_tags:
|
||||||
|
- macos
|
||||||
|
- homebrew
|
||||||
|
platforms:
|
||||||
|
- name: MacOSX
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
dependencies: []
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
- name: Assert the target is macOS
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- ansible_facts['os_family'] == 'Darwin'
|
||||||
|
fail_msg: "The darwin role only supports macOS (ansible_os_family == 'Darwin')."
|
||||||
|
success_msg: "macOS target validated"
|
||||||
|
|
||||||
|
# Homebrew refuses to run as root: keep this role out of any become context.
|
||||||
|
- name: Update Homebrew metadata
|
||||||
|
community.general.homebrew:
|
||||||
|
update_homebrew: true
|
||||||
|
when: darwin_homebrew_update | bool
|
||||||
|
|
||||||
|
- name: Tap Homebrew repositories
|
||||||
|
community.general.homebrew_tap:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
loop: "{{ darwin_taps }}"
|
||||||
|
|
||||||
|
- name: Install Homebrew formulae
|
||||||
|
community.general.homebrew:
|
||||||
|
name: "{{ darwin_formulae }}"
|
||||||
|
state: present
|
||||||
|
when: darwin_formulae | length > 0
|
||||||
|
|
||||||
|
- name: Install Homebrew casks
|
||||||
|
community.general.homebrew_cask:
|
||||||
|
name: "{{ darwin_casks }}"
|
||||||
|
state: present
|
||||||
|
when: darwin_casks | length > 0
|
||||||
Reference in New Issue
Block a user