gitlab-runner-service-linux

Description

Ensures a gitlab-runner service exists on a machine

Variables

Name Type Default Description

arch

string amd64

The architecture of the target system.

group

string gitlab-runner

The name of the gitlab-runner service group.

install_docker

boolean False

Whether to also install Docker.

user

string gitlab-runner

The name of the gitlab-runner service user.

Code

doc:
  short_help: Ensures a gitlab-runner service exists on a machine

args:
  _import: gitlab-runner-installed
  user:
    doc:
      short_help: The name of the gitlab-runner service user.
    type: string
    required: false
    default: gitlab-runner
  group:
    doc:
      short_help: The name of the gitlab-runner service group.
    type: string
    required: false
    default: gitlab-runner
  install_docker:
    doc:
      short_help: Whether to also install Docker.
    type: boolean
    required: false
    default: false
    cli:
      param_decls:
      - --install-docker

frecklets:
- user-exists:
    name: '{{:: user ::}}'
    group: '{{:: group ::}}'
- gitlab-runner-installed:
    dest: /usr/local/bin
    owner: '{{:: user ::}}'
    group: '{{:: group ::}}'
    platform: linux
    arch: '{{:: arch ::}}'
- execute-shell:
    command: /usr/local/bin/gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
    become_user: root
    chdir: /usr/local/bin
- execute-shell:
    command: /usr/local/bin/gitlab-runner start
    become_user: root
    chdir: /usr/local/bin
- docker-service:
    frecklet::skip: '{{:: install_docker | negate ::}}'
    users:
    - gitlab-runner
frecklecute gitlab-runner-service-linux --help

Usage: frecklecute gitlab-runner-service-linux [OPTIONS]

  Ensures a gitlab-runner service exists on a machine

Options:
  --arch ARCH       The architecture of the target system.
  --group GROUP     The name of the gitlab-runner service group.
  --install-docker  Whether to also install Docker.
  --user USER       The name of the gitlab-runner service user.
  --help            Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.gitlab_runner_service_linux.GitlabRunnerServiceLinux
#


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

@dataclass
class GitlabRunnerServiceLinux(AutoPycklet):
    """Ensures a gitlab-runner service exists on a machine

       Args:
         arch: The architecture of the target system.
         group: The name of the gitlab-runner service group.
         install_docker: Whether to also install Docker.
         user: The name of the gitlab-runner service user.

    """

    FRECKLET_ID = "gitlab-runner-service-linux"

    arch: str = None
    group: str = None
    install_docker: bool = None
    user: str = None


    def __post_init__(self):
        super(GitlabRunnerServiceLinux, self).__init__(var_names=["arch", "group", "install_docker", "user"])


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


#
# module path: pycklets.gitlab_runner_service_linux.GitlabRunnerServiceLinux
#


from pyckles import AutoPycklet

class GitlabRunnerServiceLinux(AutoPycklet):
    """Ensures a gitlab-runner service exists on a machine

       Args:
         arch: The architecture of the target system.
         group: The name of the gitlab-runner service group.
         install_docker: Whether to also install Docker.
         user: The name of the gitlab-runner service user.

    """

    FRECKLET_ID = "gitlab-runner-service-linux"

    def __init__(self, arch="amd64", group="gitlab-runner", install_docker=None, user="gitlab-runner"):

        super(GitlabRunnerServiceLinux, self).__init__(var_names=["arch", "group", "install_docker", "user"])
        self._arch = arch
        self._group = group
        self._install_docker = install_docker
        self._user = user

    @property
    def arch(self):
        return self._arch

    @arch.setter
    def arch(self, arch):
        self._arch = arch

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

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

    @property
    def install_docker(self):
        return self._install_docker

    @install_docker.setter
    def install_docker(self, install_docker):
        self._install_docker = install_docker

    @property
    def user(self):
        return self._user

    @user.setter
    def user(self, user):
        self._user = user



frecklet_class = GitlabRunnerServiceLinux