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
================================================
18 343.113 MiB 343.113 MiB @profile(precision=3)
19 def v2_playbook_on_task_start(self, task, is_conditional):
20 343.113 MiB 0.000 MiB self._display.display("---------->[started task %s]" % (task), color=C.COLOR_WARN)
---------------------------------->[started task TASK: role_deploy : Download the artifacts on host 18.203.162.10]
Filename: memory_consumption/ansible/role_deploy/callback_plugins/profile_memory.py
Line # Mem usage Increment Line Contents
================================================
22 343.113 MiB 343.113 MiB @profile(precision=3)
23 def v2_runner_on_start(self, host, task):
24 343.113 MiB 0.000 MiB self._display.display("---------------------------------->[started task %s on host %s]" % (task, host), color=C.COLOR_WARN)
---------------------------------->[finished result {u'total_failed': 0, u'total_ok': 3238, '_ansible_no_log': False, u'deleted': False, u'changed': True, u'response_action': {u'deleted': [], u'failed': [], u'changed': 6, u'ok': 3238}, u'total_changed': 6, u'total_deleted': 0, u'invocation': {}, u'total': 3244}]
Filename: memory_consumption/ansible/role_deploy/callback_plugins/profile_memory.py
Line # Mem usage Increment Line Contents
================================================
26 420.051 MiB 420.051 MiB @profile(precision=3)
27 def v2_runner_on_ok(self, result):
28 420.051 MiB 0.000 MiB self._display.display("---------------------------------->[finished result %s]" % (result._result), color=C.COLOR_WARN)
---------------------------------->[started task TASK: role_deploy : Download the artifacts on host 54.216.154.16]
Filename: memory_consumption/ansible/role_deploy/callback_plugins/profile_memory.py
Line # Mem usage Increment Line Contents
================================================
22 420.051 MiB 420.051 MiB @profile(precision=3)
23 def v2_runner_on_start(self, host, task):
24 420.051 MiB 0.000 MiB self._display.display("---------------------------------->[started task %s on host %s]" % (task, host), color=C.COLOR_WARN)
---------------------------------->[finished result {u'total_failed': 0, u'total_ok': 3238, '_ansible_no_log': False, u'deleted': False, u'changed': True, u'response_action': {u'deleted': [], u'failed': [], u'changed': 6, u'ok': 3238}, u'total_changed': 6, u'total_deleted': 0, u'invocation': {}, u'total': 3244}]
Filename: memory_consumption/ansible/role_deploy/callback_plugins/profile_memory.py
Line # Mem usage Increment Line Contents
================================================
26 480.516 MiB 480.516 MiB @profile(precision=3)
27 def v2_runner_on_ok(self, result):
28 480.516 MiB 0.000 MiB self._display.display("---------------------------------->[finished result %s]" % (result._result), color=C.COLOR_WARN)
---------------------------------->[started task TASK: role_deploy : Download the artifacts on host 18.202.233.9]
Filename: memory_consumption/ansible/role_deploy/callback_plugins/profile_memory.py
Line # Mem usage Increment Line Contents
================================================
22 480.516 MiB 480.516 MiB @profile(precision=3)
23 def v2_runner_on_start(self, host, task):
24 480.516 MiB 0.000 MiB self._display.display("---------------------------------->[started task %s on host %s]" % (task, host), color=C.COLOR_WARN)
---------------------------------->[finished result {u'total_failed': 0, u'total_ok': 3238, '_ansible_no_log': False, u'deleted': False, u'changed': True, u'response_action': {u'deleted': [], u'failed': [], u'changed': 6, u'ok': 3238}, u'total_changed': 6, u'total_deleted': 0, u'invocation': {}, u'total': 3244}]
Filename: memory_consumption/ansible/role_deploy/callback_plugins/profile_memory.py
Line # Mem usage Increment Line Contents
================================================
26 537.219 MiB 537.219 MiB @profile(precision=3)
27 def v2_runner_on_ok(self, result):
28 537.219 MiB 0.000 MiB self._display.display("---------------------------------->[finished result %s]" % (result._result), color=C.COLOR_WARN)
As you can see, It can be a real problem when managing a lot of nodes because the master is going into OOM exception... just as it is my case.
Going into detail, I realized that ansible is keeping/storing the input args of the task in two places in the each host result: in the _result.invocation.module_args key and in the _task_fields.args.
I found that the invocation data can be forced to be empty in my custom module using something like: