generated from linux-system-roles/template
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for quadlet, secrets
Feature: Add support for quadlets. User can pass in quadlet units using `podman_quadlet_units`. Add support for secrets. User can pass in Ansible Vault encrypted secrets using `podman_secrets`. Reason: quadlets are the new way to implement applications in podman that use systemd services. quadlets allow you to specify everything you need to run your application - containers, services, volumes, networks, and more - using simple, systemd style unit files. Secrets such as passwords, tokens, keys, etc. are an important part of application configuration, so the role now allows those to be specified. Result: Users can deploy entire, complex applications using the podman system role using quadlet units.
- Loading branch information
Showing
28 changed files
with
1,302 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
# NOTE: Stopping, disabling, and removing units should also stop | ||
# and remove any pods and containers as well. | ||
- name: Stop and disable service | ||
systemd: | ||
name: "{{ __podman_service_name }}" | ||
scope: "{{ __podman_systemd_scope }}" | ||
state: stopped | ||
enabled: false | ||
become: "{{ __podman_rootless | ternary(true, omit) }}" | ||
become_user: "{{ __podman_rootless | ternary(__podman_user, omit) }}" | ||
environment: | ||
XDG_RUNTIME_DIR: "{{ __podman_xdg_runtime_dir }}" | ||
register: __podman_service_status | ||
when: __podman_service_name | length > 0 | ||
failed_when: | ||
- __podman_service_status is failed | ||
- not __podman_service_status.stdout is search(__service_error) | ||
vars: | ||
__service_error: Could not find the requested service | ||
|
||
- name: Remove quadlet file | ||
file: | ||
path: "{{ __podman_quadlet_file }}" | ||
state: absent | ||
register: __podman_file_removed | ||
|
||
- name: Reload systemctl # noqa no-handler | ||
systemd: | ||
daemon_reload: true | ||
scope: "{{ __podman_systemd_scope }}" | ||
become: "{{ __podman_rootless | ternary(true, omit) }}" | ||
become_user: "{{ __podman_rootless | ternary(__podman_user, omit) }}" | ||
environment: | ||
XDG_RUNTIME_DIR: "{{ __podman_xdg_runtime_dir }}" | ||
when: __podman_file_removed is changed | ||
|
||
- name: Cleanup container resources | ||
when: __podman_file_removed is changed # noqa no-handler | ||
block: | ||
- name: Gather facts for all containers | ||
containers.podman.podman_container_info: | ||
environment: | ||
XDG_RUNTIME_DIR: "{{ __podman_xdg_runtime_dir }}" | ||
become: "{{ __podman_rootless | ternary(true, omit) }}" | ||
become_user: "{{ __podman_rootless | ternary(__podman_user, omit) }}" | ||
register: __podman_container_info | ||
|
||
- name: Cancel linger if no more containers are running | ||
command: loginctl disable-linger {{ __podman_user }} | ||
when: | ||
- __podman_rootless | bool | ||
- __podman_container_info.containers | length == 0 | ||
changed_when: true | ||
|
||
- name: Prune images no longer in use | ||
command: podman image prune -f | ||
environment: | ||
XDG_RUNTIME_DIR: "{{ __podman_xdg_runtime_dir }}" | ||
become: "{{ __podman_rootless | ternary(true, omit) }}" | ||
become_user: "{{ __podman_rootless | ternary(__podman_user, omit) }}" | ||
changed_when: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.