After getting fed up with TrueNAS (after it borked itself for the third time and I would have had to set it up AGAIN) I decided to learn Ansible and write a playbook to setup my homeserver that way.

I wanted to share this playbook with you in case someone might find it useful for their own setup and maybe someone has some tips on things I could improve.

This server will not be exposed to the public/internet. If I want to access a service on it from outside my home network I have Wireguard setup on my router to connect to my home network from anywhere.

Keep in mind that I’m relatively new to sysadmin stuff etc so don’t be too harsh please 😅

  • vortexsurfer@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    8 months ago

    If you want to make your playbooks/roles more universal, there’s a generic package module which will figure out what package manager to use based on the detected OS.

    Or, if that doesn’t fit your needs, you can add conditions to tasks (or blocks of tasks), like

    when: ansible_os_family == "Debian"

    and use that for tasks specific to a given Linux distro/family.

    Ansible will detect a lot of info about each host and make it available as facts. See for example https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html

    • Tywèle [she|her]@lemmy.dbzer0.comOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      8 months ago

      I know but I also learned that it’s generally better to use the specific module for the package manager (just can’t remember why from the top of my head) and I never intended this playbook to be generally usable.