All Projects → MonolithProjects → ansible-github_actions_runner

MonolithProjects / ansible-github_actions_runner

Licence: MIT license
Ansible Role to deploy GitHub Actions self-hosted runner

Projects that are alternatives of or similar to ansible-github actions runner

Android-CICD
This repo demonstrates how to work on CI/CD for Mobile Apps 📱 using Github Actions 💊 + Firebase Distribution 🎉
Stars: ✭ 37 (-51.32%)
Mutual labels:  actions, cicd
Doact
A Terraform module for hosting your own runner for CI/CD on Digital Ocean to run jobs in your GitHub Actions workflows. 🚀
Stars: ✭ 42 (-44.74%)
Mutual labels:  self-hosted, runner
zusam
Private groups to share messages, photos, videos, links with friends and family.
Stars: ✭ 79 (+3.95%)
Mutual labels:  self-hosted, private
github-act-runner
act as self-hosted runner
Stars: ✭ 68 (-10.53%)
Mutual labels:  actions, self-hosted
actions
Our Library of GitHub Actions
Stars: ✭ 49 (-35.53%)
Mutual labels:  actions, cicd
deployer-php-action
Deploy PHP projects using Deployer from Github Actions
Stars: ✭ 57 (-25%)
Mutual labels:  actions, cicd
devliver
Your private self hosted composer repository with user management
Stars: ✭ 50 (-34.21%)
Mutual labels:  self-hosted, private
SheetAble
Self-hosted music sheet organizing software
Stars: ✭ 107 (+40.79%)
Mutual labels:  self-hosted
hexon
Let's hexo online.
Stars: ✭ 28 (-63.16%)
Mutual labels:  self-hosted
ansible-role-solita.jenkins
Ansible role: Jenkins, completely configured with Ansible
Stars: ✭ 21 (-72.37%)
Mutual labels:  ansible-role
fullstack-grpc
gRPC web with REST gateway and interceptors and example web app with envoy proxy
Stars: ✭ 42 (-44.74%)
Mutual labels:  actions
gradle-actions
Github Actions for Gradle
Stars: ✭ 29 (-61.84%)
Mutual labels:  actions
action-label-syncer
GitHub Action to sync GitHub labels in the declarative way
Stars: ✭ 138 (+81.58%)
Mutual labels:  actions
setup-timezone
setup timezone for actions
Stars: ✭ 20 (-73.68%)
Mutual labels:  actions
swetrix-js
The JavaScript analytics client for Swetrix Analytics
Stars: ✭ 28 (-63.16%)
Mutual labels:  self-hosted
github-env-vars-action
🚀 GitHub Action for Environment Variables
Stars: ✭ 129 (+69.74%)
Mutual labels:  cicd
ansible-role-docker-ce
Ansible role to install Docker CE on AlmaLinux/Rocky/CentOS/Fedora/RHEL(Redhat)/Ubuntu/Debian/Mint/Raspbian
Stars: ✭ 73 (-3.95%)
Mutual labels:  ansible-role
nodejs
Ansible role for nodejs
Stars: ✭ 21 (-72.37%)
Mutual labels:  ansible-role
ansible-role-k8s
This role render an arbitrary number of Jinja2 templates and deploys or removes them to/from Kubernetes clusters.
Stars: ✭ 26 (-65.79%)
Mutual labels:  ansible-role
react-redux-controllers
Microframework for structuring code of React/Redux applications
Stars: ✭ 13 (-82.89%)
Mutual labels:  actions

GitHub Actions Runner

awesome-runners Galaxy Quality Role version Role downloads GitHub Actions License

This role will deploy/redeploy/uninstall and register/unregister local GitHub Actions Runner. It supports both, Organization and Repository Runners.

Requirements

  • System must have access to the GitHub.

  • The role require Personal Access Token to access the GitHub. The token has to be a value of PERSONAL_ACCESS_TOKEN variable. Export the token to the local host environment.

The token must have the repo scope (when creating a repo runner) or the admin:org scope (when creating a runner for an organization). Personal Access Token for GitHub account can be created here.

⚠️ Never store you personal access token in the GitHub repository. Use GitHub Secrets or some different secrets service.

  • Runner user has to be pre-created. Recommended role: monolithprojects.user_management

  • CentOS systems require EPEL repository. Recommended role: robertdebock.epel

Supported CPU architecture:

  • ARM, ARM64 (dependencies installation is not covered by this role)
  • AMD64, x86_64

Tested on:

  • Debian 9,10,11

  • Fedora 35

  • Rocky Linux 8

  • Ubuntu 18,20

    Note: Fedora 32+ and Ubuntu 20 must use Ansible 2.9.8+. Other distros/releases will work also with older 2.8.0+ Ansible.

Role Variables

This is a copy from defaults/main.yml

---
# Runner user - user under which is the local runner service running
runner_user: "{{ lookup('env','USER') }}"

# Directory where the local runner will be installed
runner_dir: /opt/actions-runner

# Directory where the runner package will be dowloaded
runner_pkg_tempdir: /tmp/gh_actions_runner

# Version of the GitHub Actions Runner
runner_version: "latest"

# State in which the runner service will be after the role is done (started, stopped, absent)
runner_state: "started"

# If found on the server, delete already existing runner service and install it again
reinstall_runner: no

# Do not show Ansible logs which may contain sensitive data (registration token)
hide_sensitive_logs: yes

# GitHub address
github_url: "https://github.com"

# GitHub API
github_api_url: "https://api.github.com"

# Personal Access Token for your GitHub account
access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}"

# Is it the runner for organization or not?
runner_org: no

# Labels to apply to the runner
runner_labels: []

# Group to add organization runner to
runner_group: ""

# GitHub Actions Runner repository (change it if you want to use custom Actions Runner fork)
runner_download_repository: "actions/runner"

# Extra arguments to pass to `config.sh`.
# Several arguments muste be set as one string (i.e. "--ephemeral --my_special_fork")
runner_extra_config_args: ""

# Name to assign to this runner in GitHub (System hostname as default)
runner_name: "{{ ansible_hostname }}"

# Custom service name when using Github Enterprise server
# DEPRECATED: this variable is deprecated in favor of "runner_on_ghes" and will be removed in release 1.15.
# service_name: actions.runner._services.{{ runner_name }}.service

# GitHub Repository user or Organization owner used for Runner registration
# github_account: "youruser"

# GitHub repository owner name (if other than github_account)
# github_owner: "yourorg"

# Github repository name
# github_repo: "yourrepo"

# Configuring a custom .env file
# custom_env: |
# http_proxy=YOUR_URL_HERE
# ftp_proxy=YOUR_URL_HERE
# HTTPS_PROXY=YOUR_URL_HERE
# https_proxy=YOUR_URL_HERE
# no_proxy=localhost,127.0.0.1,127.0.0.2
# HTTP_PROXY=

Example Playbook

In this example the Ansible role will install (or update) the GitHub Actions Runner service (latest available version). The runner will be registered for my_awesome_repo GitHub repo. Runner service will be stated and will run under the same user as the Ansible is using for ssh connection (ansible).

---
- name: Install GitHub Actions Runner
  hosts: all
  user: ansible
  become: yes
  vars:
    - github_account: github-access-user
    - github_repo: my_awesome_repo
  roles:
    - role: monolithprojects.github_actions_runner

Same example as above, but runner will be added to an organization and deployed on GitHub Enterprise Server.

---
- name: Install GitHub Actions Runner
  hosts: all
  user: ansible
  become: yes
  vars:
    - github_account: my_awesome_org
    - runner_org: yes
    - runner_on_ghes: yes
  roles:
    - role: monolithprojects.github_actions_runner

In this example the Ansible role will deploy (or update) the GitHub Actions runner service (version 2.165.2) and register the runner for the GitHub repo. Runner service will run under the user runner-user. Runner will be registered with two labels. The runner service will be stopped and disabled. Runner will use custom environment variables (from file named .env in the self-hosted runner application directory).

---
- name: Stop GitHub Actions Runner
  hosts: all
  become: yes
  vars:
    - runner_version: "2.165.2"
    - runner_user: runner-user
    - github_account: github-access-user
    - github_repo: my_awesome_repo
    - runner_state: "stopped"
    - runner_labels:
        - production
        - west
    - custom_env: |
        HTTP_PROXY=http://proxy.local:8080
        http_proxy=http://proxy.local:8080
        HTTPS_PROXY=http://proxy.local:8080
        https_proxy=http://proxy.local:8080
        no_proxy=localhost,127.0.0.1,127.0.0.2

  roles:
    - role: monolithprojects.github_actions_runner

In this example the Ansible role will uninstall the runner service and unregister it from the GitHub Repository.

---
- name: Uninstall GitHub Actions Runner
  hosts: all
  become: yes
  vars:
    - github_account: github-access-user
    - github_repo: my_awesome_repo
    - runner_state: "absent"
  roles:
    - role: monolithprojects.github_actions_runner

License

MIT

Author Information

Created in 2020 by Michal Muransky

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].