init-service-configured
Example:
# Enable and start the 'apache2' service. - init-service-configured: name: apache2 enabled: true started: true
Description
Configure an init service.
You can use this to 'enable', 'disable', 'start' and 'stop' a service.
Variables
Name | Type | Default | Description |
---|---|---|---|
|
string | -- | The name of the service. Required |
|
boolean | False | Whether to enable the service or not. |
|
string | -- | The instance name, in case the service is a systemd template unit. |
|
boolean | False | Whether to start the service or not. |
Examples
Example 1
Enable and start the 'apache2' service.
Code
- init-service-configured: name: apache2 enabled: true started: true
Code
doc: short_help: Configure an init service. help: | Configure an init service. You can use this to 'enable', 'disable', 'start' and 'stop' a service. examples: - title: Enable and start the 'apache2' service. vars: name: apache2 enabled: true started: true args: name: doc: short_help: The name of the service. type: string required: true cli: metavar: SERVICE_NAME param_type: argument instance_name: doc: short_help: The instance name, in case the service is a systemd template unit. type: string required: 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 meta: tags: - init - systemd - service - standalone frecklets: - task: become: true frecklet: type: ansible-module name: service desc: short: 'configure service: {{:: name ::}}' references: "'service' Ansible module'": https://docs.ansible.com/ansible/latest/modules/service_module.html properties: idempotent: true internet: false elevated: true vars: name: '{{:: name ::}}{%:: if instance_name is defined and instance_name ::%}@{{:: instance_name ::}}{%:: endif ::%}' enabled: '{{:: enabled ::}}' state: "{{:: started | string_for_boolean('started', 'stopped') ::}}" # daemon_reload: true
frecklecute init-service-configured --help Usage: frecklecute init-service-configured [OPTIONS] SERVICE_NAME Configure an init service. You can use this to 'enable', 'disable', 'start' and 'stop' a service. Options: --enabled / --no-enabled Whether to enable the service or not. --instance-name INSTANCE_NAME The instance name, in case the service is a systemd template unit. --started / --no-started Whether to start the service or not. --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.init_service_configured.InitServiceConfigured # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class InitServiceConfigured(AutoPycklet): """Configure an init service. You can use this to 'enable', 'disable', 'start' and 'stop' a service. Args: enabled: Whether to enable the service or not. instance_name: The instance name, in case the service is a systemd template unit. name: The name of the service. started: Whether to start the service or not. """ FRECKLET_ID = "init-service-configured" enabled: bool = None instance_name: str = None name: str = None started: bool = None def __post_init__(self): super(InitServiceConfigured, self).__init__(var_names=["enabled", "instance_name", "name", "started"]) frecklet_class = InitServiceConfigured
# -*- coding: utf-8 -*- # # module path: pycklets.init_service_configured.InitServiceConfigured # from pyckles import AutoPycklet class InitServiceConfigured(AutoPycklet): """Configure an init service. You can use this to 'enable', 'disable', 'start' and 'stop' a service. Args: enabled: Whether to enable the service or not. instance_name: The instance name, in case the service is a systemd template unit. name: The name of the service. started: Whether to start the service or not. """ FRECKLET_ID = "init-service-configured" def __init__(self, enabled=None, instance_name=None, name=None, started=None): super(InitServiceConfigured, self).__init__(var_names=["enabled", "instance_name", "name", "started"]) self._enabled = enabled self._instance_name = instance_name 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_name(self): return self._instance_name @instance_name.setter def instance_name(self, instance_name): self._instance_name = instance_name @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 = InitServiceConfigured