从Ansible文档中,服务模块:
控制远程主机上的服务.支持的init系统包括BSD init,OpenRC,SysV,Solaris SMF,systemd,upstart.
对于给定的机器,我如何判断Ansible正在使用哪个init系统?例如,系统可以在其上具有init和systemd.
让我们看一下模块的代码:
内部def main()::
# Find service management tools
service.get_service_tools()
Run Code Online (Sandbox Code Playgroud)
然后去class LinuxService(Service):和def get_service_tools(self):
# Locate a tool to enable/disable a service
if check_systemd():
# service is managed by systemd
...
elif location.get('initctl', False) and os.path.exists("/etc/init/%s.conf" % self.name):
# service is managed by upstart
...
elif location.get('rc-service', False):
# service is managed by OpenRC
...
elif self.svc_initscript:
# service is managed by with SysV init scripts
...
Run Code Online (Sandbox Code Playgroud)
我已经删除了一些代码,但是这段代码应该回答你的问题:如果有很多代码,Ansible可能会选择哪种系统.
Systemd是第一个搜索,然后新贵等...
| 归档时间: |
|
| 查看次数: |
3767 次 |
| 最近记录: |