infra/ansible/roles/nomad_client/tasks/podman.yml

73 lines
1.4 KiB
YAML
Raw Normal View History

2020-10-01 00:59:50 +00:00
---
- name: ensure podman group
group:
name: podman
state: present
system: True
- name: ensure podman user
user:
name: podman
state: present
group: podman
system: True
- name: ensure podman is installed
apt:
name:
2022-03-26 22:06:26 +00:00
- catatonit
- fuse-overlayfs
- podman
- slirp4netns
- uidmap
2020-10-01 00:59:50 +00:00
state: present
- name: ensure containers.conf is configured
2022-03-26 22:06:26 +00:00
copy:
src: containers.conf
dest: /etc/containers/containers.conf
owner: root
group: root
mode: 0644
2022-03-26 22:06:26 +00:00
- name: Check if podman lingers
stat: path=/var/lib/systemd/linger/podman
register: linger
- name: enable lingering for podman
command: loginctl enable-linger podman
when: not linger.stat.exists
- name: enable podman
systemd:
name: podman
state: started
2022-03-26 22:06:26 +00:00
enabled: True
scope: user
changed_when: False
become: True
become_user: podman
- name: check if subuid is configured
shell: grep podman /etc/subuid
register: subuid
changed_when: False
2022-03-26 22:06:26 +00:00
check_mode: False
failed_when: False
- name: check if subgid is configured
shell: grep podman /etc/subgid
register: subgid
changed_when: False
check_mode: False
failed_when: False
- name: configure subuid
shell: usermod --add-subuids 200000-201000 podman
when: subuid.rc != 0
- name: configure subgid
shell: usermod --add-subgids 200000-201000 podman
when: subgid.rc != 0
2020-10-01 00:59:50 +00:00
...