Skip to content

Commit

Permalink
handle multiple architectures per OS
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Nov 24, 2021
1 parent aba01d8 commit dc7a902
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 23 deletions.
2 changes: 1 addition & 1 deletion base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- name: install Homebrew
command: ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
args:
creates: /usr/local/bin/brew
creates: "{{ homebrew_prefix[ansible_architecture] }}/bin/brew"
tags:
- packages

Expand Down
3 changes: 3 additions & 0 deletions group_vars/os_Darwin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
protoc_os: osx
user_font_dir: "{{ ansible_env.HOME }}/Library/Fonts"
homebrew_prefix:
x86_64: "/usr/local"
arm64: "/opt/homebrew"
44 changes: 33 additions & 11 deletions roles/developer/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
---
golang_version: "1.17.1"
golang_version: "1.17.3"
golang_checksums:
Darwin: "sha256:3c452046b1dfa27b70d3217c9fe6de266f9fd74d83aad81382fead70efcdffca"
Linux: "sha256:dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef"
golang_pkg: "go{{ golang_version }}.{{ ansible_system | lower }}-amd64.tar.gz"
arm64:
Darwin: "sha256:ffe45ef267271b9681ca96ca9b0eb9b8598dd82f7bb95b27af3eef2461dc3d2c"
Linux: "sha256:06f505c8d27203f78706ad04e47050b49092f1b06dc9ac4fbee4f0e4d015c8d4"
x86_64:
Darwin: "sha256:765c021e372a87ce0bc58d3670ab143008dae9305a79e9fa83440425529bb636"
Linux: "sha256:550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c"
golang_pkg: "go{{ golang_version }}.{{ ansible_system | lower }}-{{ ansible_architecture }}.tar.gz"
protoc_version: "3.15.6"
protoc_os: "{{ ansible_system | lower }}"
protoc_pkg: protoc-{{ protoc_version }}-{{ protoc_os }}-x86_64.zip
protoc_pkg:
arm64:
Darwin: protoc-{{ protoc_version }}-osx-x86_64.zip
Linux: protoc-{{ protoc_version }}-{{ protoc_os }}-aarch64.zip
x86_64:
Darwin: protoc-{{ protoc_version }}-osx-x86_64.zip
Linux: protoc-{{ protoc_version }}-{{ protoc_os }}-x86_64.zip
protoc_checksums:
Linux: 38a2f024a0ce68897b1868c59b613939bd41f16c0c8d8890843eccdbbf46ab00
Darwin: ca025c889efbe02f390b251c153c752a05fb04f5ac8c93929f8dba2818a5392a
arm64:
Linux: 38a2f024a0ce68897b1868c59b613939bd41f16c0c8d8890843eccdbbf46ab00
Darwin: ca025c889efbe02f390b251c153c752a05fb04f5ac8c93929f8dba2818a5392a
x86_64:
Linux: 38a2f024a0ce68897b1868c59b613939bd41f16c0c8d8890843eccdbbf46ab00
Darwin: ca025c889efbe02f390b251c153c752a05fb04f5ac8c93929f8dba2818a5392a
npm_become: no
pip_become: no
user_font_dir: "{{ ansible_env.HOME }}/.fonts"
gcloud_install_path: "{{ ansible_env.HOME }}"
gcloud_version: "183.0.0"
gcloud_version: "365.0.1"
gcloud_checksums:
Darwin: "sha256:605332cb305a04d377572d61063db88433862521f1aa4887d3b3fbfaaf1519a2"
Linux: "sha256:6e5c76999ff3f14621d26e3c76967dc4c43613344947ab42fcc764311642c898"
gcloud_pkg: "google-cloud-sdk-{{ gcloud_version }}-{{ ansible_system | lower }}-x86_64.tar.gz"
arm64:
Darwin: "sha256:636591e597730649011f510fc8c78e2b133ef8b417992f8d923a87a528dc6d5e"
Linux: "sha256:fbe88d385e2648ac21bd67586c669e824160424627ac2f9c3fd17c79c765286b"
x86_64:
Darwin: "sha256:4ae8a3274eb9b6fca5761ef2eed713bc3486256d11268575febe3351e9e4d902"
Linux: "sha256:17003cdba67a868c2518ac16efa60dc6175533b7a9fb87304459784308e30fb0"
gcloud_pkg:
arm64:
"google-cloud-sdk-{{ gcloud_version }}-{{ ansible_system | lower }}-arm.tar.gz"
x86_64:
"google-cloud-sdk-{{ gcloud_version }}-{{ ansible_system | lower }}-x86_64.tar.gz"
minikube_version: v0.25.2
minikube_checksum: sha256:f108e0125e45297f74b34e0dfd1a8e015220305832d437507afc20250f8f6ea5

Expand Down
5 changes: 2 additions & 3 deletions roles/developer/files/bashrc.d/developer.bash
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ fi
export ORIG_PATH

CPU=$(uname -p)
PATH="/usr/local/bin:$ORIG_PATH"
if [[ "$CPU" == "arm" ]]; then
PATH="/opt/homebrew/bin:$ORIG_PATH"
else
PATH="/usr/local/bin:$ORIG_PATH"
PATH="/opt/homebrew/bin:$PATH"
fi
export PATH=/usr/local/go/bin:$PATH

Expand Down
10 changes: 5 additions & 5 deletions roles/developer/tasks/install-gcloud.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
- name: download gcloud {{ gcloud_version }} archive
get_url:
url: https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/{{ gcloud_pkg }}
checksum: "{{ gcloud_checksums[ansible_system] }}"
dest: /tmp/{{ gcloud_pkg }}
url: "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/{{ gcloud_pkg[ansible_architecture] }}"
checksum: "{{ gcloud_checksums[ansible_architecture][ansible_system] }}"
dest: /tmp/{{ gcloud_pkg[ansible_architecture] }}
timeout: 600

#- name: remove gcloud archive directory
Expand All @@ -12,7 +12,7 @@

- name: unpack gcloud {{ gcloud_version }} archive
unarchive:
src: /tmp/{{ gcloud_pkg }}
src: /tmp/{{ gcloud_pkg[ansible_architecture] }}
dest: "{{ ansible_env.HOME }}"
copy: no
become: no
Expand All @@ -25,6 +25,6 @@

- name: remove gcloud archive
file:
path: /tmp/{{ gcloud_pkg }}
path: /tmp/{{ gcloud_pkg[ansible_architecture] }}
state: absent
become: no
2 changes: 1 addition & 1 deletion roles/developer/tasks/install-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: download go{{ golang_version }} archive
get_url:
url: https://storage.googleapis.com/golang/{{ golang_pkg }}
checksum: "{{ golang_checksums[ansible_system] }}"
checksum: "{{ golang_checksums[ansible_architecture][ansible_system] }}"
dest: /tmp/{{ golang_pkg }}
timeout: 600

Expand Down
4 changes: 2 additions & 2 deletions roles/developer/tasks/install-proto.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: download protoc {{ protoc_version }} archive
get_url:
url: https://github.com/google/protobuf/releases/download/v{{ protoc_version }}/{{ protoc_pkg }}
sha256sum: "{{ protoc_checksums[ansible_system] }}"
url: https://github.com/google/protobuf/releases/download/v{{ protoc_version }}/{{ protoc_pkg[ansible_architecture][ansible_system] }}
sha256sum: "{{ protoc_checksums[ansible_architecture][ansible_system] }}"
dest: /tmp/{{ protoc_pkg }}
timeout: 600

Expand Down

0 comments on commit dc7a902

Please sign in to comment.