ikke-t / podman-container-systemd

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

check for subuid/subgid fails with 'is not a directory' error #69

Open hmoffatt opened 1 year ago

hmoffatt commented 1 year ago

I am getting the following message when the subuid / subgid check runs:

TASK [ikke_t.podman_container_systemd : check if user is in subuid file] ************************************************************************************************************************
[WARNING]: Skipped '/etc/subuid' path due to this access issue: '/etc/subuid' is not a directory
ok: [vm-dbx] => {"changed": false, "examined": 0, "files": [], "matched": 0, "msg": "Not all paths examined, check warnings for details", "skipped_paths": {"/etc/subuid": "'/etc/subuid' is not a directory"}}

TASK [ikke_t.podman_container_systemd : check if group is in subgid file] ***********************************************************************************************************************
[WARNING]: Skipped '/etc/subgid' path due to this access issue: '/etc/subgid' is not a directory
ok: [vm-dbx] => {"changed": false, "examined": 0, "files": [], "matched": 0, "msg": "Not all paths examined, check warnings for details", "skipped_paths": {"/etc/subgid": "'/etc/subgid' is not a directory"}}

I think this is caused by ansible.builtin.file being passed a single filename, while the documentation says it expects a directory.

hmoffatt commented 1 year ago

I think it should use lineinfile with check_mode: yes and so on, as in https://www.middlewareinventory.com/blog/ansible-search-string-file-check-if-string-exists/