summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/podman/meta/main.yml18
-rw-r--r--roles/podman/tasks/main.yml48
2 files changed, 66 insertions, 0 deletions
diff --git a/roles/podman/meta/main.yml b/roles/podman/meta/main.yml
new file mode 100644
index 00000000..fdecb168
--- /dev/null
+++ b/roles/podman/meta/main.yml
@@ -0,0 +1,18 @@
+---
+dependencies: []
+galaxy_info:
+ author: "a14m"
+ description: "Install Podman container engine on Linux distributions"
+ company: "kartoffeln.work GmbH."
+ license: "MIT"
+ min_ansible_version: "2.18"
+ platforms:
+ - name: "ArchLinux"
+ versions:
+ - "all"
+ - name: "Ubuntu"
+ versions:
+ - "noble"
+ - name: "Debian"
+ versions:
+ - "bookworm"
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"