systemd-template-units-configured

Description

Configures one or multiple systemd template units.

Variables

Name Type Default Description

instance_names

list --

The instance names. Required

name

string --

The name of the service. Required

enabled

boolean False

Whether to enable the service or not.

started

boolean False

Whether to start the service or not.

Code

doc:
  short_help: Configures one or multiple systemd template units.

args:
  name:
    doc:
      short_help: The name of the service.
    type: string
    required: true
    cli:
      metavar: SERVICE_NAME
      param_type: argument
  instance_names:
    doc:
      short_help: The instance names.
    type: list
    schema:
      type: string
    required: true
    empty: false
  enabled:
    doc:
      short_help: Whether to enable the service or not.
    type: boolean
    required: false
    default: false
    cli:
      is_flag: true
  started:
    doc:
      short_help: Whether to start the service or not.
    type: boolean
    required: false
    default: false
    cli:
      is_flag: true

frecklets:
- frecklet:
    name: systemd
    type: ansible-module
    properties:
      elevated: true
      internet: false
      idempotent: true
    desc:
      short: "configuring instances for systemd template unit '{{:: name ::}}': {{::\
        \ instance_names | join(' ') ::}}"
  task:
    become: true
    loop: '{{:: instance_names ::}}'
    loop_control:
      loop_var: __instance_name__
  vars:
    name: '{{:: name ::}}@{{ __instance_name__ }}'
    enabled: '{{:: enabled ::}}'
    state: "{{:: started | string_for_boolean('started', 'stopped') ::}}"
    daemon_reload: true
frecklecute systemd-template-units-configured --help

Usage: frecklecute systemd-template-units-configured [OPTIONS] SERVICE_NAME

  Configures one or multiple systemd template units.

Options:
  --instance-names INSTANCE_NAMES
                                  The instance names.  [required]
  --enabled / --no-enabled        Whether to enable the service or not.
  --started / --no-started        Whether to start the service or not.
  --help                          Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.systemd_template_units_configured.SystemdTemplateUnitsConfigured
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class SystemdTemplateUnitsConfigured(AutoPycklet):
    """Configures one or multiple systemd template units.

       Args:
         enabled: Whether to enable the service or not.
         instance_names: The instance names.
         name: The name of the service.
         started: Whether to start the service or not.

    """

    FRECKLET_ID = "systemd-template-units-configured"

    enabled: bool = None
    instance_names: List = None
    name: str = None
    started: bool = None


    def __post_init__(self):
        super(SystemdTemplateUnitsConfigured, self).__init__(var_names=["enabled", "instance_names", "name", "started"])


frecklet_class = SystemdTemplateUnitsConfigured
# -*- coding: utf-8 -*-


#
# module path: pycklets.systemd_template_units_configured.SystemdTemplateUnitsConfigured
#


from pyckles import AutoPycklet

class SystemdTemplateUnitsConfigured(AutoPycklet):
    """Configures one or multiple systemd template units.

       Args:
         enabled: Whether to enable the service or not.
         instance_names: The instance names.
         name: The name of the service.
         started: Whether to start the service or not.

    """

    FRECKLET_ID = "systemd-template-units-configured"

    def __init__(self, enabled=None, instance_names=None, name=None, started=None):

        super(SystemdTemplateUnitsConfigured, self).__init__(var_names=["enabled", "instance_names", "name", "started"])
        self._enabled = enabled
        self._instance_names = instance_names
        self._name = name
        self._started = started

    @property
    def enabled(self):
        return self._enabled

    @enabled.setter
    def enabled(self, enabled):
        self._enabled = enabled

    @property
    def instance_names(self):
        return self._instance_names

    @instance_names.setter
    def instance_names(self, instance_names):
        self._instance_names = instance_names

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, name):
        self._name = name

    @property
    def started(self):
        return self._started

    @started.setter
    def started(self, started):
        self._started = started



frecklet_class = SystemdTemplateUnitsConfigured