Skip to content

while-true-do/ansible-role-srv_gitea

Repository files navigation

Github (tag) Github (license) Github (issues) Github (pull requests)

Travis (com)

Ansible (min. version) Ansible (platforms) Ansible (tags)

Ansible Role: srv_gitea

An Ansible Role to install and configure gitea.

Motivation

Gitea.io is a git server, written in golang. As a Developer, having such a tool ready is quite mandatory.

Description

This Role install and configures Gitea.io.

  • Download the binary
  • Create needed directory structure
  • Configure the systemd service
  • Configure gitea
  • Updating does not work automatically

Requirements

Used Modules:

Installation

Install from Ansible Galaxy

ansible-galaxy install while_true_do.srv_gitea

Install from Github

git clone https://github.com/while-true-do/ansible-role-srv_gitea.git while_true_do.srv_gitea

Dependencies:

You need to have git installed on the destination system and you can use while_true_do.app_git or the role will take care of a basic git installation.

ansible-galaxy install -r requirements.yml

Usage

Role Variables

---
# defaults file for while_true_do.srv_gitea

## Package Management
wtd_srv_gitea_package_mode: "binary"
# Only needed for wtd_srv_gitea_package_mode = "binary"
wtd_srv_gitea_package_version: "1.9.2"
wtd_srv_gitea_package_url: "https://dl.gitea.io/gitea/{{ wtd_srv_gitea_package_version }}/gitea-{{ wtd_srv_gitea_package_version }}-linux-amd64"
# State can be present|absent
wtd_srv_gitea_package_state: "present"

## Configuration Management
wtd_srv_gitea_conf_user:
  name: "gitea"
  group: "gitea"
  home: "/home/gitea"

wtd_srv_gitea_conf_port: "3000"
wtd_srv_gitea_conf_var: "/var/lib/gitea"
wtd_srv_gitea_conf_etc: "/etc/gitea"

# Gitea has tons of options. You can get an overview here:
# https://docs.gitea.io/en-us/config-cheat-sheet/
# https://github.com/go-gitea/gitea/blob/master/custom/conf/app.ini.sample
wtd_srv_gitea_conf:
  - option: "APP_NAME"
    value: "Gitea - Git with a cup of tea"
    section: null
  - option: RUN_MODE
    value: "prod"
    section: null
  - option: "RUN_USER"
    value: "{{ wtd_srv_gitea_conf_user.name }}"
    section: null
  - option: "AUTHOR"
    value: "Gitea - Git with a cup of tea"
    section: "ui.meta"
  - option: "HTTP_PORT"
    value: "{{ wtd_srv_gitea_conf_port }}"
    section: "server"
  - option: "HTTP_ADDR"
    value: "0.0.0.0"
    section: "server"
  - option: "DOMAIN"
    value: "localhost"
    section: "server"
  - option: "ROOT"
    value: "{{ wtd_srv_gitea_conf_user.home }}/gitea-repositories"
    section: "repository"

## Service Management
wtd_srv_gitea_service: "gitea"
# State can be started|stopped
wtd_srv_gitea_service_state: "started"
wtd_srv_gitea_service_enabled: true

## Firewalld Management
wtd_srv_gitea_fw_mgmt: true
wtd_srv_gitea_fw_port: "{{ wtd_srv_gitea_conf_port }}/tcp"
# State can be enabled|disabled
wtd_srv_gitea_fw_state: "enabled"
# Zone can be according to defined zones on your machine.
wtd_srv_gitea_fw_zone: "public"

Example Playbook

Running Ansible Roles can be done in a playbook.

Simple

---
- hosts: all
  roles:
    - role: while_true_do.srv_gitea

Advanced

Install another version and change the port.

- hosts: all
  roles:
    - role: while_true_do.srv_gitea
      wtd_srv_gitea_conf_port: "8080"
      wtd_srv_gitea_package_version: "1.X.Y"

Known Issues

  1. RedHat Testing is currently not possible in public, due to limitations in subscriptions.
  2. Some services and features cannot be tested properly, due to limitations in docker.

Testing

Most of the "generic" tests are located in the Test Library.

Ansible specific testing is done with Molecule.

Infrastructure testing is done with testinfra.

Automated testing is done with Travis CI.

Contribute

Thank you so much for considering to contribute. We are very happy, when somebody is joining the hard work. Please fell free to open Bugs, Feature Requests or Pull Requests after reading the Contribution Guideline.

See who has contributed already in the kudos.txt.

License

This work is licensed under a BSD-3-Clause License.

Contact