From 2adf40d08f1b96c0f8c103f733d7cfcea84f70f2 Mon Sep 17 00:00:00 2001 From: Nicola Belluti Date: Thu, 6 Aug 2026 15:24:50 +0200 Subject: [PATCH] Added Podman --- .chezmoi.toml.tmpl | 2 ++ .../containers/containers.conf | 2 ++ setup-script/playbook.yaml | 2 ++ setup-script/roles/podman/tasks/main.yml | 30 +++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 home/private_dot_config/containers/containers.conf create mode 100644 setup-script/roles/podman/tasks/main.yml diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index 1dd93b4..ae86b27 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -6,6 +6,7 @@ {{- $editor := promptBoolOnce . "features.editor" "Do you want to install Neovim" true }} {{- $nix := promptBoolOnce . "features.nix" "Do you want to install the Nix package manager" true }} {{- $terminal := promptBoolOnce . "features.terminal" "Do you want to install Wezterm" true }} +{{- $podman := promptBoolOnce . "features.podman" "Do you want to install Podman" true }} {{- $paru := false -}} {{ if eq .chezmoi.osRelease.id "arch" -}} @@ -23,3 +24,4 @@ editor = {{ $editor }} nix = {{ $nix }} paru = {{ $paru }} terminal = {{ $terminal }} +podman = {{ $podman }} diff --git a/home/private_dot_config/containers/containers.conf b/home/private_dot_config/containers/containers.conf new file mode 100644 index 0000000..ea1803c --- /dev/null +++ b/home/private_dot_config/containers/containers.conf @@ -0,0 +1,2 @@ +[engine] +compose_warning_logs = false diff --git a/setup-script/playbook.yaml b/setup-script/playbook.yaml index c8d2161..b6eb4f7 100644 --- a/setup-script/playbook.yaml +++ b/setup-script/playbook.yaml @@ -35,3 +35,5 @@ when: chezmoi.osRelease.id == "arch" and features.paru == true - role: terminal when: chezmoi.osRelease.id == "arch" and features.terminal == true + - role: podman + when: chezmoi.osRelease.id == "arch" and features.podman == true diff --git a/setup-script/roles/podman/tasks/main.yml b/setup-script/roles/podman/tasks/main.yml new file mode 100644 index 0000000..32f3d66 --- /dev/null +++ b/setup-script/roles/podman/tasks/main.yml @@ -0,0 +1,30 @@ +- name: Install Podman and related packages + become: true + ansible.builtin.pacman: + name: + - podman + - podman-compose + - slirp4netns # rootless mode networking (without slirp4netns, rootless containers have no network access) + - fuse-overlayfs # overlay storage driver for rootless mode (without it, rootless Podman uses a slower/less efficient driver) + state: present + +- name: Ensure the user has subuid/subgid configured + become: true + ansible.builtin.command: + argv: + - usermod + - --add-subuids + - 100000-165535 + - --add-subgids + - 100000-165535 + - "{{ lookup('env', 'USER') }}" + when: lookup('env', 'USER') != "root" + changed_when: false + +- name: Enable the podman.socket service for the user (Docker-compatible API) + ansible.builtin.systemd: + name: podman.socket + scope: user + enabled: true + state: started + become: false \ No newline at end of file