diff --git a/CHANGELOG.rst b/CHANGELOG.rst index df4002d..3286c7a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,10 +1,18 @@ ===================================== -sebastian.systemd 0.4.2 Release Notes +sebastian.systemd 0.4.3 Release Notes ===================================== .. contents:: Topics +v0.4.3 +====== + +Changelog +--------- + +added new options to system_service + v0.4.2 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 9847f7c..6ef1e7f 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -70,3 +70,7 @@ releases: release_date: "2024-03-09" changes: release_summary: upgraded to the new method used by sebastian.base + 0.4.3: + release_date: "2024-03-09" + changes: + release_summary: added new options to system_service diff --git a/galaxy.yml b/galaxy.yml index 3cc93d3..64bea05 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: sebastian name: systemd -version: 0.4.2 +version: 0.4.3 readme: README.md diff --git a/plugins/modules/system_service.py b/plugins/modules/system_service.py index ef34a78..1a29a60 100644 --- a/plugins/modules/system_service.py +++ b/plugins/modules/system_service.py @@ -37,6 +37,8 @@ class Module(SystemdUnitModule, SystemdReloadMixin): # type: ignore[misc] required=True, help="command or list of commands that are started as main programm. Multiple commands are only allowed in a oneshot command", ), + stop=Types.str(help="command that is started to stop the main program."), + remain=Types.bool(help="should the service remain as started after the command exited"), post=Types.list(str, help="Command or list of commands that are started after the main command(s) stopped without problems."), environmentfile=Types.list( elements=str, @@ -86,6 +88,11 @@ class Module(SystemdUnitModule, SystemdReloadMixin): # type: ignore[misc] statedirectory=Types.str( help="creates an unit specific state directory in /var/lib and sets the env var STATE_DIRECTORY with the path to it. Its cleaned up after the unit is stopped" ), + runtimedirectory=Types.str( + help="creates an unit specific runtime directory in /run and sets the env var RUNTIME_DIRECTORY with the path to it. Its cleaned up after the unit is stopped" + ), + restart=Types.str(), + restartsec=Types.str(), ), ) @@ -105,6 +112,7 @@ class Module(SystemdUnitModule, SystemdReloadMixin): # type: ignore[misc] type="Type", pre="ExecStartPre", start="ExecStart", + stop="ExecStop", post="ExecStartPost", serviceuser="User", servicegroup="Group", @@ -118,7 +126,11 @@ class Module(SystemdUnitModule, SystemdReloadMixin): # type: ignore[misc] execpath="ExecPaths", noexecpath="NoExecPaths", statedirectory="StateDirectory", + runtimedirectory="RuntimeDirectory", nonewprivileges="NoNewPriviledges", + remain="RemainAfterExit", + restart="Restart", + restartsec="RestartSec", ) ) return "[Service]\n" + "".join(params) @@ -268,6 +280,11 @@ options: additionally /etc and if strict all except /proc, /sys and /dev required: false type: str + remain: + description: + - should the service remain as started after the command exited + required: false + type: bool required_by: default: [] description: @@ -283,6 +300,12 @@ options: elements: str required: false type: list + restart: + required: false + type: str + restartsec: + required: false + type: str ropath: default: [] description: @@ -290,6 +313,12 @@ options: elements: path required: false type: list + runtimedirectory: + description: + - creates an unit specific runtime directory in /run and sets the env var RUNTIME_DIRECTORY + with the path to it. Its cleaned up after the unit is stopped + required: false + type: str rwpath: default: [] description: @@ -322,6 +351,11 @@ options: with the path to it. Its cleaned up after the unit is stopped required: false type: str + stop: + description: + - command that is started to stop the main program. + required: false + type: str type: choices: - simple