Arnavion 4 days ago

As I said, a small shell script I wrote. The only things it needs to do are sync files according to the `filelist` files and sync packages according to the `packages` files, so I don't need the full verbose DSL of Ansible etc.

Also it means it has no dependencies on the target machine. You might say Ansible doesn't need anything on the target machine except ssh, but it does require the target machine to be reachable over ssh, which is not necessarily the case if I'm rebuilding a machine such that its network is not already configured. So in that case all I need to do is sneakernet my git repository over and then execute a shell script.

  • jonotime 3 days ago

    How do you deal with removing a package? For examplet the case where you have htop in your config, but no longer want it on your system or in your configs.

    • Arnavion 3 days ago

      The script builds a list of "expected packages" for the host by unioning the `packages` files in all the roles of the host. Then it enumerates all the packages that are "intentionally installed" (*). If there's a difference, it prints the difference and I add what needs to be added and remove what needs to be removed.

      (*): This depends on the package manager:

      - For Alpine / postmarketOS it's just the content of `/etc/apk/world`.

      - For Debian / Ubuntu it's `apt-mark showmanual`.

      - For OpenSUSE it's `zypper search --installed-only` (which includes both intentionally and automatically installed packages) and then subtracting the contents of `/var/lib/zypp/AutoInstalled`.