Compare commits
5 Commits
93561738df
...
bae2419235
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bae2419235 | ||
|
|
29887948ff | ||
|
|
48f9eef167 | ||
|
|
2563c429ae | ||
|
|
98040c59fd |
@@ -18,4 +18,4 @@ become_method = sudo
|
||||
# -o ControlPersist=60s
|
||||
# Sets the persistence time for the master connection to 60 seconds
|
||||
[ssh_connection]
|
||||
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
|
||||
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
|
||||
@@ -1,4 +1,3 @@
|
||||
---
|
||||
- name: Initial generic setup
|
||||
hosts: gitrunner
|
||||
become: yes
|
||||
@@ -8,6 +7,8 @@
|
||||
yum:
|
||||
name:
|
||||
- git
|
||||
- nodejs
|
||||
- mock
|
||||
state: present
|
||||
|
||||
- name: Check current hostname
|
||||
@@ -15,7 +16,7 @@
|
||||
register: current_hostname
|
||||
changed_when: false
|
||||
|
||||
- name: Set hostname to rocky10 (if needed)
|
||||
- name: Set hostname to configured value (if needed)
|
||||
hostname:
|
||||
name: rocky10
|
||||
when: current_hostname.stdout != "rocky10"
|
||||
name: fedora-rawhide10
|
||||
when: current_hostname.stdout != ansible_hostname
|
||||
@@ -1,6 +1,3 @@
|
||||
# This file defines targets (hosts, groups, host-specific variables)
|
||||
[all]
|
||||
rocky10 ansible_host=10.17.3.215 ansible_user=groot ansible_become=true ansible_python_interpreter=/usr/bin/python3.12
|
||||
|
||||
[gitrunner]
|
||||
rocky10
|
||||
fedora-rawhide10 ansible_host=10.17.3.179 ansible_user=groot ansible_become=true ansible_python_interpreter=/usr/bin/python3.12
|
||||
|
||||
10
readme.md
10
readme.md
@@ -1,8 +1,8 @@
|
||||
# Gitea Runner Automation with Ansible
|
||||
|
||||
This repository contains an Ansible playbook and configuration files to automate the deployment and configuration of a Gitea Runner on a Rocky Linux 10 VM.
|
||||
This repository contains an Ansible playbook and configuration files to automate the deployment and configuration of a Gitea Runner on a Fedora Rawhide Cloud VM.
|
||||
|
||||
To deploy a Rocky Linux virtual machine, please go to [this repository](https://git.phyllo.me/IaC/advanced-libvirt-terraform-examples).
|
||||
To deploy a Fedora Rawhide Cloud virtual machine, please go to [this repository](https://git.phyllo.me/IaC/advanced-libvirt-terraform-examples).
|
||||
|
||||
## Repository Structure
|
||||
|
||||
@@ -17,7 +17,7 @@ To deploy a Rocky Linux virtual machine, please go to [this repository](https://
|
||||
## Prerequisites
|
||||
|
||||
1. Ansible installed on your control machine
|
||||
2. Access to a Rocky Linux 10 VM with IP `10.17.3.250`
|
||||
2. Access to a Fedora Rawhide Cloud VM with IP `10.17.3.250`
|
||||
3. SSH key authentication configured with `~/.ssh/terraform_key`
|
||||
4. Root privileges or sudo access on the target VM
|
||||
5. Gitea registration token (to be placed in runner_setup.yml)
|
||||
@@ -62,10 +62,10 @@ To deploy a Rocky Linux virtual machine, please go to [this repository](https://
|
||||
|
||||
This automation will:
|
||||
|
||||
- Connect to the specified Rocky Linux VM
|
||||
- Connect to the specified Fedora Rawhide Cloud VM
|
||||
- Update the system packages and reboot if required
|
||||
- Install necessary dependencies
|
||||
- Set hostname to rocky10
|
||||
- Set hostname to fedora-rawhide10
|
||||
- Create a dedicated gitea-runner user
|
||||
- Download and install Gitea Runner
|
||||
- Configure systemd service for automatic startup
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
- name: Install Act Runner
|
||||
ansible.builtin.get_url:
|
||||
url: "https://gitea.com/gitea/act_runner/releases/download/v{{ gitea_runner_version }}/act_runner-{{ gitea_runner_version }}-linux-amd64"
|
||||
dest: "/usr/local/bin/act-runner"
|
||||
dest: "/usr/local/bin/act_runner"
|
||||
mode: '0755'
|
||||
force: "{{ (ansible_facts['cmdline']['force'] is defined) | default(false) }}"
|
||||
retries: 3
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
runner:
|
||||
# Where to store the registration result.
|
||||
file: .runner
|
||||
file: /var/lib/act_runner/.runner
|
||||
# Execute how many tasks concurrently at the same time.
|
||||
capacity: 1
|
||||
# Extra environment variables to run jobs.
|
||||
@@ -73,7 +73,7 @@
|
||||
# If it's empty when registering, it will ask for inputting labels.
|
||||
# If it's empty when execute `daemon`, will use labels in `.runner` file.
|
||||
labels:
|
||||
- "rocky-latest:host:local"
|
||||
- "fedora-rawhide-latest:host:local"
|
||||
|
||||
cache:
|
||||
# Enable cache server to use actions/cache.
|
||||
@@ -146,12 +146,12 @@
|
||||
|
||||
- name: Register the runner with Gitea (if not already registered)
|
||||
ansible.builtin.command: >
|
||||
/usr/local/bin/act-runner register
|
||||
/usr/local/bin/act_runner register
|
||||
--no-interactive
|
||||
--config /etc/act_runner/config.yaml
|
||||
--instance https://git.phyllo.me
|
||||
--token {{ registration_token }}
|
||||
--name rl-bios-0
|
||||
--name fraw-bios-0
|
||||
when: not runner_registered.stat.exists
|
||||
changed_when: true
|
||||
|
||||
@@ -160,28 +160,26 @@
|
||||
content: |
|
||||
[Unit]
|
||||
Description=Gitea Actions Runner
|
||||
Documentation=https://gitea.com/gitea/act_runner
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=act_runner
|
||||
ExecStart=/usr/local/bin/act-runner daemon --config /etc/act_runner/config.yaml
|
||||
ExecStart=/usr/local/bin/act_runner daemon --config /etc/act_runner/config.yaml
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
WorkingDirectory=/var/lib/act_runner
|
||||
TimeoutSec=0
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
User=act_runner
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
dest: /etc/systemd/system/act-runner.service
|
||||
dest: /etc/systemd/system/act_runner.service
|
||||
mode: '0755'
|
||||
backup: yes
|
||||
|
||||
- name: Ensure act-runner service is enabled and started
|
||||
- name: Ensure act_runner service is enabled and started
|
||||
ansible.builtin.systemd:
|
||||
name: act-runner
|
||||
name: act_runner
|
||||
enabled: yes
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
Reference in New Issue
Block a user