consul-config-file

Description

Consul daemon config file.

Variables

Name Type Default Description

data_dir

string --

This flag provides a data directory for the agent to store state. This is required for all agents. The directory should be durable across reboots. This is especially critical for agents that are running in server mode as they must be able to persist cluster state. Additionally, the directory must support the use of filesystem locking, meaning some types of mounted folders (e.g. VirtualBox shared folders) may not be suitable. Note: both server and non-server agents may store ACL tokens in the state in this directory so read access may grant access to any tokens on servers and to any tokens used during service registration on non-servers. On Unix-based platforms the files are written with 0600 permissions so you should ensure only trusted processes can execute as the same user as Consul. On Windows, you should ensure the directory has suitable permissions configured as these will be inherited. Required

encrypt

string --

Specifies the secret key to use for encryption of Consul network traffic. This key must be 16-bytes that are Base64-encoded. The easiest way to create an encryption key is to use consul keygen. All nodes within a cluster must share the same encryption key to communicate. The provided key is automatically persisted to the data directory and loaded automatically whenever the agent is restarted. This means that to encrypt Consul's gossip protocol, this option only needs to be provided once on each agent's initial startup sequence. If it is provided after Consul has been initialized with an encryption key, then the provided key is ignored and a warning will be displayed. Required

path

string --

The path to the file. Required

client_addr

string --

The address to which Consul will bind client interfaces, including the HTTP and DNS servers. By default, this is "127.0.0.1", allowing only loopback connections. In Consul 1.0 and later this can be set to a space-separated list of addresses to bind to, or a go-sockaddr template that can potentially resolve to multiple addresses.

datacenter

string dc1

This flag controls the datacenter in which the agent is running.

If not provided, it defaults to "dc1". Consul has first-class support for multiple datacenters, but it relies on proper configuration. Nodes in the same datacenter should be on a single LAN.

group

string --

The group of the file.

mode

string --

The permissions of the file.

owner

string --

The owner of the file.

retry_join

list --

Similar to 'join' but allows retrying a join if the first attempt fails. This is useful for cases where you know the address will eventually be available. The list can contain IPv4, IPv6, or DNS addresses. In Consul 1.1.0 and later this can be set to a go-sockaddr template. If Consul is running on the non-default Serf LAN port, this must be specified as well. IPv6 must use the "bracketed" syntax. If multiple values are given, they are tried and retried in the order listed until the first succeeds. Here are some examples:

# Using a DNS entry
$ consul agent -retry-join "consul.domain.internal"

# Using IPv4
$ consul agent -retry-join "10.0.4.67"

# Using IPv6
$ consul agent -retry-join "[::1]:8301"

Code

doc:
  short_help: Consul daemon config file.

args:
  datacenter:
    doc:
      short_help: This flag controls the datacenter in which the agent is running.
      help: |
        This flag controls the datacenter in which the agent is running.

        If not provided, it defaults to "dc1". Consul has first-class support for multiple datacenters, but it relies on proper configuration. Nodes in the same datacenter should be on a single LAN.
    type: string
    default: dc1
    required: true
  data_dir:
    doc:
      short_help: This flag provides a data directory for the agent to store state.
      help: |
        This flag provides a data directory for the agent to store state. This is required for all agents. The directory should be durable across reboots. This is especially critical for agents that are running in server mode as they must be able to persist cluster state. Additionally, the directory must support the use of filesystem locking, meaning some types of mounted folders (e.g. VirtualBox shared folders) may not be suitable. Note: both server and non-server agents may store ACL tokens in the state in this directory so read access may grant access to any tokens on servers and to any tokens used during service registration on non-servers. On Unix-based platforms the files are written with 0600 permissions so you should ensure only trusted processes can execute as the same user as Consul. On Windows, you should ensure the directory has suitable permissions configured as these will be inherited.
    type: string
    required: true
  encrypt:
    doc:
      short_help: Specifies the secret key to use for encryption of Consul network
        traffic.
      help: |
        Specifies the secret key to use for encryption of Consul network traffic. This key must be 16-bytes that are Base64-encoded. The easiest way to create an encryption key is to use consul keygen. All nodes within a cluster must share the same encryption key to communicate. The provided key is automatically persisted to the data directory and loaded automatically whenever the agent is restarted. This means that to encrypt Consul's gossip protocol, this option only needs to be provided once on each agent's initial startup sequence. If it is provided after Consul has been initialized with an encryption key, then the provided key is ignored and a warning will be displayed.
    type: string
    required: true
    secret: true
  client_addr:
    doc:
      short_help: The address to which Consul will bind client interfaces, including
        the HTTP and DNS servers.
      help: |
        The address to which Consul will bind client interfaces, including the HTTP and DNS servers. By default, this is "127.0.0.1", allowing only loopback connections. In Consul 1.0 and later this can be set to a space-separated list of addresses to bind to, or a go-sockaddr template that can potentially resolve to multiple addresses.
    type: string
    required: false
  retry_join:
    doc:
      short_help: Similar to 'join' but allows retrying a join if the first attempt
        fails.
      help: |
        Similar to 'join' but allows retrying a join if the first attempt fails. This is useful for cases where you know the address will eventually be available. The list can contain IPv4, IPv6, or DNS addresses. In Consul 1.1.0 and later this can be set to a go-sockaddr template. If Consul is running on the non-default Serf LAN port, this must be specified as well. IPv6 must use the "bracketed" syntax. If multiple values are given, they are tried and retried in the order listed until the first succeeds. Here are some examples:

            # Using a DNS entry
            $ consul agent -retry-join "consul.domain.internal"

            # Using IPv4
            $ consul agent -retry-join "10.0.4.67"

            # Using IPv6
            $ consul agent -retry-join "[::1]:8301"
    type: list
    schema:
      type: string
    empty: false
    required: false
  _import:
  - file-with-content
frecklets:
- file-with-content:
    path: '{{:: path ::}}'
    group: '{{:: group ::}}'
    owner: '{{:: owner ::}}'
    mode: '{{:: mode ::}}'
    content: |-
      datacenter = "{{:: datacenter ::}}"
      data_dir = "{{:: data_dir ::}}"
      encrypt = "{{:: encrypt ::}}"
      {%:: if client_addr is defined ::%}client_addr = "{{:: client_addr ::}}"{%:: endif ::%}
      {%:: if retry_join is defined and retry_join ::%}retry_join = [{{:: retry_join | map('quote') | join(', ') ::}}]{%:: endif ::%}
frecklecute consul-config-file --help

Usage: frecklecute consul-config-file [OPTIONS] PATH

  Consul daemon config file.

Options:
  --data-dir DATA_DIR        This flag provides a data directory for the agent
                             to store state.  [required]
  --encrypt ENCRYPT          Specifies the secret key to use for encryption of
                             Consul network traffic.  [required]
  --client-addr CLIENT_ADDR  The address to which Consul will bind client
                             interfaces, including the HTTP and DNS servers.
  --datacenter DATACENTER    This flag controls the datacenter in which the
                             agent is running.
  --group GROUP              The group of the file.
  --mode MODE                The permissions of the file.
  --owner USER               The owner of the file.
  --retry-join RETRY_JOIN    Similar to 'join' but allows retrying a join if
                             the first attempt fails.
  --help                     Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.consul_config_file.ConsulConfigFile
#


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

@dataclass
class ConsulConfigFile(AutoPycklet):
    """Consul daemon config file.

       Args:
         client_addr: The address to which Consul will bind client interfaces, including the HTTP and DNS servers.
         data_dir: This flag provides a data directory for the agent to store state.
         datacenter: This flag controls the datacenter in which the agent is running.
         encrypt: Specifies the secret key to use for encryption of Consul network traffic.
         group: The group of the file.
         mode: The permissions of the file.
         owner: The owner of the file.
         path: The path to the file.
         retry_join: Similar to 'join' but allows retrying a join if the first attempt fails.

    """

    FRECKLET_ID = "consul-config-file"

    client_addr: str = None
    data_dir: str = None
    datacenter: str = None
    encrypt: str = None
    group: str = None
    mode: str = None
    owner: str = None
    path: str = None
    retry_join: List = None


    def __post_init__(self):
        super(ConsulConfigFile, self).__init__(var_names=["client_addr", "data_dir", "datacenter", "encrypt", "group", "mode", "owner", "path", "retry_join"])


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


#
# module path: pycklets.consul_config_file.ConsulConfigFile
#


from pyckles import AutoPycklet

class ConsulConfigFile(AutoPycklet):
    """Consul daemon config file.

       Args:
         client_addr: The address to which Consul will bind client interfaces, including the HTTP and DNS servers.
         data_dir: This flag provides a data directory for the agent to store state.
         datacenter: This flag controls the datacenter in which the agent is running.
         encrypt: Specifies the secret key to use for encryption of Consul network traffic.
         group: The group of the file.
         mode: The permissions of the file.
         owner: The owner of the file.
         path: The path to the file.
         retry_join: Similar to 'join' but allows retrying a join if the first attempt fails.

    """

    FRECKLET_ID = "consul-config-file"

    def __init__(self, client_addr=None, data_dir=None, datacenter="dc1", encrypt=None, group=None, mode=None, owner=None, path=None, retry_join=None):

        super(ConsulConfigFile, self).__init__(var_names=["client_addr", "data_dir", "datacenter", "encrypt", "group", "mode", "owner", "path", "retry_join"])
        self._client_addr = client_addr
        self._data_dir = data_dir
        self._datacenter = datacenter
        self._encrypt = encrypt
        self._group = group
        self._mode = mode
        self._owner = owner
        self._path = path
        self._retry_join = retry_join

    @property
    def client_addr(self):
        return self._client_addr

    @client_addr.setter
    def client_addr(self, client_addr):
        self._client_addr = client_addr

    @property
    def data_dir(self):
        return self._data_dir

    @data_dir.setter
    def data_dir(self, data_dir):
        self._data_dir = data_dir

    @property
    def datacenter(self):
        return self._datacenter

    @datacenter.setter
    def datacenter(self, datacenter):
        self._datacenter = datacenter

    @property
    def encrypt(self):
        return self._encrypt

    @encrypt.setter
    def encrypt(self, encrypt):
        self._encrypt = encrypt

    @property
    def group(self):
        return self._group

    @group.setter
    def group(self, group):
        self._group = group

    @property
    def mode(self):
        return self._mode

    @mode.setter
    def mode(self, mode):
        self._mode = mode

    @property
    def owner(self):
        return self._owner

    @owner.setter
    def owner(self, owner):
        self._owner = owner

    @property
    def path(self):
        return self._path

    @path.setter
    def path(self, path):
        self._path = path

    @property
    def retry_join(self):
        return self._retry_join

    @retry_join.setter
    def retry_join(self, retry_join):
        self._retry_join = retry_join



frecklet_class = ConsulConfigFile