community.general.simpleinit_msb 模块 – 管理 Source Mage GNU/Linux 上的服务
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。
要在 playbook 中使用它,请指定:community.general.simpleinit_msb。
community.general 7.5.0 中的新增功能
概要
- 使用 - simpleinit-msb控制远程主机上的服务。
参数
| 参数 | 注释 | 
|---|---|
| 服务的名称。 | |
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全 | 可以在  | |
| 支持:无 | 当处于 diff 模式时,将返回有关已更改内容(或在  | 
注释
注意
- 此模块需要 ansible-core 2.15.5 或更高版本。旧版本具有损坏且不足的守护进程化功能。 
示例
- name: Example action to start service httpd, if not running
  community.general.simpleinit_msb:
    name: httpd
    state: started
- name: Example action to stop service httpd, if running
  community.general.simpleinit_msb:
    name: httpd
    state: stopped
- name: Example action to restart service httpd, in all cases
  community.general.simpleinit_msb:
    name: httpd
    state: restarted
- name: Example action to reload service httpd, in all cases
  community.general.simpleinit_msb:
    name: httpd
    state: reloaded
- name: Example action to enable service httpd, and not touch the running state
  community.general.simpleinit_msb:
    name: httpd
    enabled: true
