ansible报错
报错:[root@jenkins ~]# ansible go_activity -m cron -a "name='log_clear' minute=0hour=2 job=find /home/golanger/log/ -type f -name 'log$(date +\%d -d -1day)' -delete"ERROR! this task 'cron' has ex...
报错:
[root@jenkins ~]# ansible go_activity -m cron -a "name='log_clear' minute=0 hour=2 job=find /home/golanger/log/ -type f -name 'log$(date +\%d -d -1day)' -delete"
ERROR! this task 'cron' has extra params, which is only allowed in the following modules: command, win_command, shell, win_shell, script, include, include_vars, add_host, group_by, set_fact, raw, meta
解决:
这个需要在job上加引号,另外如下,如果有一些特殊符号的话,需要转义
[root@jenkins ~]# ansible go_activity -m cron -a "name=log_clear minute=0 hour=2 job='find /home/golanger/log/ -type f -name \"log\$(date +%d -d -1day)\" -delete'"
虽然加了计划任务,但是还是需要删除下今天的日志,手动执行
[root@jenkins ~]# ansible go_weiai_project -m shell -a "find /home/golanger/log/ -type f -name \"log\$(date +%d -d -1day)\" -delete"
转载于:https://blog.51cto.com/zhangdl/2351762
更多推荐
所有评论(0)