nomad-service
Example:
# Download/install the Nomad executable and create, enable and start a systemd service unit for it. - nomad-service: enabled: true started: true
Description
Download the Consul binary into '/usr/local/bin' and create a systemd service unit ('consul') and enable/start it if so specified.
It is recommended to create the approriate Nomad server/client configuration files beforehand (in '/etc/nomad.d'), but this frecklet also allows for providing basic configuration options if necessary.
Resources
Variables
Name | Type | Default | Description |
---|---|---|---|
|
string | -- | The architecture of the host system. |
|
string | -- | The (absolute) path to the parent folder of the downloaded executable file. |
|
boolean | -- | Whether to enable the service. |
|
dict | -- | The nomad configuration. |
|
string | -- | The platform of the host system. |
|
boolean | -- | Whether to start the service. |
|
string | 0.9.3 | The version of Nomad to install. |
Examples
Example 1
Download/install the Nomad executable and create, enable and start a systemd service unit for it.
Code
- nomad-service: enabled: true started: true
Description
This installs the Nomad binary into '/usr/local/bin' (for the Linux/amd64 platform/architecture). Then a systemd service unit 'nomad' is created, started and enabled, with the recommended settings for Nomad. Nomad server/client configuration file(s) are created separately, beforehand, in this case.
Code
doc: short_help: Install Hashicorp Nomad and run as service. help: | Download the Consul binary into '/usr/local/bin' and create a systemd service unit ('consul') and enable/start it if so specified. It is recommended to create the approriate Nomad server/client configuration files beforehand (in '/etc/nomad.d'), but this frecklet also allows for providing basic configuration options if necessary. references: Nomad install guide: https://www.nomadproject.io/guides/install/index.html Nomad homepage: https://www.nomadproject.io examples: - title: Download/install the Nomad executable and create, enable and start a systemd service unit for it. desc: | This installs the Nomad binary into '/usr/local/bin' (for the Linux/amd64 platform/architecture). Then a systemd service unit 'nomad' is created, started and enabled, with the recommended settings for Nomad. Nomad server/client configuration file(s) are created separately, beforehand, in this case. vars: enabled: true started: true args: _import: - nomad-installed - systemd-service-unit nomad_config: doc: short_help: The nomad configuration. type: dict empty: false required: false keyschema: type: string frecklets: - nomad-installed: version: '{{:: version ::}}' dest: '{{:: dest ::}}' platform: '{{:: platform ::}}' arch: '{{:: arch ::}}' owner: root group: root - config-values-in-file: frecklet::skip: '{{ nomad_config | true_if_empty }}' path: /etc/nomad.d/nomad.hcl owner: root group: root mode: '0640' config: '{{:: nomad_config ::}}' - systemd-service-unit: name: nomad unit_description: Nomad unit_documentation: - https://www.nomadproject.io/ unit_wants: - network-online.target unit_after: - network-online.target unit_start_limit_burst: 3 unit_start_limit_interval_sec: 10 service_user: root service_group: root service_exec_reload: /bin/kill -HUP $MAINPID service_exec_start: /usr/local/bin/nomad agent -config /etc/nomad.d service_kill_mode: process service_kill_signal: SIGINT service_restart: on-failure service_limit: - limit_type: NOFILE limit: infinity - limit_type: NPROC limit: infinity service_restart_sec: 2 service_tasks_max: infinity install_wanted_by: - multi-user.target enabled: '{{:: enabled ::}}' started: '{{:: started ::}}'
frecklecute nomad-service --help Usage: frecklecute nomad-service [OPTIONS] Download the Consul binary into '/usr/local/bin' and create a systemd service unit ('consul') and enable/start it if so specified. It is recommended to create the approriate Nomad server/client configuration files beforehand (in '/etc/nomad.d'), but this frecklet also allows for providing basic configuration options if necessary. Options: --arch ARCH The architecture of the host system. --dest DEST The (absolute) path to the parent folder of the downloaded executable file. --enabled / --no-enabled Whether to enable the service. --nomad-config NOMAD_CONFIG The nomad configuration. --platform PLATFORM The platform of the host system. --started / --no-started Whether to start the service. --version VERSION The version of Nomad to install. --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.nomad_service.NomadService # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class NomadService(AutoPycklet): """Download the Consul binary into '/usr/local/bin' and create a systemd service unit ('consul') and enable/start it if so specified. It is recommended to create the approriate Nomad server/client configuration files beforehand (in '/etc/nomad.d'), but this frecklet also allows for providing basic configuration options if necessary. Args: arch: The architecture of the host system. dest: The (absolute) path to the parent folder of the downloaded executable file. enabled: Whether to enable the service. nomad_config: The nomad configuration. platform: The platform of the host system. started: Whether to start the service. version: The version of Nomad to install. """ FRECKLET_ID = "nomad-service" arch: str = None dest: str = None enabled: bool = None nomad_config: Dict = None platform: str = None started: bool = None version: str = None def __post_init__(self): super(NomadService, self).__init__(var_names=["arch", "dest", "enabled", "nomad_config", "platform", "started", "version"]) frecklet_class = NomadService
# -*- coding: utf-8 -*- # # module path: pycklets.nomad_service.NomadService # from pyckles import AutoPycklet class NomadService(AutoPycklet): """Download the Consul binary into '/usr/local/bin' and create a systemd service unit ('consul') and enable/start it if so specified. It is recommended to create the approriate Nomad server/client configuration files beforehand (in '/etc/nomad.d'), but this frecklet also allows for providing basic configuration options if necessary. Args: arch: The architecture of the host system. dest: The (absolute) path to the parent folder of the downloaded executable file. enabled: Whether to enable the service. nomad_config: The nomad configuration. platform: The platform of the host system. started: Whether to start the service. version: The version of Nomad to install. """ FRECKLET_ID = "nomad-service" def __init__(self, arch=None, dest=None, enabled=None, nomad_config=None, platform=None, started=None, version="0.9.3"): super(NomadService, self).__init__(var_names=["arch", "dest", "enabled", "nomad_config", "platform", "started", "version"]) self._arch = arch self._dest = dest self._enabled = enabled self._nomad_config = nomad_config self._platform = platform self._started = started self._version = version @property def arch(self): return self._arch @arch.setter def arch(self, arch): self._arch = arch @property def dest(self): return self._dest @dest.setter def dest(self, dest): self._dest = dest @property def enabled(self): return self._enabled @enabled.setter def enabled(self, enabled): self._enabled = enabled @property def nomad_config(self): return self._nomad_config @nomad_config.setter def nomad_config(self, nomad_config): self._nomad_config = nomad_config @property def platform(self): return self._platform @platform.setter def platform(self, platform): self._platform = platform @property def started(self): return self._started @started.setter def started(self, started): self._started = started @property def version(self): return self._version @version.setter def version(self, version): self._version = version frecklet_class = NomadService