Skip to content

Commit

Permalink
unixPb: Add role to install intel homebrew for arm64 macs (#3185)
Browse files Browse the repository at this point in the history
* add intel homebrew install for m1 macs

* remove spaces

* add brew path to brew ansible modules

* change formatting of module parameters

* typo

* remove debug tasks

* add comment

* specify homebrew path

* correct conditions

* remove intel homebrew, uninstall libpng

* add adoptopenjdk tag to libpng uninstall
  • Loading branch information
Haroon-Khel committed Nov 6, 2023
1 parent 1cfca8a commit bc2a40a
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

- name: Set homebrew path (x64)
set_fact:
homebrew_path: /usr/local/bin/brew
homebrew_path: /usr/local/bin
when: ansible_architecture == "x86_64"

- name: Set homebrew path (Arm64)
set_fact:
homebrew_path: /opt/homebrew/bin/brew
homebrew_path: /opt/homebrew/bin
when: ansible_architecture == "arm64"

- name: Configure system-wide Bash profile
Expand Down Expand Up @@ -67,7 +67,7 @@

- name: Check if Homebrew is already installed
stat:
path: "{{ homebrew_path }}"
path: "{{ homebrew_path }}/brew"
register: brew

- name: Install Homebrew
Expand All @@ -81,6 +81,7 @@
become_user: "{{ ansible_user }}"
homebrew:
upgrade_all: yes
path: "{{ homebrew_path }}"
when: "macos_version_number is version('10.15', '>')"
tags:
- brew_upgrade
Expand All @@ -90,6 +91,7 @@
become_user: "{{ ansible_user }}"
homebrew_tap:
name: buo/cask-upgrade
path: "{{ homebrew_path }}"
tags:
- brew_cu

Expand All @@ -98,27 +100,34 @@
become_user: "{{ ansible_user }}"
homebrew_tap:
name: AdoptOpenJDK/openjdk
path: "{{ homebrew_path }}"

# Skipping linting as no situation where this can't run (lint error 301)
- name: Update Casks
become: yes
become_user: "{{ ansible_user }}"
command: "{{ homebrew_path }} cu -y"
command: "{{ homebrew_path }}/brew cu -y"
tags:
- brew_cu
- skip_ansible_lint

- name: Install Build Tool Packages
become: yes
become_user: "{{ ansible_user }}"
homebrew: "name={{ item }} state=present"
homebrew:
name: "{{ item }}"
state: present
path: "{{ homebrew_path }}"
with_items: "{{ Build_Tool_Packages }}"
tags: build_tools

- name: Install Build Tool Packages NOT macOS 10.12
become: yes
become_user: "{{ ansible_user }}"
homebrew: "name={{ item }} state=present"
homebrew:
name: "{{ item }}"
state: present
path: "{{ homebrew_path }}"
with_items: "{{ Build_Tool_Packages_NOT_10_12 }}"
when:
- not (macos_version_number | regex_search("10.12"))
Expand All @@ -127,21 +136,30 @@
- name: Install Build Tool Casks
become: yes
become_user: "{{ ansible_user }}"
homebrew_cask: "name={{ item }} state=present"
homebrew_cask:
name: "{{ item }}"
state: present
path: "{{ homebrew_path }}"
with_items: "{{ Build_Tool_Casks }}"
tags: build_tools

- name: Install Test Tool Packages
become: yes
become_user: "{{ ansible_user }}"
homebrew: "name={{ item }} state=present"
homebrew:
name: "{{ item }}"
state: present
path: "{{ homebrew_path }}"
with_items: "{{ Test_Tool_Packages }}"
tags: test_tools

- name: Install JCK Tool Casks
become: yes
become_user: "{{ ansible_user }}"
homebrew_cask: "name={{ item }} state=present"
homebrew_cask:
name: "{{ item }}"
state: present
path: "{{ homebrew_path }}"
with_items: "{{ JCK_Tool_Casks }}"
tags: jck_tools

Expand All @@ -162,6 +180,15 @@
when: not pdfwriter.stat.exists
tags: jck_tools

- name: Uninstall libpng
become: yes
become_user: "{{ ansible_user }}"
homebrew:
name: libpng
state: absent
path: "{{ homebrew_path }}"
tags: adoptopenjdk

# As per https://github.com/eclipse/openj9/issues/3790
- name: Creating /etc/sysctl.conf for kernel tunings
file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,22 @@
########################################
# Install Nagios dependencies packages #
########################################

- name: Set Mac homebrew path (x64)
set_fact:
homebrew_path: /usr/local/bin
when: ansible_architecture == "x86_64"

- name: Set Mac homebrew path (Arm64)
set_fact:
homebrew_path: /opt/homebrew/bin
when: ansible_architecture == "arm64"

- name: Install additional packages used by Nagios
homebrew: "name={{ item }} state=present"
homebrew:
name: "{{ item }}"
state: present
path: "{{ homebrew_path }}"
become: yes
become_user: "{{ ansible_user }}"
with_items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
Ensure that Apple_ID_User, Apple_ID_Password and FASTLANE_SESSION are defined. Skipping Xcode installation"
when: apple_variables is not defined

- name: Set Mac homebrew path (x64)
set_fact:
homebrew_path: /usr/local/bin
when: ansible_architecture == "x86_64"

- name: Set Mac homebrew path (Arm64)
set_fact:
homebrew_path: /opt/homebrew/bin
when: ansible_architecture == "arm64"

- name: Install Xcode
when: apple_variables is defined
block:
Expand All @@ -29,6 +39,7 @@
homebrew:
name: ruby@2.7 # no 3.0 yet for fastlane (https://github.com/fastlane/fastlane/issues/17931)
state: present
path: "{{ homebrew_path }}"

- name: Configure Bash profile extension for Ruby
become: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@
curl_latest: 7.79.1
tags: curl

- name: Set Mac homebrew path (x64)
set_fact:
homebrew_path: /usr/local/bin
when: ansible_distribution == "MacOSX" and ansible_architecture == "x86_64"

- name: Set Mac homebrew path (Arm64)
set_fact:
homebrew_path: /opt/homebrew/bin
when: ansible_distribution == "MacOSX" and ansible_architecture == "arm64"

- name: Download curl {{ curl_latest }}
get_url:
url: https://github.com/curl/curl/releases/download/curl-7_79_1/curl-{{ curl_latest }}.tar.gz
Expand Down Expand Up @@ -114,6 +124,7 @@
homebrew:
name: curl
state: latest
path: "{{ homebrew_path }}"
when:
- ansible_distribution == "MacOSX"
- "macos_version_number is version('10.13', '>')"
Expand Down

0 comments on commit bc2a40a

Please sign in to comment.