lxd-service

Example:

# Install and enable LXD, add 'admin' to the list of users who can use it.
- lxd-service:
    users:
    - admin

Description

Install/enable LXD on a target system.

Resources

Variables

Name Type Default Description

bridge_addr

string --

The ipv4 address for the bridge.

bridge_dhcp_max

integer --

The ipv4 dhcp max value.

bridge_dhcp_range

string --

The ipv4 dhcp range (e.g. '10.10.10.2,10.10.10.200')

bridge_ipv6_proxy

boolean --

Whether to enable the ipv6 proxy on the bridge.

bridge_name

string --

If used, the name of the bridge.

bridge_nat

boolean --

Whether to enable nat for the ipv4 bridge.

bridge_netmask

string --

The ipv4 netmask.

bridge_network

string --

The ipv4 network (in CIDR, e.g. '10.10.10.10/24').

create_bridge

boolean True

Whether to use (and create if necessary) a bridge network (default: true)

subid_range

integer --

Subid range.

subid_start

integer --

Subid start.

users

list --

A list of users who will be added to the 'lxd' group.

Examples

Example 1

Install and enable LXD, add 'admin' to the list of users who can use it.

Code
- lxd-service:
    users:
    - admin

Code

doc:
  short_help: Install/enable LXD on a target system.
  references:
    "'juju4.lxd' Ansible role": https://github.com/juju4/ansible-lxd
  examples:
  - title: Install and enable LXD, add 'admin' to the list of users who can use it.
    vars:
      users:
      - admin
args:
  users:
    doc:
      short_help: A list of users who will be added to the 'lxd' group.
    required: false
    type: list
    cli:
      param_decls:
      - --user
      - -u
      metavar: USER
  create_bridge:
    doc:
      short_help: 'Whether to use (and create if necessary) a bridge network (default:
        true)'
    type: boolean
    default: true
    required: false
  bridge_name:
    doc:
      short_help: If used, the name of the bridge.
    type: string
    required: false
  bridge_network:
    doc:
      short_help: The ipv4 network (in CIDR, e.g. '10.10.10.10/24').
    type: string
    required: false
  bridge_netmask:
    doc:
      short_help: The ipv4 netmask.
    type: string
    required: false
  bridge_addr:
    doc:
      short_help: The ipv4 address for the bridge.
    type: string
    required: false
  bridge_dhcp_range:
    doc:
      short_help: The ipv4 dhcp range (e.g. '10.10.10.2,10.10.10.200')
    type: string
    required: false
  bridge_dhcp_max:
    doc:
      short_help: The ipv4 dhcp max value.
    type: integer
    required: false
  bridge_nat:
    doc:
      short_help: Whether to enable nat for the ipv4 bridge.
    type: boolean
    required: false
  bridge_ipv6_proxy:
    doc:
      short_help: Whether to enable the ipv6 proxy on the bridge.
    type: boolean
    required: false
  subid_start:
    doc:
      short_help: Subid start.
    type: integer
    required: false
  subid_range:
    doc:
      short_help: Subid range.
    type: integer
    required: false

meta:
  status:
    supported:
    - ubuntu
    tested:
    - ubuntu
    not_working:
    - debian

frecklets:
- frecklet:
    name: juju4.lxd
    type: ansible-role
    properties:
      internet: true
      elevated: true
      idempotent: true
    desc:
      short: install and enable 'lxd' service
    resources:
      ansible-role:
      - juju4.redhat_epel
  task:
    become: true
    include-type: import
  vars:
    lxd_bridgeconf_use_bridge: '{{:: create_bridge ::}}'
    lxd_bridgeconf_bridge: '{{:: bridge_name ::}}'
    lxd_fanconf_use_fan: false
    lxd_bridgeconf_ipv4_addr: '{{:: bridge_addr ::}}'
    lxd_bridgeconf_ipv4_netmask: '{{:: bridge_netmask ::}}'
    lxd_bridgeconf_ipv4_network: '{{:: bridge_network ::}}'
    lxd_bridgeconf_ipv4_dhcp_range: '{{:: bridge_dhcp_range ::}}'
    lxd_bridgeconf_ipv4_dhcp_max: '{{:: bridge_dhcp_max ::}}'
    lxd_bridgeconf_ipv4_nat: '{{:: bridge_nat ::}}'
    lxd_bridgeconf_ipv6_proxy: '{{:: bridge_ipv6_proxy ::}}'
    lxd_subid_start: '{{:: subid_start ::}}'
    lxd_subid_range: '{{:: subid_range ::}}'
- users-are-members-of-group:
    frecklet::skip: '{{:: users | true_if_empty ::}}'
    users: '{{:: users ::}}'
    group: lxd
frecklecute lxd-service --help

Usage: frecklecute lxd-service [OPTIONS]

  Install/enable LXD on a target system.

Options:
  --bridge-addr BRIDGE_ADDR       The ipv4 address for the bridge.
  --bridge-dhcp-max BRIDGE_DHCP_MAX
                                  The ipv4 dhcp max value.
  --bridge-dhcp-range BRIDGE_DHCP_RANGE
                                  The ipv4 dhcp range (e.g.
                                  '10.10.10.2,10.10.10.200')
  --bridge-ipv6-proxy / --no-bridge-ipv6-proxy
                                  Whether to enable the ipv6 proxy on the
                                  bridge.
  --bridge-name BRIDGE_NAME       If used, the name of the bridge.
  --bridge-nat / --no-bridge-nat  Whether to enable nat for the ipv4 bridge.
  --bridge-netmask BRIDGE_NETMASK
                                  The ipv4 netmask.
  --bridge-network BRIDGE_NETWORK
                                  The ipv4 network (in CIDR, e.g.
                                  '10.10.10.10/24').
  --create-bridge / --no-create-bridge
                                  Whether to use (and create if necessary) a
                                  bridge network (default: true)
  --subid-range SUBID_RANGE       Subid range.
  --subid-start SUBID_START       Subid start.
  -u, --user USER                 A list of users who will be added to the
                                  'lxd' group.
  --help                          Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.lxd_service.LxdService
#


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

@dataclass
class LxdService(AutoPycklet):
    """Install/enable LXD on a target system.

       Args:
         bridge_addr: The ipv4 address for the bridge.
         bridge_dhcp_max: The ipv4 dhcp max value.
         bridge_dhcp_range: The ipv4 dhcp range (e.g. '10.10.10.2,10.10.10.200')
         bridge_ipv6_proxy: Whether to enable the ipv6 proxy on the bridge.
         bridge_name: If used, the name of the bridge.
         bridge_nat: Whether to enable nat for the ipv4 bridge.
         bridge_netmask: The ipv4 netmask.
         bridge_network: The ipv4 network (in CIDR, e.g. '10.10.10.10/24').
         create_bridge: Whether to use (and create if necessary) a bridge network (default: true)
         subid_range: Subid range.
         subid_start: Subid start.
         users: A list of users who will be added to the 'lxd' group.

    """

    FRECKLET_ID = "lxd-service"

    bridge_addr: str = None
    bridge_dhcp_max: int = None
    bridge_dhcp_range: str = None
    bridge_ipv6_proxy: bool = None
    bridge_name: str = None
    bridge_nat: bool = None
    bridge_netmask: str = None
    bridge_network: str = None
    create_bridge: bool = None
    subid_range: int = None
    subid_start: int = None
    users: List = None


    def __post_init__(self):
        super(LxdService, self).__init__(var_names=["bridge_addr", "bridge_dhcp_max", "bridge_dhcp_range", "bridge_ipv6_proxy", "bridge_name", "bridge_nat", "bridge_netmask", "bridge_network", "create_bridge", "subid_range", "subid_start", "users"])


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


#
# module path: pycklets.lxd_service.LxdService
#


from pyckles import AutoPycklet

class LxdService(AutoPycklet):
    """Install/enable LXD on a target system.

       Args:
         bridge_addr: The ipv4 address for the bridge.
         bridge_dhcp_max: The ipv4 dhcp max value.
         bridge_dhcp_range: The ipv4 dhcp range (e.g. '10.10.10.2,10.10.10.200')
         bridge_ipv6_proxy: Whether to enable the ipv6 proxy on the bridge.
         bridge_name: If used, the name of the bridge.
         bridge_nat: Whether to enable nat for the ipv4 bridge.
         bridge_netmask: The ipv4 netmask.
         bridge_network: The ipv4 network (in CIDR, e.g. '10.10.10.10/24').
         create_bridge: Whether to use (and create if necessary) a bridge network (default: true)
         subid_range: Subid range.
         subid_start: Subid start.
         users: A list of users who will be added to the 'lxd' group.

    """

    FRECKLET_ID = "lxd-service"

    def __init__(self, bridge_addr=None, bridge_dhcp_max=None, bridge_dhcp_range=None, bridge_ipv6_proxy=None, bridge_name=None, bridge_nat=None, bridge_netmask=None, bridge_network=None, create_bridge=True, subid_range=None, subid_start=None, users=None):

        super(LxdService, self).__init__(var_names=["bridge_addr", "bridge_dhcp_max", "bridge_dhcp_range", "bridge_ipv6_proxy", "bridge_name", "bridge_nat", "bridge_netmask", "bridge_network", "create_bridge", "subid_range", "subid_start", "users"])
        self._bridge_addr = bridge_addr
        self._bridge_dhcp_max = bridge_dhcp_max
        self._bridge_dhcp_range = bridge_dhcp_range
        self._bridge_ipv6_proxy = bridge_ipv6_proxy
        self._bridge_name = bridge_name
        self._bridge_nat = bridge_nat
        self._bridge_netmask = bridge_netmask
        self._bridge_network = bridge_network
        self._create_bridge = create_bridge
        self._subid_range = subid_range
        self._subid_start = subid_start
        self._users = users

    @property
    def bridge_addr(self):
        return self._bridge_addr

    @bridge_addr.setter
    def bridge_addr(self, bridge_addr):
        self._bridge_addr = bridge_addr

    @property
    def bridge_dhcp_max(self):
        return self._bridge_dhcp_max

    @bridge_dhcp_max.setter
    def bridge_dhcp_max(self, bridge_dhcp_max):
        self._bridge_dhcp_max = bridge_dhcp_max

    @property
    def bridge_dhcp_range(self):
        return self._bridge_dhcp_range

    @bridge_dhcp_range.setter
    def bridge_dhcp_range(self, bridge_dhcp_range):
        self._bridge_dhcp_range = bridge_dhcp_range

    @property
    def bridge_ipv6_proxy(self):
        return self._bridge_ipv6_proxy

    @bridge_ipv6_proxy.setter
    def bridge_ipv6_proxy(self, bridge_ipv6_proxy):
        self._bridge_ipv6_proxy = bridge_ipv6_proxy

    @property
    def bridge_name(self):
        return self._bridge_name

    @bridge_name.setter
    def bridge_name(self, bridge_name):
        self._bridge_name = bridge_name

    @property
    def bridge_nat(self):
        return self._bridge_nat

    @bridge_nat.setter
    def bridge_nat(self, bridge_nat):
        self._bridge_nat = bridge_nat

    @property
    def bridge_netmask(self):
        return self._bridge_netmask

    @bridge_netmask.setter
    def bridge_netmask(self, bridge_netmask):
        self._bridge_netmask = bridge_netmask

    @property
    def bridge_network(self):
        return self._bridge_network

    @bridge_network.setter
    def bridge_network(self, bridge_network):
        self._bridge_network = bridge_network

    @property
    def create_bridge(self):
        return self._create_bridge

    @create_bridge.setter
    def create_bridge(self, create_bridge):
        self._create_bridge = create_bridge

    @property
    def subid_range(self):
        return self._subid_range

    @subid_range.setter
    def subid_range(self, subid_range):
        self._subid_range = subid_range

    @property
    def subid_start(self):
        return self._subid_start

    @subid_start.setter
    def subid_start(self, subid_start):
        self._subid_start = subid_start

    @property
    def users(self):
        return self._users

    @users.setter
    def users(self, users):
        self._users = users



frecklet_class = LxdService