ansible-augeas icon indicating copy to clipboard operation
ansible-augeas copied to clipboard

Optimization of costly Augeas() invocation, so it doesn't load all modules

Open adamryczkowski opened this issue 10 years ago • 1 comments

Initially I thought that the performance hit was from the Augeas invocation around the line 443, but further testing proved the problem was in completely different place.

Now the net speed of running the play with a single augeas task on localhost from over 1.2 sec to the 0.3 sec (and that includes all other overheads associated with invocation of ansible).

(The first pull request had a typo, that's why I had to delete it).

adamryczkowski avatar Oct 29 '15 08:10 adamryczkowski

The second commit is a further optimization; it reads the filter parameter for the "incl" string. If found, it prevents augeas from loading built-in modules. This way the behaviour is similar to Puppet's.

Unfortunately, I wasn't able to cleanly infer the filter parameter, if the augeas module is used with the commands parameter; (I am only a beginner with Python). User would have to put it separately, like this:

      augeas: >
        commands='match /files/etc/default/lxc-net/LXC_BRIDGE'
        filter=incl

Please, don't merge this commit yet, I'm still testing this (I'll let you know when I'm ready)

adamryczkowski avatar Oct 29 '15 09:10 adamryczkowski