Added check if homebrew exists and path as variable

This commit is contained in:
Raphael Werner 2025-05-03 20:10:14 +02:00
parent 055e077e95
commit 3faa5f5d34
2 changed files with 32 additions and 21 deletions

View file

@ -1,17 +1,25 @@
--- ---
# tasks file for homebrewInstall # tasks file for homebrewInstall
- name: "Check if homebrew is installed"
ansible.builtin.stat:
path: "{{ homebrewinstall_path }}"
register: path_check
- name: "Install Homebrew"
when: not path_check.stat.exists
block:
- name: "Create Folder linuxbrew" - name: "Create Folder linuxbrew"
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "/home/linuxbrew" path: "{{ homebrewinstall_home }}/linuxbrew"
state: directory state: directory
mode: '0755' mode: '0755'
- name: "Create Folder .linuxbrew" - name: "Create Folder .linuxbrew"
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "/home/linuxbrew/.linuxbrew" path: "{{ homebrewinstall_home }}/linuxbrew/.linuxbrew"
state: directory state: directory
mode: '0755' mode: '0755'
owner: "{{ ansible_env.USER }}" owner: "{{ ansible_env.USER }}"

View file

@ -53,4 +53,7 @@
- name: "Install Homebrew" - name: "Install Homebrew"
ansible.builtin.include_role: ansible.builtin.include_role:
name: homebrewInstall name: homebrewinstall
vars:
homebrewinstall_home: "/var/home"
homebrewinstall_path: "/home/linuxbrew/.linuxbrew/bin/brew"