Ansible使用介绍

72课时
1.9K学过
8分

课程评价 (0)

请对课程作出评价:
0/300

学员评价

暂无精选评价
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’