summaryrefslogtreecommitdiffstats
path: root/roles/podman/tasks
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-09-03 02:13:04 +0200
committerAhmed Abdelhalim <[email protected]>2025-09-03 03:26:08 +0200
commite36fcab754b110780f5553ebcd5ed64ce6f10fd7 (patch)
tree043cf52ade8e2e3870106176ce4b355d8069b1fa /roles/podman/tasks
parent9dd4c53993191439dd794f1c6150de7b2d1a0f78 (diff)
Add podman role with configuration to work over ssh with cgroupfs
Diffstat (limited to 'roles/podman/tasks')
-rw-r--r--roles/podman/tasks/main.yml48
1 files changed, 48 insertions, 0 deletions
diff --git a/roles/podman/tasks/main.yml b/roles/podman/tasks/main.yml
new file mode 100644
index 00000000..7cbb32b4
--- /dev/null
+++ b/roles/podman/tasks/main.yml
@@ -0,0 +1,48 @@
+---
+- name: "Install Podman"
+ become: true
+ ansible.builtin.package:
+ name: "podman"
+ state: "present"
+
+- name: "Enable and start Podman socket service"
+ become: true
+ ansible.builtin.systemd:
+ name: "podman.socket"
+ enabled: true
+ state: started
+
+- name: "Configure Podman for rootless operation"
+ ansible.builtin.command:
+ cmd: "loginctl enable-linger {{ ansible_user_uid }}"
+ become: true
+ changed_when: false
+ failed_when: false
+
+- name: "Create containers configuration directory"
+ ansible.builtin.file:
+ path: "{{ ansible_env.HOME }}/.config/containers"
+ state: "directory"
+ mode: "0755"
+
+- name: "Configure Podman containers.conf"
+ ansible.builtin.copy:
+ dest: "{{ ansible_env.HOME }}/.config/containers/containers.conf"
+ mode: "0644"
+ content: |
+ [containers]
+ cgroup_manager = "cgroupfs"
+
+ [engine]
+ cgroup_manager = "cgroupfs"
+
+- name: "Configure container registries"
+ become: true
+ ansible.builtin.copy:
+ dest: "/etc/containers/registries.conf"
+ mode: "0644"
+ content: |
+ unqualified-search-registries = ["docker.io"]
+
+ [[registry]]
+ location = "docker.io"