added generalized unit info
Dieser Commit ist enthalten in:
Ursprung
69bb253369
Commit
ddbeb30d73
|
@ -92,11 +92,32 @@ description:
|
||||||
- generates an systemd-networkd link
|
- generates an systemd-networkd link
|
||||||
module: link
|
module: link
|
||||||
options:
|
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:
|
||||||
description:
|
description:
|
||||||
- The description for the link
|
- The description for the link
|
||||||
required: false
|
required: false
|
||||||
type: str
|
type: str
|
||||||
|
documentation:
|
||||||
|
default: []
|
||||||
|
description:
|
||||||
|
- Paths where documentation can be found
|
||||||
|
elements: str
|
||||||
|
required: false
|
||||||
|
type: list
|
||||||
driver:
|
driver:
|
||||||
description:
|
description:
|
||||||
- A glob matching the driver currently bound to the device
|
- A glob matching the driver currently bound to the device
|
||||||
|
@ -123,6 +144,15 @@ options:
|
||||||
- The new name of the device
|
- The new name of the device
|
||||||
required: true
|
required: true
|
||||||
type: str
|
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:
|
path:
|
||||||
description:
|
description:
|
||||||
- A shell-style glob matching the persistent path, as exposed by the udev property
|
- 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
|
- The Permanent Mac address advertised by the device
|
||||||
required: false
|
required: false
|
||||||
type: str
|
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:
|
type:
|
||||||
description:
|
description:
|
||||||
- A glob matching the device type, as exposed by networkctl list
|
- A glob matching the device type, as exposed by networkctl list
|
||||||
required: false
|
required: false
|
||||||
type: str
|
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
|
short_description: generates an systemd-networkd link
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ from typing import List, Optional
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ansible_collections.sebastian.systemd.plugins.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types
|
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:
|
except ImportError:
|
||||||
from plugins.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types
|
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")
|
SYSTEMD_SERVICE_CONFIG = pathlib.Path("/etc/systemd/system")
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ OPTION_MAPPING = dict(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@installable
|
||||||
class Module(SystemdUnitModule):
|
class Module(SystemdUnitModule):
|
||||||
"""Creates an systemd mount"""
|
"""Creates an systemd mount"""
|
||||||
|
|
||||||
|
@ -32,16 +33,6 @@ class Module(SystemdUnitModule):
|
||||||
help="the state the mount is",
|
help="the state the mount is",
|
||||||
),
|
),
|
||||||
options=Types.list(elements=str, help="The options for the mount"),
|
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")))
|
output += "Options={}\n".format(",".join(self.get("options")))
|
||||||
return output
|
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):
|
def post(self):
|
||||||
if not self.changed:
|
if not self.changed:
|
||||||
return
|
return
|
||||||
|
@ -96,11 +79,32 @@ description:
|
||||||
- Creates an systemd mount
|
- Creates an systemd mount
|
||||||
module: mount
|
module: mount
|
||||||
options:
|
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:
|
||||||
description:
|
description:
|
||||||
- An description for programs that access systemd
|
- An description for programs that access systemd
|
||||||
required: false
|
required: false
|
||||||
type: str
|
type: str
|
||||||
|
documentation:
|
||||||
|
default: []
|
||||||
|
description:
|
||||||
|
- Paths where documentation can be found
|
||||||
|
elements: str
|
||||||
|
required: false
|
||||||
|
type: list
|
||||||
fs:
|
fs:
|
||||||
description:
|
description:
|
||||||
- The filesystem that is used for the mount
|
- The filesystem that is used for the mount
|
||||||
|
@ -113,6 +117,15 @@ options:
|
||||||
elements: str
|
elements: str
|
||||||
required: false
|
required: false
|
||||||
type: list
|
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:
|
required_by:
|
||||||
default: []
|
default: []
|
||||||
description:
|
description:
|
||||||
|
@ -120,6 +133,14 @@ options:
|
||||||
elements: str
|
elements: str
|
||||||
required: false
|
required: false
|
||||||
type: list
|
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:
|
state:
|
||||||
choices:
|
choices:
|
||||||
- present
|
- present
|
||||||
|
@ -137,6 +158,14 @@ options:
|
||||||
elements: str
|
elements: str
|
||||||
required: false
|
required: false
|
||||||
type: list
|
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:
|
what:
|
||||||
description:
|
description:
|
||||||
- The device or an string that will be mounted
|
- The device or an string that will be mounted
|
||||||
|
|
|
@ -27,7 +27,6 @@ class Module(SystemdUnitModule):
|
||||||
mac=Types.str(help="The MAC-Address of the device"),
|
mac=Types.str(help="The MAC-Address of the device"),
|
||||||
device=Types.str(help="The name of the network device"),
|
device=Types.str(help="The name of the network device"),
|
||||||
name=Types.str(required=True, help="name of the unit"),
|
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"),
|
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(
|
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."
|
"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
|
elements: str
|
||||||
required: true
|
required: true
|
||||||
type: list
|
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:
|
defaultdns:
|
||||||
description:
|
description:
|
||||||
- If the DNS-Server(s) on this device should be used for all domains that are
|
- If the DNS-Server(s) on this device should be used for all domains that are
|
||||||
|
@ -148,6 +161,13 @@ options:
|
||||||
dnssec:
|
dnssec:
|
||||||
required: true
|
required: true
|
||||||
type: bool
|
type: bool
|
||||||
|
documentation:
|
||||||
|
default: []
|
||||||
|
description:
|
||||||
|
- Paths where documentation can be found
|
||||||
|
elements: str
|
||||||
|
required: false
|
||||||
|
type: list
|
||||||
domain:
|
domain:
|
||||||
default: []
|
default: []
|
||||||
description:
|
description:
|
||||||
|
@ -171,6 +191,23 @@ options:
|
||||||
- name of the unit
|
- name of the unit
|
||||||
required: true
|
required: true
|
||||||
type: str
|
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:
|
route:
|
||||||
default: []
|
default: []
|
||||||
description:
|
description:
|
||||||
|
@ -178,6 +215,14 @@ options:
|
||||||
elements: str
|
elements: str
|
||||||
required: false
|
required: false
|
||||||
type: list
|
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
|
short_description: Sets up the systemd network unit
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
Laden…
In neuem Issue referenzieren