docker-service

Example:

# Install docker, adding the 'freckles' user to the 'docker' group.
- docker-service:
    users:
    - freckles

Description

Installs Docker on a Linux machine.

If the users variable is set, those users will be created if they don't exist yet. Do this seperately if you need to have more control about user creation (e.g. to provide password, ssh-pub-keys, etc.)

Windows and Mac OS X are not supported just yet.

Resources

Variables

Name Type Default Description

enabled

boolean True

Whether to enable the docker service or not.

started

boolean True

Whether to start the docker service or not.

users

list --

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

Examples

Example 1

Install docker, adding the 'freckles' user to the 'docker' group.

Code
- docker-service:
    users:
    - freckles

Code

doc:
  short_help: Makes sure Docker is installed.
  help: |
    Installs Docker on a Linux machine.

    If the ``users`` variable is set, those users will be created if they don't exist yet. Do this seperately if you need to have more
    control about user creation (e.g. to provide password, ssh-pub-keys, etc.)

    Windows and Mac OS X are not supported just yet.

  references:
    docker homepage: https://docker.com
    geerlingguy.docker Ansible role: https://github.com/geerlingguy/ansible-role-docker
  examples:
  - title: Install docker, adding the 'freckles' user to the 'docker' group.
    vars:
      users:
      - freckles

args:
  users:
    doc:
      short_help: A list of users who will be added to the 'docker' group.
    required: false
    type: list
    cli:
      param_decls:
      - --user
      - -u
      metavar: USER
  enabled:
    doc:
      short_help: Whether to enable the docker service or not.
    type: boolean
    required: false
    default: true
    cli:
      is_flag: true
  started:
    doc:
      short_help: Whether to start the docker service or not.
    type: boolean
    required: false
    default: true
    cli:
      is_flag: true

meta:
  tags:
  - install
  - docker
  - container
  - featured-frecklecutable
  - virtualization

frecklets:
- git-installed
- pip-requirements-present
- task:
    become: true
  frecklet:
    name: pip
    type: ansible-module
    desc:
      short: install docker client pip package
      references:
        "'pip' Ansible module": https://docs.ansible.com/ansible/latest/modules/pip_module.html
    properties:
      idempotent: true
      elevated: true
      internet: true
  vars:
    name: docker
- task:
    become: true
    include-type: import
  frecklet:
    name: geerlingguy.docker
    type: ansible-role
    resources:
      ansible-role:
      - geerlingguy.docker
    desc:
      short: install docker service
      references:
        "'geerlingguy.docker' Ansible role": https://github.com/geerlingguy/ansible-role-docker
    properties:
      idempotent: true
      internet: true
      elevated: true
  vars:
    docker_users: '{{:: users ::}}'
    docker_service_state: "{{:: started | string_for_boolean('started', 'stopped')\
      \ ::}}"
    docker_service_enabled: '{{:: enabled ::}}'
frecklecute docker-service --help

Usage: frecklecute docker-service [OPTIONS]

  Installs Docker on a Linux machine.

  If the ``users`` variable is set, those users will be created if they
  don't exist yet. Do this seperately if you need to have more control about
  user creation (e.g. to provide password, ssh-pub-keys, etc.)

  Windows and Mac OS X are not supported just yet.

Options:
  --enabled / --no-enabled  Whether to enable the docker service or not.
  --started / --no-started  Whether to start the docker service or not.
  -u, --user USER           A list of users who will be added to the 'docker'
                            group.
  --help                    Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.docker_service.DockerService
#


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

@dataclass
class DockerService(AutoPycklet):
    """Installs Docker on a Linux machine.

     If the ``users`` variable is set, those users will be created if they don't exist yet. Do this seperately if you need to have more
     control about user creation (e.g. to provide password, ssh-pub-keys, etc.)

     Windows and Mac OS X are not supported just yet.

       Args:
         enabled: Whether to enable the docker service or not.
         started: Whether to start the docker service or not.
         users: A list of users who will be added to the 'docker' group.

    """

    FRECKLET_ID = "docker-service"

    enabled: bool = None
    started: bool = None
    users: List = None


    def __post_init__(self):
        super(DockerService, self).__init__(var_names=["enabled", "started", "users"])


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


#
# module path: pycklets.docker_service.DockerService
#


from pyckles import AutoPycklet

class DockerService(AutoPycklet):
    """Installs Docker on a Linux machine.

     If the ``users`` variable is set, those users will be created if they don't exist yet. Do this seperately if you need to have more
     control about user creation (e.g. to provide password, ssh-pub-keys, etc.)

     Windows and Mac OS X are not supported just yet.

       Args:
         enabled: Whether to enable the docker service or not.
         started: Whether to start the docker service or not.
         users: A list of users who will be added to the 'docker' group.

    """

    FRECKLET_ID = "docker-service"

    def __init__(self, enabled=True, started=True, users=None):

        super(DockerService, self).__init__(var_names=["enabled", "started", "users"])
        self._enabled = enabled
        self._started = started
        self._users = users

    @property
    def enabled(self):
        return self._enabled

    @enabled.setter
    def enabled(self, enabled):
        self._enabled = enabled

    @property
    def started(self):
        return self._started

    @started.setter
    def started(self, started):
        self._started = started

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

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



frecklet_class = DockerService