2

Can anyone recommend an alternative to Ansible that lets one write straight Python code? In my group, we're finding that expressing pretty simple logic in Ansible ends up being too time-consuming and ugly to specify. Also, the bunny trails that you end up going down to debug simple Ansible problems take way too much time.

Sometimes it takes hours to do (or debug) something that would take 30 seconds in straight Python.

The nice things about Ansible are:

  • A nice set of concepts like roles, hosts, tasks, and playbooks.
  • A nice library of preexisting modules.

.. but if one were looking for something that preserves some of those nice things from Ansible, but allows one to write straight Python for all of the configuration and logic, are there any recommendations?

7
  • It sounds like you would prefer something with an imperative format, rather than the declarative interface that Ansible give you. Is this correct? Commented May 27, 2020 at 9:24
  • 1
    The closest I could come to a suggestion that respects your "straight python" requirement was pulumi. However, that doesn't remove the need for configuration management... Commented May 27, 2020 at 9:31
  • @BruceBecker Yeah, either that or some combination where you use an imperative language to build up the "this is the state I want" data structure.
    – Mike
    Commented May 28, 2020 at 21:46
  • 1
    fabric is straight python but I'm not sure it passes the "preserve some of those nice things from ansible" threshold. Commented Jun 16, 2020 at 0:54
  • Wouldn't writing your own modules be the way to express your wishes in straight python?
    – LLlAMnYP
    Commented Jun 19, 2020 at 19:29

1 Answer 1

3

pyinfra was designed for this purpose. Fabric can also be used to script configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.