summaryrefslogtreecommitdiffstats
path: root/roles/homebrew/tasks
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-08-19 23:55:38 +0200
committerAhmed Abdelhalim <[email protected]>2025-08-20 00:07:39 +0200
commitf9b1434299720b009f00477c3b7e880c1f47765e (patch)
treef41019c242addad509bd9dda87a224829d217f21 /roles/homebrew/tasks
parentc9910eac758ae62b09c98d0dde788c2c84e1f2aa (diff)
Add homebrew role
Diffstat (limited to 'roles/homebrew/tasks')
-rw-r--r--roles/homebrew/tasks/main.yml40
1 files changed, 40 insertions, 0 deletions
diff --git a/roles/homebrew/tasks/main.yml b/roles/homebrew/tasks/main.yml
new file mode 100644
index 00000000..81e9dbe3
--- /dev/null
+++ b/roles/homebrew/tasks/main.yml
@@ -0,0 +1,40 @@
+---
+- name: "Include OS-specific variables"
+ ansible.builtin.include_vars: "{{ ansible_os_family | lower }}.yml"
+
+- name: "Install homebrew dependencies"
+ become: true
+ ansible.builtin.package:
+ name: "{{ item }}"
+ state: "present"
+ with_items: "{{ homebrew_dependencies }}"
+
+- name: "Create linuxbrew directory"
+ become: true
+ ansible.builtin.file:
+ path: "/home/linuxbrew"
+ state: directory
+ owner: "{{ ansible_user_id }}"
+ group: "{{ ansible_user_id }}"
+ mode: "0755"
+
+- name: "Download homebrew installer"
+ ansible.builtin.get_url:
+ url: "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"
+ dest: "/tmp/install_homebrew.sh"
+ mode: "0755"
+
+- name: "Run homebrew installer"
+ ansible.builtin.command:
+ cmd: "/tmp/install_homebrew.sh"
+ args:
+ creates: "/home/linuxbrew/.linuxbrew/bin/brew"
+ environment:
+ NONINTERACTIVE: "1"
+
+- name: "Add homebrew to shell profile"
+ ansible.builtin.lineinfile:
+ path: "{{ ansible_env.HOME }}/.bashrc"
+ line: 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"'
+ create: true
+ mode: "0644"