cgroup_perf_recap¶
Collection Note
This module is part of the ansible.posix collection. To install the collection, use:
You need further requirements to be able to use this module, see the Requirements section for details.
Synopsis¶
- This is an ansible callback plugin utilizes cgroups to profile system activity of ansible and individual tasks, and display a recap at the end of the playbook execution
Requirements¶
The following Python packages are needed on the host that executes this module:
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| control_group required |
Name of cgroups control group Env: CGROUP_CONTROL_GROUP |
|
| cpu_poll_interval float |
Default: 0.25 |
Interval between CPU polling for determining CPU usage. A lower value may produce inaccurate results, a higher value may not be short enough to collect results for short tasks. Env: CGROUP_CPU_POLL_INTERVAL |
| display_recap bool |
Default: True |
Controls whether the recap is printed at the end, useful if you will automatically process the output files Env: CGROUP_DISPLAY_RECAP |
| file_name_format str |
Default: %(feature)s.%(ext)s |
Format of filename. Accepts C(%(counter)s), C(%(task_uuid)s), C(%(feature)s), C(%(ext)s). Defaults to C(%(feature)s.%(ext)s) when C(file_per_task) is C(False) and C(%(counter)s-%(task_uuid)s-%(feature)s.%(ext)s) when C(True) Env: CGROUP_FILE_NAME_FORMAT |
| file_per_task bool |
When set as C(True) along with C(write_files), this callback will write 1 file per task instead of 1 file for the entire playbook run Env: CGROUP_FILE_PER_TASK |
|
| memory_poll_interval float |
Default: 0.25 |
Interval between memory polling for determining memory usage. A lower value may produce inaccurate results, a higher value may not be short enough to collect results for short tasks. Env: CGROUP_MEMORY_POLL_INTERVAL |
| output_dir path |
Default: /tmp/ansible-perf-%s |
Output directory for files containing recorded performance readings. If the value contains a single %s, the start time of the playbook run will be inserted in that space. Only the deepest level directory will be created if it does not exist, parent directories will not be created. Env: CGROUP_OUTPUT_DIR |
| output_format str |
Default: csv Choices: csv, json |
Output format, either CSV or JSON-seq Env: CGROUP_OUTPUT_FORMAT |
| pid_poll_interval float |
Default: 0.25 |
Interval between PID polling for determining PID count. A lower value may produce inaccurate results, a higher value may not be short enough to collect results for short tasks. Env: CGROUP_PID_POLL_INTERVAL |
| write_files bool |
Dictates whether files will be written containing performance readings Env: CGROUP_WRITE_FILES |
Notes¶
Note
- Requires ansible to be run from within a cgroup, such as with C(cgexec -g cpuacct,memory,pids:ansible_profile ansible-playbook ...)
- This cgroup should only be used by ansible to get accurate results
- To create the cgroup, first use a command such as C(sudo cgcreate -a ec2-user:ec2-user -t ec2-user:ec2-user -g cpuacct,memory,pids:ansible_profile)