-
-
Notifications
You must be signed in to change notification settings - Fork 113
/
main.yml
47 lines (40 loc) · 1.42 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
- name: Ensure MAS is installed.
homebrew: name=mas state=present
- name: Get MAS account status
command: mas account
register: mas_account_result
failed_when: mas_account_result.rc > 1
check_mode: false
changed_when: false
- name: Sign in to MAS when email and password are provided.
command: 'mas signin "{{ mas_email }}" "{{ mas_password }}"'
register: mas_signin_result
when:
- mas_account_result.rc == 1
- mas_email | bool
- mas_password | bool
- not mas_signin_dialog
- name: Sign in to MAS when email is provided, and complete password and 2FA using dialog.
command: 'mas signin "{{ mas_email }}" "{{ mas_password }}" --dialog'
register: mas_signin_result
when:
- mas_signin_dialog
- mas_account_result.rc == 1
- mas_email | bool
- name: List installed MAS apps.
command: mas list
register: mas_list
check_mode: false
changed_when: false
- name: Ensure unwanted MAS apps are uninstalled.
command: mas uninstall "{{ item.id|default(item) }}"
with_items: "{{ mas_uninstalled_apps }}"
when: (item.id | default(item) | string) in mas_list.stdout
- name: Ensure configured MAS apps are installed.
command: mas install "{{ item.id|default(item) }}"
with_items: "{{ mas_installed_apps + mas_installed_app_ids }}"
when: (item.id | default(item) | string) not in mas_list.stdout
- name: Upgrade all apps (if configured).
command: mas upgrade
when: mas_upgrade_all_apps