cron

user 指定用户的计划任务 name 给计划任务打标签 disabled 禁用计划任务 backup 制定计划任务的时候同时备份在/tmp state 指定状态:absent,则删除计划任务 minute 分 hour 时 day 日 month 月 weekday 周 special_time 特殊时间:special_time=reboot 类似与 计划任务的@reboot job 指定任务

示例: ansible jack6-2 -m cron -a "user=jack name='test' minute=1 hour=*/1 job='echo test' backup=yes disabled=yes " ansible jack6-2 -m cron -a "name='test' state=absent"

service

name 服务名称 state 状态:started stopped restarted reloaded enabled 开机自启动,yes 开机自启,no开机不自启

ansible jack6-2 -m service -a "name=httpd state=stopped" ansible jack6-2 -m command -a "service httpd status warn=false" ansible jack6-2 -m service -a "name=httpd state=started" ansible jack6-2 -m command -a "ss -nlt" ansible jack6-2 -m shell -a "ss -nlt|grep 80" ansible jack6-2 -m service -a "name=httpd state=restarted enabled=yes" ansibe jack6-2 -m shell -a "service httpd status warn= false"