Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Memory error in Ansible?

Now i m trying to copy the file from /Build_Artifacts/build.zip to /Build_Artifacts/. Permission was set to 777 for /Build_Artifacts/.

while running the playbook it reports as Memory error!!

cat deploy.yml

 hosts: "{{host}}" user: soundar tasks:

    - name: copying
      copy: src=/Build_Artifacts/build.zip  dest=/Build_Artifacts/

jenkins@ip-10-0-6-189:~$ sudo ansible-playbook /var/lib/jenkins/deploy.yml --extra-vars "host=Resurgence-Dev"

PLAY [Resurgence-Dev] **********************************************************

TASK [setup] *******************************************************************
ok: [10.0.3.233]

TASK [copying] *****************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: MemoryError
fatal: [10.0.3.233]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""}
        to retry, use: --limit @/var/lib/jenkins/deploy.retry

PLAY RECAP *********************************************************************
10.0.3.233                 : ok=1    changed=0    unreachable=0    failed=1
like image 290
soundararajan.c Avatar asked Oct 15 '25 13:10

soundararajan.c


1 Answers

Ansible has known memory issues while trying to copy large files. For example.
It loads file into RAM and fails if file is large enough.

Use synchronize module instead. It uses rsync under the hood.

like image 82
Konstantin Suvorov Avatar answered Oct 17 '25 23:10

Konstantin Suvorov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!