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 包。 |
|
一个以 默认: |
|
软件包服务的状态。 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持: 完整 |
可以在 |
|
支持: 无 |
当处于 diff 模式时,将返回已更改(或可能需要在 |
示例
- 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。 返回: 成功 示例: |
|
运行此命令后服务是否正在运行。 返回: 成功 示例: |