summaryrefslogtreecommitdiffstats
path: root/roles/podman/tasks/main.yml
blob: 74b608eef44a0da2743c522a3a9e7db08ab05012 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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_service:
    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"