ikke-t / podman-container-systemd

creates systemd files and creates containers using podman
118 stars 44 forks source link

Isolate subid check #19

Closed romainsc closed 3 years ago

romainsc commented 4 years ago

In my current usage, I am building the container image directly on the host, then being able to independently check the subuid & subgid files is quite useful.

In order to avoid code duplication, I propose to isolate this file from the main.yml allowing user (like me) to call it directly. Here a sample usage:

- name: Add ”{{ service_name }}” system account
  user:
    name: "{{ service_user }}"
    comment: "{{ service_name }} system account"
    system: yes
    state: present
- name: Check "{{ service_name }}" subid
  import_role:
    name: ikke_t.podman_container_systemd
    tasks_from: check_subid
  vars:
    container_run_as_group: "{{ service_user }}"
    container_run_as_user: "{{ service_user }}"