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

      - mysite
    contentPath: "/var/www/"
    backupPath: "/home/dataFiles/backups/"


    - name: backup content
        src: "{{ contentPath }}/{{ item }}"
        dest: "{{backupPath}}/{{ item }}/{{ ansible_date_time.date }}/"
        - "{{ 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.

  • Update: added 2 GB of swap. It still runs out when the command is run. – Don Drenai Mar 16 '17 at 13:53
  • You should add the task which throws the error and the complete error message returned by Ansible. – Henrik Pingel Mar 16 '17 at 14:10
  • @HenrikPingel Thanks for the response. Added the info. – Don Drenai Mar 17 '17 at 6:37
  • Look on your logs. Read up on ansible debugging. Pfovide more information. – Iain Mar 17 '17 at 6:56
  • Yes, you need to run your ansible-playbook command with -vvv. You should also add your ansible version with ansible --verison – Henrik Pingel Mar 17 '17 at 7:05

There is a note in the copy_module documentation:

The “copy” module recursively copy facility does not scale to lots (>hundreds) of files. For alternative, see synchronize module, which is a wrapper around rsync.

Assuming this is the case here one should consider using the synchronize module.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.