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