1、新增一个定时任务:
ansible all -m cron -a "name=check minute=5 job='pwd'"

image.png
2、删除定时任务:
ansible all -m cron -a "name=check state=absent"
3、把这个定时任务存放在/etc/cron.d/目录下的某一个自定义文件中:
ansible all -m cron -a "name=check minute=5 job='pwd' user='root' cron_file='testcronfile'"

image.png
4、定时任务的参数还包括:day,hour,month,weekday,state(任务启用或停止),reboot(重启后是否需要执行,默认为否)
5、修改主机名字:hostname
ansible 172.16.52.245 -m hostname -a "name=ansible-test245"