Puppet Class: github_actions_runner

Defined in:
manifests/init.pp

Summary

Manages actions_runner service and configuration

Overview

Parameters:

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    Determine if to add or remove the resource.

  • base_dir_name (Stdlib::Absolutepath) (defaults to: '/some_dir/actions-runner')

    Location of the base directory for actions runner to be installed.

  • org_name (Optional[String[1]]) (defaults to: undef)

    actions runner org name.

  • enterprise_name (Optional[String[1]]) (defaults to: undef)

    enterprise name for global runners

  • personal_access_token (String[1]) (defaults to: 'PAT')

    GitHub PAT with admin permission on the repositories or the origanization.

  • package_name (String[1]) (defaults to: $facts['os']['architecture'] ? { /x86_64|amd64/ => 'actions-runner-linux-x64', 'aarch64' => 'actions-runner-linux-arm64')

    GitHub Actions runner offical package name.

  • package_ensure (String[1]) (defaults to: '2.319.1')

    GitHub Actions runner version to be used.

  • repository_url (String[1]) (defaults to: 'https://github.com/actions/runner/releases/download')

    URL to download GitHub actions runner.

  • user (String[1]) (defaults to: 'root')

    User to be used in Service and directories.

  • group (String[1]) (defaults to: 'root')

    Group to be used in Service and directories.

  • instances (Hash[String[1], Hash]) (defaults to: {})

    Github Runner Instances to be managed.

  • github_domain (String[1]) (defaults to: 'https://github.com')

    Base URL for Github Domain.

  • github_api (String[1]) (defaults to: 'https://api.github.com')

    Base URL for Github API.

  • http_proxy (Optional[String[1]]) (defaults to: undef)
  • https_proxy (Optional[String[1]]) (defaults to: undef)
  • no_proxy (Optional[String[1]]) (defaults to: undef)

    Comma separated list of hosts that should not use a proxy. More information at docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners

  • disable_update (Boolean) (defaults to: false)

    toggle for disabling automatic runner updates.

  • path (Optional[Array[String]]) (defaults to: undef)

    List of paths to be used as PATH env in the instance runner. If not defined, file “.path” will be kept as created by the runner scripts. Default value: undef

  • env (Optional[Hash[String, String]]) (defaults to: undef)

    List of variables to be used as env variables in the instance runner. If not defined, file “.env” will be kept as created by the runner scripts. (Default: Value set by github_actions_runner Class)



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'manifests/init.pp', line 24

class github_actions_runner (
  String[1]                      $personal_access_token = 'PAT',
  Enum['present', 'absent']      $ensure = 'present',
  Stdlib::Absolutepath           $base_dir_name = '/some_dir/actions-runner',
  String[1]                      $package_name = $facts['os']['architecture'] ? { /x86_64|amd64/ => 'actions-runner-linux-x64', 'aarch64' => 'actions-runner-linux-arm64' },
  String[1]                      $package_ensure = '2.319.1',
  String[1]                      $repository_url = 'https://github.com/actions/runner/releases/download',
  String[1]                      $user = 'root',
  String[1]                      $group = 'root',
  Hash[String[1], Hash]          $instances = {},
  String[1]                      $github_domain = 'https://github.com',
  String[1]                      $github_api = 'https://api.github.com',
  Optional[String[1]]            $enterprise_name = undef,
  Optional[String[1]]            $org_name = undef,
  Optional[String[1]]            $http_proxy = undef,
  Optional[String[1]]            $https_proxy = undef,
  Optional[String[1]]            $no_proxy = undef,
  Boolean                        $disable_update = false,
  Optional[Array[String]]        $path = undef,
  Optional[Hash[String, String]] $env = undef,
) {
  $root_dir = "${github_actions_runner::base_dir_name}-${github_actions_runner::package_ensure}"

  $ensure_directory = $github_actions_runner::ensure ? {
    'present' => directory,
    'absent'  => absent,
  }

  file { $github_actions_runner::root_dir:
    ensure => $ensure_directory,
    mode   => '0644',
    owner  => $github_actions_runner::user,
    group  => $github_actions_runner::group,
    force  => true,
  }

  create_resources(github_actions_runner::instance, $github_actions_runner::instances)
}