Hi all,
I realized that when working with large input arguments in a task, this causes problems of high memory consumption. Let me give you more details.
I developed a custom module, called get_artifacts, which receives as an input argument (among others), a list of artifacts to be downloaded in each host.
This list of artifacts is list of json objects containing a lot of properties for each artifact (like size, url, permissions, path, etc.) which means it can weigh around 60MB.
When I execute my playbook, I have noticed that memory is increased every time that a host finish the custom task.
Detailed examples:
- My set up:
ansible --version
ansible [core 2.11.12]
config file = memory_consumption/ansible/ansible.cfg
configured module search path = [u’memory_consumption/ansible/role_deploy/library’]
ansible python module location = /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ansible
ansible collection location = /Users/user/.ansible/collections:/usr/share/ansible/collections
executable location = /Library/Frameworks/Python.framework/Versions/2.7/bin/ansible
python version = 2.7.16 (v2.7.16:413a49145e, Mar 2 2019, 14:32:10) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
jinja version = 2.10.1
libyaml = False
cat ansible.cfg
[defaults]
library = ./role_deploy/library
module_utils = ./role_deploy/library/module_utils
callback_whitelist = profile_memory
forks = 1
- When the task starts:
TASK [role_deploy : Download the artifacts] ***********************************************************************************
---------->[started task TASK: role_deploy : Download the artifacts]
Filename: memory_consumption/ansible/role_deploy/callback_plugins/profile_memory.py
Line # Mem usage Increment Line Contents