init-services-restarted
Example:
# Restart the 'apache2' service. - init-services-restarted: services: - apache2
Description
Make sure a set of init services are restarted.
Variables
Name | Type | Default | Description |
---|---|---|---|
|
list | -- | A list of services to restart. Required |
Examples
Example 1
Restart the 'apache2' service.
Code
- init-services-restarted: services: - apache2
Description
This doesn't enable the apache2 service, but starts it if it isn't already running.
Code
doc: short_help: Restart one or multiple init-services. help: | Make sure a set of init services are restarted. examples: - title: Restart the 'apache2' service. desc: | This doesn't enable the apache2 service, but starts it if it isn't already running. vars: services: - apache2 args: services: doc: short_help: A list of services to restart. type: list required: true empty: false schema: type: string cli: metavar: SERVICE_NAME param_type: argument meta: tags: - service - systemd - init frecklets: - task: become: true loop: '{{:: services ::}}' loop_control: loop_var: __service_name__ frecklet: type: ansible-module name: service desc: short: "restart 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: restarted
frecklecute init-services-restarted --help Usage: frecklecute init-services-restarted [OPTIONS] SERVICE_NAME Make sure a set of init services are restarted. Options: --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.init_services_restarted.InitServicesRestarted # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class InitServicesRestarted(AutoPycklet): """Make sure a set of init services are restarted. Args: services: A list of services to restart. """ FRECKLET_ID = "init-services-restarted" services: List = None def __post_init__(self): super(InitServicesRestarted, self).__init__(var_names=["services"]) frecklet_class = InitServicesRestarted
# -*- coding: utf-8 -*- # # module path: pycklets.init_services_restarted.InitServicesRestarted # from pyckles import AutoPycklet class InitServicesRestarted(AutoPycklet): """Make sure a set of init services are restarted. Args: services: A list of services to restart. """ FRECKLET_ID = "init-services-restarted" def __init__(self, services=None): super(InitServicesRestarted, 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 = InitServicesRestarted