This role will deploy or redeploy or uninstall and register or unregister local GitHub Actions Runner (version you specified).
System must have access to the GitHub.
CentOS/Fedora systems require EPEL repository.
PERSONAL_ACCESS_TOKEN
variable needs to be exported to your environment. The token has to have admin rights for the repo.
Personal Access Token for your GitHub account can be created here.
This is a copy from defaults/main.yml
# Directory where the local runner will be installed
runner_dir: /opt/actions-runner
# Version of the GitHub Actions Runner
runner_version: "2.165.2"
# If found, replace already registered runner
replace_runner: yes
# Do not show Ansible logs which may contain sensitive data (registration token)
hide_sensitive_logs: yes
# Personal Access Token for your GitHub account
access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}"
# GitHub address
github_server: "https://github.com"
# GitHub account name
# github_account: "youruser"
# Github repository name
# github_repo: "yourrepo"
In this example the role will deploy (or redeploy) the GitHub Actions runner service (default version ins ) and register the runner for the GitHub repo.
---
- name: GitHub Actions Runner
hosts: all
become: yes
vars:
- runner_version: "2.165.2"
- runner_user: runner
- github_account: myuser
- github_repo: my_awesome_repo
roles:
- role: monolithprojects.github_actions_runner
By using tag uninstall
, GitHub Actions runner will be removed from the host and unregistered from the GitHub.
ansible-playbook playbook.yml --tags uninstall
Full Debian/Ubuntu support
MIT
Created in 2020 by Michal Muransky