Skip to content

Commit 572e089

Browse files
authored
Merge branch 'geerlingguy:master' into master
2 parents b657e90 + 21e61c8 commit 572e089

File tree

8 files changed

+43
-21
lines changed

8 files changed

+43
-21
lines changed

.ansible-lint

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
exclude_paths:
3+
- galaxy-deploy.yml
4+
- .ansible/roles/*
15
skip_list:
26
- risky-file-permissions
37
- yaml

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Check out the codebase.
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v4
2323
with:
2424
path: ansible_collections/geerlingguy/mac
2525

2626
- name: Set up Python 3.
27-
uses: actions/setup-python@v2
27+
uses: actions/setup-python@v5
2828
with:
2929
python-version: '3.x'
3030

@@ -46,7 +46,7 @@ jobs:
4646

4747
steps:
4848
- name: Check out the codebase.
49-
uses: actions/checkout@v2
49+
uses: actions/checkout@v4
5050
with:
5151
path: ansible_collections/geerlingguy/mac
5252

.yamllint

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ rules:
55
line-length:
66
max: 180
77
level: warning
8+
comments:
9+
min-spaces-from-content: 1
10+
comments-indentation: false
11+
braces:
12+
min-spaces-inside: 0
13+
max-spaces-inside: 1
14+
octal-values:
15+
forbid-implicit-octal: true
16+
forbid-explicit-octal: true
817

918
ignore: |
1019
.github/stale.yml

meta/runtime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
requires_ansible: ">=2.14.0"
2+
requires_ansible: ">=2.15.0"

roles/homebrew/tasks/main.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
homebrew_group: '{{ homebrew_group | default(ansible_user_gid) }}'
66

77
# Homebrew setup prerequisites.
8-
- name: Ensure Homebrew parent directory has correct permissions (M1).
8+
- name: Ensure Homebrew parent directory has correct permissions (Apple Silicon).
99
file:
1010
path: "{{ homebrew_prefix }}"
1111
owner: "{{ homebrew_user }}"
@@ -30,7 +30,7 @@
3030
owner: root
3131
group: admin
3232
state: directory
33-
mode: 0775
33+
mode: "0775"
3434
become: true
3535
when: "ansible_distribution_version is version('10.13', '<')"
3636

@@ -45,7 +45,7 @@
4545
owner: "{{ homebrew_user }}"
4646
group: "{{ homebrew_group }}"
4747
state: directory
48-
mode: 0775
48+
mode: "0775"
4949
become: true
5050

5151
# Clone Homebrew.
@@ -58,6 +58,7 @@
5858
depth: 1
5959
become: true
6060
become_user: "{{ homebrew_user }}"
61+
when: not pre_installed_brew.stat.exists
6162

6263
# Adjust Homebrew permissions.
6364
- name: Ensure proper permissions and ownership on homebrew_brew_bin_path dirs.
@@ -66,7 +67,7 @@
6667
state: directory
6768
owner: "{{ homebrew_user }}"
6869
group: "{{ homebrew_group }}"
69-
mode: 0775
70+
mode: "0775"
7071
become: true
7172

7273
- name: Ensure proper ownership on homebrew_install_path subdirs.
@@ -76,6 +77,7 @@
7677
owner: "{{ homebrew_user }}"
7778
group: "{{ homebrew_group }}"
7879
recurse: true
80+
follow: false
7981
become: true
8082

8183
# Place brew binary in proper location and complete setup.
@@ -198,5 +200,7 @@
198200
check_mode: false
199201

200202
- name: Install from Brewfile.
201-
command: "{{ homebrew_brew_bin_path }}/brew bundle chdir={{ homebrew_brewfile_dir }}"
203+
command: "{{ homebrew_brew_bin_path }}/brew bundle"
204+
args:
205+
chdir: "{{ homebrew_brewfile_dir }}"
202206
when: homebrew_brewfile.stat.exists and homebrew_use_brewfile

roles/mas/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ A list of apps to ensure are installed on the computer using the Mac App Store.
3838

3939
Whether to run `mas upgrade`, which will upgrade all installed Mac App Store apps.
4040

41+
mas_path: "{{ '/opt/homebrew/bin/mas' if ansible_architecture == 'arm64' else '/usr/local/bin/mas' }}"
42+
43+
When targeting a remote Mac, the PATH isn't always correct leading to the `mas` binary not being found. This variable allows you to override the path to the `mas` binary. The defaults above work for most installations, but you may need to override this if you have a custom Homebrew installation path or other custom setup.
44+
4145
### Remove installed apps
4246

4347
mas_uninstalled_apps:

roles/mas/defaults/main.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
mas_email: ""
33
mas_password: ""
44
mas_uninstalled_apps: []
5-
mas_installed_app_ids: [] # Deprecated
5+
mas_installed_app_ids: [] # Deprecated
66
mas_installed_apps:
7-
- {id: 425264550, name: "Blackmagic Disk Speed Test (3.0)"}
8-
- {id: 411643860, name: "DaisyDisk (4.3.2)"}
9-
- {id: 498486288, name: "Quick Resizer (1.9)"}
10-
- {id: 497799835, name: "Xcode (8.1)"}
7+
- { id: 425264550, name: "Blackmagic Disk Speed Test (3.0)" }
8+
- { id: 411643860, name: "DaisyDisk (4.3.2)" }
9+
- { id: 498486288, name: "Quick Resizer (1.9)" }
10+
- { id: 497799835, name: "Xcode (8.1)" }
1111
mas_upgrade_all_apps: false
1212
mas_signin_dialog: false
13+
mas_path: "{{ '/opt/homebrew/bin/mas' if ansible_architecture == 'arm64' else '/usr/local/bin/mas' }}"

roles/mas/tasks/main.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
state: present
66

77
- name: Get MAS account status
8-
command: mas account
8+
command: '"{{ mas_path }}" account'
99
register: mas_account_result
1010
failed_when: mas_account_result.rc > 1
1111
check_mode: false
@@ -14,7 +14,7 @@
1414
- ansible_distribution_version is version('12', '<')
1515

1616
- name: Sign in to MAS when email and password are provided.
17-
command: 'mas signin "{{ mas_email }}" "{{ mas_password }}"'
17+
command: '"{{ mas_path }}" signin "{{ mas_email }}" "{{ mas_password }}"'
1818
register: mas_signin_result
1919
when:
2020
- ansible_distribution_version is version('10.13', '<')
@@ -24,7 +24,7 @@
2424
- not mas_signin_dialog
2525

2626
- name: Sign in to MAS when email is provided, and complete password and 2FA using dialog.
27-
command: 'mas signin "{{ mas_email }}" "{{ mas_password }}" --dialog'
27+
command: '"{{ mas_path }}" signin "{{ mas_email }}" "{{ mas_password }}" --dialog'
2828
register: mas_signin_result
2929
when:
3030
- ansible_distribution_version is version('10.13', '<')
@@ -33,21 +33,21 @@
3333
- mas_email is truthy
3434

3535
- name: List installed MAS apps.
36-
command: mas list
36+
command: '"{{ mas_path }}" list'
3737
register: mas_list
3838
check_mode: false
3939
changed_when: false
4040

4141
- name: Ensure unwanted MAS apps are uninstalled.
42-
command: mas uninstall "{{ item.id | default(item) }}"
42+
command: '"{{ mas_path }}" uninstall "{{ item.id | default(item) }}"'
4343
with_items: "{{ mas_uninstalled_apps }}"
4444
when: (item.id | default(item) | string) in mas_list.stdout
4545

4646
- name: Ensure configured MAS apps are installed.
47-
command: mas install "{{ item.id | default(item) }}"
47+
command: '"{{ mas_path }}" install "{{ item.id | default(item) }}"'
4848
with_items: "{{ mas_installed_apps + mas_installed_app_ids }}"
4949
when: (item.id | default(item) | string) not in mas_list.stdout
5050

5151
- name: Upgrade all apps (if configured).
52-
command: mas upgrade
52+
command: '"{{ mas_path }}" upgrade'
5353
when: mas_upgrade_all_apps

0 commit comments

Comments
 (0)