Ansible startup performance & time spent loading in ConfigManager

Hi all,

I’m using ansible to deploy my home lab. It’s running CentOS 7.4 AArch on a pine64 board,
so it has a slow ARM cpu. Executing ansible is slow (10 sec without any playbook),
and I started to look where time got spent.
More than half of this time is lost parsing the base config yaml (ansible/config/base.yml).
I patched ansible/config/manager.py, and added
yaml.SafeLoader = yaml.CSafeLoader
before
yaml.safe_load(config_def)
is invoked.
This brought startup time to one third of the initial time.

I checked pyyaml if CSafeLoader can be forced as a default one way or another,
and after a quick check, I didn’t find a possibility to set a default loader (except with extra parameter)
(https://github.com/yaml/pyyaml/blob/master/lib/yaml/__init__.py)

Is it possible to have the CSafeLoader as the default behaviour when running ansible?
Or have I overlooked something, and should this be resolved differently?

Thank you very much for any feedback!

This is a good idea. For parsing playbooks we made this change a long time ago. Could you open a bug report on GitHub for this? With the holiday vacation coming up, I don’t want this to be forgotten.

Thanks,
-Toshio

Thanks for your feedback. Issue has been created > https://github.com/ansible/ansible/issues/34147