redis-service

Description

Install a Redis service.

Variables

Name Type Default Description

bind

string 127.0.0.1

The address to listen on (set to '0.0.0.0' to listen on all interfaces).

databases

integer --

The number of Redis databases (default: 16).

db_compression

boolean True

Compress string objects in database.

dbdir

string --

Database path.

logfile

string --

The log file path.

loglevel

string --

Log level (default: notice).

maxmemory

integer 0

Limit memory usage to the specified amount of bytes. Leave at 0 for unlimited.

port

integer 6379

The port to listen on.

save

list --

Snapshotting configuration; setting values in this list will save the database to disk if the given number of seconds (e.g. 900) and the given number of write operations (e.g. 1) have occurred. Example for list item: '300 10'.

timeout

integer --

Close a connection after a client is idle N seconds. Set to 0 to disable timeout.

unix_socket

string --

If set, Redis will also listen on a local Unix socket.

Code

doc:
  short_help: Install a Redis service.

args:
  port:
    doc:
      short_help: The port to listen on.
    type: integer
    required: false
    default: 6379
  bind:
    doc:
      short_help: The address to listen on (set to '0.0.0.0' to listen on all interfaces).
    type: string
    required: false
    default: 127.0.0.1
  unix_socket:
    doc:
      short_help: If set, Redis will also listen on a local Unix socket.
    type: string
    required: false
  timeout:
    doc:
      short_help: Close a connection after a client is idle N seconds. Set to 0 to
        disable timeout.
    type: integer
    required: false
  loglevel:
    doc:
      short_help: 'Log level (default: notice).'
    type: string
    required: false
    allowed:
    - debug
    - verbose
    - notice
    - warning
  logfile:
    doc:
      short_help: The log file path.
    type: string
    required: false
  databases:
    doc:
      short_help: 'The number of Redis databases (default: 16).'
    type: integer
    required: false
  save:
    doc:
      short_help: "Snapshotting configuration; setting values in this list will save\
        \ the database to disk if the given number of seconds (e.g. 900) and the given\
        \ number of write operations (e.g. 1) have occurred. Example for list item:\
        \ '300 10'."
    type: list
    schema:
      type: string
    required: false
    empty: false
  dbdir:
    doc:
      short_help: Database path.
    type: string
    required: false
  dbfilename:
    doc:
      short_help: Filename for db file.
    type: string
    required: false
  db_compression:
    doc:
      short_help: Compress string objects in database.
    type: boolean
    required: false
    default: true
  maxmemory:
    doc:
      short_help: Limit memory usage to the specified amount of bytes. Leave at 0
        for unlimited.
    type: integer
    required: false
    default: 0


frecklets:
- frecklet:
    name: geerlingguy.redis
    type: ansible-role
    properties:
      internet: true
      elevated: true
      idempotent: true
    desc:
      short: install Redis service from system packages
  task:
    become: true
    include-type: import
  vars:
    redis_port: '{{:: port ::}}'
    redis_bind_interface: '{{:: bind ::}}'
    redis_unixsocket: '{{:: unix_socket ::}}'
    redis_timeout: '{{:: timeout ::}}'
    redis_loglevel: '{{:: loglevel ::}}'
    redis_logfile: '{{:: logfile ::}}'
    redis_databases: '{{:: databases ::}}'
    redis_save: '{{:: save ::}}'
    redis_dbdir: '{{:: dbdir ::}}'
    redis_dbcompression: '{%:: if db_compression ::%}yes{%:: else ::%}no{%:: endif
      ::%}'
    redis_maxmemory: '{{:: maxmemory ::}}'
frecklecute redis-service --help

Usage: frecklecute redis-service [OPTIONS]

  Install a Redis service.

Options:
  --bind BIND                     The address to listen on (set to '0.0.0.0'
                                  to listen on all interfaces).
  --databases DATABASES           The number of Redis databases (default: 16).
  --db-compression / --no-db-compression
                                  Compress string objects in database.
  --dbdir DBDIR                   Database path.
  --logfile LOGFILE               The log file path.
  --loglevel LOGLEVEL             Log level (default: notice).
  --maxmemory MAXMEMORY           Limit memory usage to the specified amount
                                  of bytes. Leave at 0 for unlimited.
  --port PORT                     The port to listen on.
  --save SAVE                     Snapshotting configuration; setting values
                                  in this list will save the database to disk
                                  if the given number of seconds (e.g. 900)
                                  and the given number of write operations
                                  (e.g. 1) have occurred. Example for list
                                  item: '300 10'.
  --timeout TIMEOUT               Close a connection after a client is idle N
                                  seconds. Set to 0 to disable timeout.
  --unix-socket UNIX_SOCKET       If set, Redis will also listen on a local
                                  Unix socket.
  --help                          Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.redis_service.RedisService
#


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

@dataclass
class RedisService(AutoPycklet):
    """Install a Redis service.

       Args:
         bind: The address to listen on (set to '0.0.0.0' to listen on all interfaces).
         databases: The number of Redis databases (default: 16).
         db_compression: Compress string objects in database.
         dbdir: Database path.
         logfile: The log file path.
         loglevel: Log level (default: notice).
         maxmemory: Limit memory usage to the specified amount of bytes. Leave at 0 for unlimited.
         port: The port to listen on.
         save: Snapshotting configuration; setting values in this list will save the database to disk if the given number of seconds (e.g. 900) and the given number of write operations (e.g. 1) have occurred. Example for list item: '300 10'.
         timeout: Close a connection after a client is idle N seconds. Set to 0 to disable timeout.
         unix_socket: If set, Redis will also listen on a local Unix socket.

    """

    FRECKLET_ID = "redis-service"

    bind: str = None
    databases: int = None
    db_compression: bool = None
    dbdir: str = None
    logfile: str = None
    loglevel: str = None
    maxmemory: int = None
    port: int = None
    save: List = None
    timeout: int = None
    unix_socket: str = None


    def __post_init__(self):
        super(RedisService, self).__init__(var_names=["bind", "databases", "db_compression", "dbdir", "logfile", "loglevel", "maxmemory", "port", "save", "timeout", "unix_socket"])


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


#
# module path: pycklets.redis_service.RedisService
#


from pyckles import AutoPycklet

class RedisService(AutoPycklet):
    """Install a Redis service.

       Args:
         bind: The address to listen on (set to '0.0.0.0' to listen on all interfaces).
         databases: The number of Redis databases (default: 16).
         db_compression: Compress string objects in database.
         dbdir: Database path.
         logfile: The log file path.
         loglevel: Log level (default: notice).
         maxmemory: Limit memory usage to the specified amount of bytes. Leave at 0 for unlimited.
         port: The port to listen on.
         save: Snapshotting configuration; setting values in this list will save the database to disk if the given number of seconds (e.g. 900) and the given number of write operations (e.g. 1) have occurred. Example for list item: '300 10'.
         timeout: Close a connection after a client is idle N seconds. Set to 0 to disable timeout.
         unix_socket: If set, Redis will also listen on a local Unix socket.

    """

    FRECKLET_ID = "redis-service"

    def __init__(self, bind="127.0.0.1", databases=None, db_compression=True, dbdir=None, logfile=None, loglevel=None, maxmemory=None, port=6379, save=None, timeout=None, unix_socket=None):

        super(RedisService, self).__init__(var_names=["bind", "databases", "db_compression", "dbdir", "logfile", "loglevel", "maxmemory", "port", "save", "timeout", "unix_socket"])
        self._bind = bind
        self._databases = databases
        self._db_compression = db_compression
        self._dbdir = dbdir
        self._logfile = logfile
        self._loglevel = loglevel
        self._maxmemory = maxmemory
        self._port = port
        self._save = save
        self._timeout = timeout
        self._unix_socket = unix_socket

    @property
    def bind(self):
        return self._bind

    @bind.setter
    def bind(self, bind):
        self._bind = bind

    @property
    def databases(self):
        return self._databases

    @databases.setter
    def databases(self, databases):
        self._databases = databases

    @property
    def db_compression(self):
        return self._db_compression

    @db_compression.setter
    def db_compression(self, db_compression):
        self._db_compression = db_compression

    @property
    def dbdir(self):
        return self._dbdir

    @dbdir.setter
    def dbdir(self, dbdir):
        self._dbdir = dbdir

    @property
    def logfile(self):
        return self._logfile

    @logfile.setter
    def logfile(self, logfile):
        self._logfile = logfile

    @property
    def loglevel(self):
        return self._loglevel

    @loglevel.setter
    def loglevel(self, loglevel):
        self._loglevel = loglevel

    @property
    def maxmemory(self):
        return self._maxmemory

    @maxmemory.setter
    def maxmemory(self, maxmemory):
        self._maxmemory = maxmemory

    @property
    def port(self):
        return self._port

    @port.setter
    def port(self, port):
        self._port = port

    @property
    def save(self):
        return self._save

    @save.setter
    def save(self, save):
        self._save = save

    @property
    def timeout(self):
        return self._timeout

    @timeout.setter
    def timeout(self, timeout):
        self._timeout = timeout

    @property
    def unix_socket(self):
        return self._unix_socket

    @unix_socket.setter
    def unix_socket(self, unix_socket):
        self._unix_socket = unix_socket



frecklet_class = RedisService