应用

管理远程主机上的服务

参数

  • name:指定操作服务的名称
  • state=started|stopped|restarted|reloaded:指定服务的状态
  • enabled=yes|no:指定服务是否为开机启动项

示例

  1. 启动nginx服务
]# ansible all -m service -a 'name=nginx state=started'
  1. 停止nginx服务
]# ansible all -m service -a 'name=nginx state=stopped'
  1. 将nginx服务设置为开机启动项
]# ansible all -m service -a 'name=nginx enabled=yes'

相关文章:

  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2021-06-20
  • 2021-07-01
  • 2021-04-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案