systemd-services-started
Description
This frecklet makes sure a list of sytemd services are started.
Non-existing services will be ignored.
Variables
Name | Type | Default | Description |
---|---|---|---|
|
list | [] | A list of services. |
Code
doc: short_help: A list of init-service to start (if they exist) using Ansible. help: | This frecklet makes sure a list of sytemd services are started. Non-existing services will be ignored. args: services: doc: short_help: A list of services. type: list schema: type: string required: true empty: true default: [] cli: metavar: SERVICE_NAME param_type: argument meta: tags: - service - systemd - init - impl frecklets: - frecklet: type: ansible-module name: service_facts desc: short: gathering facts about init services - task: become: true loop: '{{:: services ::}}' loop_control: loop_var: __service_name__ when: __service_name__ + '.service' in ansible_facts.services.keys() frecklet: type: ansible-module name: service desc: short: "start services: {{:: services | join(' ') ::}}" references: "'service' Ansible module'": https://docs.ansible.com/ansible/latest/modules/service_module.html properties: idempotent: true internet: false elevated: true vars: name: '{{ __service_name__ }}' state: started
frecklecute systemd-services-started --help Usage: frecklecute systemd-services-started [OPTIONS] SERVICE_NAME This frecklet makes sure a list of sytemd services are started. Non-existing services will be ignored. Options: --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.systemd_services_started.SystemdServicesStarted # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class SystemdServicesStarted(AutoPycklet): """This frecklet makes sure a list of sytemd services are started. Non-existing services will be ignored. Args: services: A list of services. """ FRECKLET_ID = "systemd-services-started" services: List = None def __post_init__(self): super(SystemdServicesStarted, self).__init__(var_names=["services"]) frecklet_class = SystemdServicesStarted
# -*- coding: utf-8 -*- # # module path: pycklets.systemd_services_started.SystemdServicesStarted # from pyckles import AutoPycklet class SystemdServicesStarted(AutoPycklet): """This frecklet makes sure a list of sytemd services are started. Non-existing services will be ignored. Args: services: A list of services. """ FRECKLET_ID = "systemd-services-started" def __init__(self, services=None): super(SystemdServicesStarted, self).__init__(var_names=["services"]) self._services = services @property def services(self): return self._services @services.setter def services(self, services): self._services = services frecklet_class = SystemdServicesStarted