1分钟
21 Service模块
功能:管理服务
示例:
停止httpd服务:
ansible srv -m service -a ‘name=httpd state=stopped’
开启httpd服务:
ansible srv -m service -a ‘name=httpd state=started’
重新加载httod服务:
ansible srv -m service -a ‘name=httpd state=reloaded’
重启httpd服务:
ansible srv -m service -a ‘name=httpd state=restarted’
开启ftp服务,同时设置开机自动启动:
ansible srv -m service -a ‘name=vsftpd state=started enabled=yes’
重启ftp服务:
ansible srv -m service -a ‘name=vsftpd state=restarted’
学员评价