1. 7

    Algo looks interesting, but the Ansible playbooks it provides do some slightly odd things. For example, in the FreeBSD playbook:

    - name: FreeBSD / HardenedBSD | Install prerequisites
      raw: sleep 10 && env ASSUME_ALWAYS_YES=YES sudo pkg install -y python27
    
    - name: FreeBSD / HardenedBSD | Configure defaults
      raw: sudo ln -sf /usr/local/bin/python2.7 /usr/bin/python2.7
    

    The Ubuntu one does something similar and odd practises are followed throughout. That kind of thing makes me wary.

    1. 8

      The first task is fairly common practice used to allow remote boxes (often legacy / lacking python in base) to execute ansible tasks (ansible’s one requirement is to have python on the target machines). Second task is to avoid having to set ansible_python_interpreter, and definitely isn’t the right way to do it!

      I do the exact same thing with every FreeBSD/OpenBSD box I fire up, but I go about it differently:

      From my ansible hosts:

      [openbsd:vars]
      ansible_python_interpreter=/usr/local/bin/python2.7
      
      [freebsd:vars]
      ansible_python_interpreter=/usr/local/bin/python
      

      Then on OpenBSD I have a site.XX.tgz set that installs python (and does various configuration tasks) using autoinstall(8). I don’t use FreeBSD often enough to have an auto-install method for python.

      1. 3

        Indeed. The sleep 10 is the bit that had me raise an eyebrow (well, along with the Python symlink). I’ve checked out the other playbooks and in a few cases ansible_python_interpreter is set, but it’s set to /usr/bin/python2.7 (hence the crude FreeBSD hack). Also, checking for the existence of Python before installing might be a good idea…

        Easy enough to tidy up though.

        1. 9

          Thanks for checking out the code. As qbit said, this is a dirty hack due to Ansible only supporting python2 at the moment (python3 is in tech preview and still has bugs). If you have a cleaner way to work around this issue, we are certainly open to considering it. File a bug or make a pull request, we give out bounties! (note: I am one of the authors of Algo)

          1. 4

            Thanks for the response and for creating Algo - I do like the look of it.

            I’ve spotted a few things that could (IMHO) be neater (like the symlink) so I’ll take proper browse through and make some suggestions/file PRs.