community.general.homebrew_services 模块 – Homebrew 的服务管理器
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible 包,您可能已经安装了这个集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。您需要进一步的要求才能使用此模块,请参阅 要求 了解详情。
要在 playbook 中使用它,请指定:community.general.homebrew_services。
community.general 9.3.0 中的新增功能
概要
- 通过 Homebrew 管理守护程序和服务。 
要求
以下要求需要在执行此模块的主机上满足。
- 必须在目标系统上安装 homebrew 
参数
| 参数 | 注释 | 
|---|---|
| 要更新其服务的已安装 homebrew 包。 | |
| 一个  默认值:  | |
| 包的服务的状态。 选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全 | 可以在  | |
| 支持:无 | 当处于差异模式时,将返回有关已更改内容(或可能需要在  | 
示例
- name: Install foo package
  community.general.homebrew:
    name: foo
    state: present
- name: Start the foo service (equivalent to `brew services start foo`)
  community.general.homebrew_services:
    name: foo
    state: present
- name: Restart the foo service (equivalent to `brew services restart foo`)
  community.general.homebrew_services:
    name: foo
    state: restarted
- name: Remove the foo service (equivalent to `brew services stop foo`)
  community.general.homebrew_services:
    name: foo
    service_state: absent
返回值
常见的返回值记录在此处,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 如果服务现在正在运行,则这是服务的 PID,否则为 -1。 返回: 成功 示例:  | |
| 运行此命令后服务是否正在运行。 返回: 成功 示例:  | 
