When I run a playbook that simply copies a directory from one place to another, ansible throws
ERROR! A worker was found in a dead state
Error. After some googling, it looks like this is caused by the oom-killer killing the ansible process (but i'm not exactly sure that this is the case). My Memory is:
total used free shared buff/cache available
Mem: 991 372 448 1 170 467
Swap: 511 365 146
I don't have a clue how to fix it. I should mention I only had the RAM when I first executed the playbook, which couldn't run cause of low memory. After that, I added the swap.Not sure if it's related but note that it's a swap file, not a separate partition.
I've watched the memory while running and I see that the free swap goes down very fast once it runs that task. The error message is thrown when it hits 0.
I'm running the following playbook.
---
- hosts: localhost
become: true
become_method: sudo
become_user: root
vars:
portals:
- mysite
contentPath: "/var/www/"
backupPath: "/home/dataFiles/backups/"
tasks:
- name: backup content
copy:
src: "{{ contentPath }}/{{ item }}"
dest: "{{backupPath}}/{{ item }}/{{ ansible_date_time.date }}/"
with_items:
- "{{ portals }}"
...
The error I've given above is the only info I get out of ansible. Even running the playbook verbosely doesn't give anything additional for that.
Best Answer
There is a note in the copy_module documentation:
Assuming this is the case here one should consider using the synchronize module.