Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absent state with quadlet should remove quadlet file as well as podman resource. #739

Open
WhyKickAmooCow opened this issue May 3, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@WhyKickAmooCow
Copy link

/kind feature

Description
When the state is set to be absent, and quadlet options are set, the expected behavior would be to both remove the quadlet file and podman resource. The current behavior is so just remove the podman resource (image, container, volume, ...).

As a user this would be desirable for me to manage podman deployments purely through this module rather than relying on using the file module to remove the quadlets this module generates. Currently I am achieving this behavior through the use of a role, but think this would be better implemented by the module itself.

I am reasonably new to using Ansible so let me know if there are any issues with this approach or if it would not indeed be expected behavior in the ecosystem.

@sshnaidm
Copy link
Member

sshnaidm commented May 4, 2024

Yeah, it sounds reasonable. We can check quadlet_file, quadlet_dir when state is absent and delete them as well if they are specified, or look for a default file and implicitly delete it. To be consistent though we need to delete systemd files as well then, and it's not the case right now.
Let's hear what others say.

@nishipy
Copy link
Contributor

nishipy commented Jun 14, 2024

We can delete ${quadlet_dir}/${quadlet_file}. In addition, I would say we should run systemctl --user daemon-reload to delete unit files generated by quadlet, which are located in /run/user/$UID/systemd/generator/ for rootless.

@nishipy
Copy link
Contributor

nishipy commented Jun 14, 2024

So in the case of a container deletion, I think we will perform the following steps:

  1. Stop and remove the container
  2. Remove the Quadlet file ${quadlet_dir}/${quadlet_file}
  3. Run systemctl --user daemon-reload to delete unit files generated by Quadlet

@sshnaidm sshnaidm added the enhancement New feature or request label Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants