Role Name
=========

____
Gitea - Git with a cup of tea
A painless self-hosted Git service.
Gitea is a community managed lightweight code hosting solution written in Go. It is published under the MIT license.
____

It installs nginx, postgresql and gitea for you git-service.

Requirements
------------

You need to have debian (or compatible, like ubuntu) or alpine already installed.

* sshd

It will install all dependencies on host-machine:

* Postgresql
* nginx
* gitea - itself

It expects for TLS a PKI in `/etc/nginx/tls/`,
where you have to place `**hostname**.key`, `**hostname**.crt`.

Role Variables
--------------

gitea_version::
You need to define it, it cannot determine newest version, yet.

gitea_download_uri::
The URI to the binary.
You need to define it, it cannot determine newest version, yet.

gitea_fqdn::
Full qualified domain name for the webserver.

gitea_root_uri::
The Link to your gitea service.  Default `https://{{gitea_fqdn}}/`.

Example Playbook
----------------

This determines the newest version of gitea automatically.
So it defines `gitea_version` and `gitea_download_uri`.

----
---
# vim: set expandtab tabstop=2 shiftwidth=2:

- hosts: gitea
  remote_user: root
  become: false

  tasks:
  - delegate_to: local
    run_once: true
    remote_user: root
    become: false
    gem:
      user_install: false
      name: '{{item}}'
    with_items:
    - oga
    - httpclient
  - name: determine newest provided version
    delegate_to: local
    become: false
    run_once: true
    shell: |
      ruby -roga -rhttpclient <<EOF
      puts Oga.parse_html( HTTPClient.get_content( "https://dl.gitea.io/gitea/")).
        css( "tr.file a[href] .name").
        map {|a| a.text.chomp.split ?. }.
        select {|v| v.grep( /\D/).empty? }.
        map {|v| v.map &:to_i }.
        max.
        join( ?.)
      EOF
    register: det_gitea_ver
  - set_fact:
      gitea_version: '{{gitea.version | default(det_gitea_ver.stdout)}}'
  - set_fact:
      gitea_download_uri: '{{gitea.uri | default("https://dl.gitea.io/gitea/"+gitea_version+"/gitea-"+gitea_version+"-linux-"+gitea_architectures_map[ansible_architecture])}}'                
  - import_role:
      name: gitea
----

License
-------

AGPLv3

Author Information
------------------

Denis Knauf - https://git.denkn.at/deac/ansible-role-gitea
