Added check if homebrew exists and path as variable
This commit is contained in:
parent
055e077e95
commit
3faa5f5d34
2 changed files with 32 additions and 21 deletions
|
|
@ -1,23 +1,31 @@
|
||||||
---
|
---
|
||||||
# tasks file for homebrewInstall
|
# tasks file for homebrewInstall
|
||||||
|
|
||||||
- name: "Create Folder linuxbrew"
|
- 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"
|
||||||
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 }}"
|
||||||
group: "{{ ansible_env.USER }}"
|
group: "{{ ansible_env.USER }}"
|
||||||
|
|
||||||
- name: "Install Homebrew"
|
- name: "Install Homebrew"
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: 'set -o pipefail && yes | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
|
cmd: 'set -o pipefail && yes | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue