1
0
Fork 0

added generalized unit info

Dieser Commit ist enthalten in:
Sebastian Tobie 2023-04-21 00:19:35 +02:00
Ursprung 69bb253369
Commit ddbeb30d73
3 geänderte Dateien mit 141 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -92,11 +92,32 @@ description:
- generates an systemd-networkd link
module: link
options:
after:
default: []
description:
- list of units that this unit wants to be started after this unit
elements: str
required: false
type: list
before:
default: []
description:
- list of units that this unit needs to be started before this unit.
elements: str
required: false
type: list
description:
description:
- The description for the link
required: false
type: str
documentation:
default: []
description:
- Paths where documentation can be found
elements: str
required: false
type: list
driver:
description:
- A glob matching the driver currently bound to the device
@ -123,6 +144,15 @@ options:
- The new name of the device
required: true
type: str
partof:
default: []
description:
- list of units that this unit is part of.
- If the restart this unit does it too, but if this restarts it does not affect
the other units.
elements: str
required: false
type: list
path:
description:
- A shell-style glob matching the persistent path, as exposed by the udev property
@ -134,11 +164,27 @@ options:
- The Permanent Mac address advertised by the device
required: false
type: str
requires:
default: []
description:
- list of units that this unit requires. If it fails or can't be started this
unit fails. without before/after this is started at the same time
elements: str
required: false
type: list
type:
description:
- A glob matching the device type, as exposed by networkctl list
required: false
type: str
wants:
default: []
description:
- list of units that this unit wants. If it fails or can't be started it does
not affect this unit
elements: str
required: false
type: list
short_description: generates an systemd-networkd link
"""

Datei anzeigen

@ -4,10 +4,10 @@ from typing import List, Optional
try:
from ansible_collections.sebastian.systemd.plugins.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types
from ansible_collections.sebastian.systemd.plugins.module_utils.module import SystemdUnitModule
from ansible_collections.sebastian.systemd.plugins.module_utils.module import SystemdUnitModule, installable
except ImportError:
from plugins.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types
from plugins.module_utils.module import SystemdUnitModule
from plugins.module_utils.module import SystemdUnitModule, installable
SYSTEMD_SERVICE_CONFIG = pathlib.Path("/etc/systemd/system")
@ -17,6 +17,7 @@ OPTION_MAPPING = dict(
)
@installable
class Module(SystemdUnitModule):
"""Creates an systemd mount"""
@ -32,16 +33,6 @@ class Module(SystemdUnitModule):
help="the state the mount is",
),
options=Types.list(elements=str, help="The options for the mount"),
description=Types.str(
help="An description for programs that access systemd"
),
required_by=Types.list(
elements=str, help="systemd units that require this mount"
),
wanted_by=Types.list(
elements=str,
help="systemd units that want the mount, but not explicitly require it. Commonly used for target if not service explicitly require it.",
),
),
)
@ -73,14 +64,6 @@ class Module(SystemdUnitModule):
output += "Options={}\n".format(",".join(self.get("options")))
return output
def install(self) -> str:
output = "[Install]\n"
for argument, key in OPTION_MAPPING.items():
if self.get(argument, False):
for unit in self.get(argument):
output += "{}={}\n".format(key, unit)
return output
def post(self):
if not self.changed:
return
@ -96,11 +79,32 @@ description:
- Creates an systemd mount
module: mount
options:
after:
default: []
description:
- list of units that this unit wants to be started after this unit
elements: str
required: false
type: list
before:
default: []
description:
- list of units that this unit needs to be started before this unit.
elements: str
required: false
type: list
description:
description:
- An description for programs that access systemd
required: false
type: str
documentation:
default: []
description:
- Paths where documentation can be found
elements: str
required: false
type: list
fs:
description:
- The filesystem that is used for the mount
@ -113,6 +117,15 @@ options:
elements: str
required: false
type: list
partof:
default: []
description:
- list of units that this unit is part of.
- If the restart this unit does it too, but if this restarts it does not affect
the other units.
elements: str
required: false
type: list
required_by:
default: []
description:
@ -120,6 +133,14 @@ options:
elements: str
required: false
type: list
requires:
default: []
description:
- list of units that this unit requires. If it fails or can't be started this
unit fails. without before/after this is started at the same time
elements: str
required: false
type: list
state:
choices:
- present
@ -137,6 +158,14 @@ options:
elements: str
required: false
type: list
wants:
default: []
description:
- list of units that this unit wants. If it fails or can't be started it does
not affect this unit
elements: str
required: false
type: list
what:
description:
- The device or an string that will be mounted

Datei anzeigen

@ -27,7 +27,6 @@ class Module(SystemdUnitModule):
mac=Types.str(help="The MAC-Address of the device"),
device=Types.str(help="The name of the network device"),
name=Types.str(required=True, help="name of the unit"),
description=Types.str(help="An optional description"),
dot=Types.bool(help="if DNS-over-TLS should be required or disabled. If it is unset, it will used if the server supports it"),
dnssec=Types.bool(
"if the Domainqueries should require DNSSEC or not. If its missing, domains that have DNSSEC enabled will be validated, all others it will be assumed to be okay."
@ -122,6 +121,20 @@ options:
elements: str
required: true
type: list
after:
default: []
description:
- list of units that this unit wants to be started after this unit
elements: str
required: false
type: list
before:
default: []
description:
- list of units that this unit needs to be started before this unit.
elements: str
required: false
type: list
defaultdns:
description:
- If the DNS-Server(s) on this device should be used for all domains that are
@ -148,6 +161,13 @@ options:
dnssec:
required: true
type: bool
documentation:
default: []
description:
- Paths where documentation can be found
elements: str
required: false
type: list
domain:
default: []
description:
@ -171,6 +191,23 @@ options:
- name of the unit
required: true
type: str
partof:
default: []
description:
- list of units that this unit is part of.
- If the restart this unit does it too, but if this restarts it does not affect
the other units.
elements: str
required: false
type: list
requires:
default: []
description:
- list of units that this unit requires. If it fails or can't be started this
unit fails. without before/after this is started at the same time
elements: str
required: false
type: list
route:
default: []
description:
@ -178,6 +215,14 @@ options:
elements: str
required: false
type: list
wants:
default: []
description:
- list of units that this unit wants. If it fails or can't be started it does
not affect this unit
elements: str
required: false
type: list
short_description: Sets up the systemd network unit
"""