community.general.mas 模块 – 使用 mas-cli 管理 Mac App Store 应用程序
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您正在使用 ansible
包,您可能已经安装了这个集合。 它不包含在 ansible-core
中。 要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。 您需要进一步的先决条件才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:community.general.mas
。
community.general 0.2.0 中的新功能
概要
使用
mas-cli
从 Mac App Store 安装、卸载和更新 macOS 应用程序。
要求
以下要求需要在执行此模块的主机上满足。
macOS 10.11+
mas-cli (https://github.com/mas-cli/mas) 1.5.0+ 可用作 bin 路径中的
mas
要使用的 Apple ID 需要已登录到 Mac App Store(使用
mas account
检查)。对于任何使用 macOS 12.0+ 的用户,都禁用“检查用户是否已登录”的功能。
对于任何使用 macOS 12.0+ 的用户,由于 https://github.com/mas-cli/mas/issues/417,需要事先通过 Mac App Store GUI 登录。
参数
属性
示例
- name: Install Keynote
community.general.mas:
id: 409183694
state: present
- name: Install Divvy with command mas installed in /usr/local/bin
community.general.mas:
id: 413857545
state: present
environment:
PATH: /usr/local/bin:{{ ansible_facts.env.PATH }}
- name: Install a list of apps
community.general.mas:
id:
- 409183694 # Keynote
- 413857545 # Divvy
state: present
- name: Ensure the latest Keynote version is installed
community.general.mas:
id: 409183694
state: latest
- name: Upgrade all installed Mac App Store apps
community.general.mas:
upgrade_all: true
- name: Install specific apps and also upgrade all others
community.general.mas:
id:
- 409183694 # Keynote
- 413857545 # Divvy
state: present
upgrade_all: true
- name: Uninstall Divvy
community.general.mas:
id: 413857545
state: absent
become: true # Uninstallation requires root permissions