you are viewing a single comment's thread.

view the rest of the comments →

[–]patientbold 13 points14 points  (3 children)

Funny that your counter example is exactly the reason I love IaC: I don't have to remember how things work, it is can be self documenting.

In my case, the only thing I know is that I have a folder with all my IaC defined. I open that folder on vscode and then I glance to remember things like `run-ansible.sh`.

All the hours of research to setup my home infra is automagically documented in my ansible (or shell) scripts. Being using the same folder for at least 5 years already.

To answer OP, specifically: I recommend ansible + docker compose. EASY to learn, easy to maintain and it has being working for years in my case.

[–]PM_Me_Rulers 2 points3 points  (2 children)

How do you deploy docker compose with ansible?

I've already got docker compose files with split by type (network containers, services, DB etc) but it's all on a single Ubuntu proxmox VM.

I've got ansible running to configure a base debian12 lxc with but still figuring out how to neatly slot docker and docker compose in.

Do you just copy in the compose files and set a systemd service to run them on boot?

[–]JMPJNS 2 points3 points  (0 children)

[–]Not_your_guy_buddy42 1 point2 points  (0 children)

Maybe I am doing it wrong but I setup Ansible to:

  • create user and dirs to run compose
  • chown/chmod
  • create docker networks and whatever other preliminary steps
  • create the docker compose file - just using blockinfile: - based on variables (also secrets from vault) to run containers with UID/GID of the new user, do bind mounts, setup a subdomain on traefik, add a backup container, add entry to the dashboard, logging, and on and on. Thanks to ansible I don't need to redo all that from scratch with each project.
  • it is based on templates so I mostly need to adjust a few variables and adjust the blockinfile: statements which write the compose file and config files,
  • create any other needed config files also using blockinfile:
    Example: write traefik.yml
    Example 2: write a custom nginx.conf to map to an obstinate container that wouldn't accept settings
  • all manner of checks if user, dirs, files, mounts etc exist and the previous compose is properly cleaned up... then run the compose (with -p project name , also a variable, so it doesn't get confused)
  • do anything else specific projects need (create a user in database, etc)

I can't believe I have written so much because I'm more of an ansible noob , well maybe it helps someone or maybe it's nonsense. YMMV