Reputation: 6867
Using Ansible i have this simple task :
- name: kill selected APIS processes on API SERVER
shell: kill $(pgrep -f {{item}})
This process would be well killed but the task throws an error :
failed: "msg": "non-zero return code",
As indicated , maybe i should force my shell script to return 0 value (success)
kill $(pgrep -f {{item}})
how to do it ?
Upvotes: 1
Views: 2103
Reputation: 212268
The typical idiom to always return 0 is kill $(pgrep -f {{item}}) || true
But in ansible, it would seem sensible to use ignore_errors
.
Upvotes: 4