大网数据广告活动
服务器运维问答

Ansible throws an “ ERROR! A worker was found in a dead state ” error

· 52CE 我爱测

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 ansib…

问题原文

原帖链接 · Sudh33ra · CC BY-SA 3.0

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.

已采纳解答

原帖链接 · Henrik Pingel · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-03-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。