init-service-restarted

Example:

# Restart the 'apache2' service.
- init-service-restarted:
    name: apache2

Description

Make sure an init service is restarted.

Variables

Name Type Default Description

name

string --

The name of the service. Required

Examples

Example 1

Restart the 'apache2' service.

Code
- init-service-restarted:
    name: apache2
Description

This doesn't enable the apache2 service, but starts it if it isn't already running.

Code

doc:
  short_help: Restart init-service.
  help: |
    Make sure an init service is 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:
      name: apache2
args:
  name:
    doc:
      short_help: The name of the service.
    type: string
    required: true
    cli:
      metavar: SERVICE_NAME
      param_type: argument

meta:
  tags:
  - service
  - systemd
  - init

frecklets:
- task:
    become: true
  frecklet:
    type: ansible-module
    name: service
    desc:
      short: 'restart 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 ::}}'
    state: restarted
frecklecute init-service-restarted --help

Usage: frecklecute init-service-restarted [OPTIONS] SERVICE_NAME

  Make sure an init service is restarted.

Options:
  --help  Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.init_service_restarted.InitServiceRestarted
#


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

@dataclass
class InitServiceRestarted(AutoPycklet):
    """Make sure an init service is restarted.

       Args:
         name: The name of the service.

    """

    FRECKLET_ID = "init-service-restarted"

    name: str = None


    def __post_init__(self):
        super(InitServiceRestarted, self).__init__(var_names=["name"])


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


#
# module path: pycklets.init_service_restarted.InitServiceRestarted
#


from pyckles import AutoPycklet

class InitServiceRestarted(AutoPycklet):
    """Make sure an init service is restarted.

       Args:
         name: The name of the service.

    """

    FRECKLET_ID = "init-service-restarted"

    def __init__(self, name=None):

        super(InitServiceRestarted, self).__init__(var_names=["name"])
        self._name = name

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

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



frecklet_class = InitServiceRestarted