feat: initial forgejo role setup
This commit is contained in:
commit
57458b975f
13 changed files with 225 additions and 0 deletions
23
.ansible-lint
Normal file
23
.ansible-lint
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
exclude_paths:
|
||||||
|
- ".gitlab/*"
|
||||||
|
- ".gitlab-ci.yml"
|
||||||
|
- "defaults/main.yaml"
|
||||||
|
- "meta/main.yaml"
|
||||||
|
- "vars/*"
|
||||||
|
|
||||||
|
kinds:
|
||||||
|
- playbook: "**/*.{yml,yaml}"
|
||||||
|
|
||||||
|
skip_list:
|
||||||
|
- "command-shell"
|
||||||
|
- "experimental"
|
||||||
|
- "git-latest"
|
||||||
|
- "no-changed-when"
|
||||||
|
- "no-handler"
|
||||||
|
- "name[casing]"
|
||||||
|
- "name[template]"
|
||||||
|
- "risky-file-permissions"
|
||||||
|
- "schema[playbook]"
|
||||||
|
- "var-naming[no-role-prefix]"
|
||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.ansible
|
||||||
13
.gitlab-ci.yml
Normal file
13
.gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# gitlab stages
|
||||||
|
stages:
|
||||||
|
- "gitleaks"
|
||||||
|
- "linting"
|
||||||
|
|
||||||
|
# include components
|
||||||
|
include:
|
||||||
|
- component: "$CI_SERVER_FQDN/components/ansible/linting@v3.0.3"
|
||||||
|
- component: "$CI_SERVER_FQDN/components/gitleaks/gitleaks@v1.0.0"
|
||||||
|
- component: "$CI_SERVER_FQDN/components/markdownlint/markdownlint@1.0.0"
|
||||||
|
- component: "$CI_SERVER_FQDN/components/yamllint/yamllint@1.0.2"
|
||||||
12
.markdownlint-cli2.jsonc
Normal file
12
.markdownlint-cli2.jsonc
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
// files to lint
|
||||||
|
"globs": [
|
||||||
|
"readme.md"
|
||||||
|
],
|
||||||
|
// linting rules
|
||||||
|
"config": {
|
||||||
|
"MD013": {
|
||||||
|
"line_length": 120
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
.yamllint
Normal file
30
.yamllint
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
---
|
||||||
|
extends: 'default'
|
||||||
|
|
||||||
|
rules:
|
||||||
|
braces:
|
||||||
|
max-spaces-inside: 1
|
||||||
|
forbid: true
|
||||||
|
comments:
|
||||||
|
min-spaces-from-content: 1
|
||||||
|
comments-indentation: false
|
||||||
|
empty-lines:
|
||||||
|
max: 2
|
||||||
|
indentation:
|
||||||
|
spaces: 2
|
||||||
|
check-multi-line-strings: true
|
||||||
|
line-length:
|
||||||
|
max: 120
|
||||||
|
allow-non-breakable-words: true
|
||||||
|
allow-non-breakable-inline-mappings: true
|
||||||
|
new-line-at-end-of-file: 'enable'
|
||||||
|
octal-values:
|
||||||
|
forbid-implicit-octal: true
|
||||||
|
forbid-explicit-octal: true
|
||||||
|
truthy:
|
||||||
|
allowed-values:
|
||||||
|
- 'true'
|
||||||
|
- 'false'
|
||||||
|
quoted-strings:
|
||||||
|
quote-type: 'any'
|
||||||
|
required: true
|
||||||
8
meta/main.yaml
Normal file
8
meta/main.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
author: "siempie"
|
||||||
|
description: "install and configure forgejo git server"
|
||||||
|
license: "MIT"
|
||||||
|
role_name: "forgejo"
|
||||||
|
dependencies: []
|
||||||
31
playbook.yaml
Normal file
31
playbook.yaml
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# execute this role
|
||||||
|
- name: "install and configure forgejo"
|
||||||
|
hosts: "all"
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
# due to semaphore bug we need to do this ourselves
|
||||||
|
- name: "force-update requirements"
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: "ansible-galaxy install -f -r roles/requirements.yml"
|
||||||
|
become: false
|
||||||
|
delegate_to: "localhost"
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
# execute the role
|
||||||
|
- name: "execute role: docker"
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: "docker"
|
||||||
|
|
||||||
|
# execute the role
|
||||||
|
- name: "execute role: traefik"
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: "traefik"
|
||||||
|
|
||||||
|
# execute the role
|
||||||
|
- name: "execute role: forgejo"
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: "forgejo"
|
||||||
3
readme.md
Normal file
3
readme.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Ansible Role: Forgejo
|
||||||
|
|
||||||
|
Install and configure [Forgejo](https://forgejo.org) - a self-hosted lightweight software forge.
|
||||||
4
renovate.json
Normal file
4
renovate.json
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [ "local>cicd/renovate:ansible" ]
|
||||||
|
}
|
||||||
12
roles/requirements.yml
Normal file
12
roles/requirements.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- name: "docker"
|
||||||
|
src: "https://gitlab.simoncor.net/ansible/ans-docker.git"
|
||||||
|
scm: "git"
|
||||||
|
- name: "traefik"
|
||||||
|
src: "https://gitlab.simoncor.net/ansible/ans-traefik.git"
|
||||||
|
scm: "git"
|
||||||
|
- name: "forgejo"
|
||||||
|
src: "https://gitlab.simoncor.net/ansible/ans-forgejo.git"
|
||||||
|
scm: "git"
|
||||||
14
tasks/cleanup.yaml
Normal file
14
tasks/cleanup.yaml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
- name: "docker - prune all"
|
||||||
|
community.docker.docker_prune:
|
||||||
|
containers: true
|
||||||
|
images: true
|
||||||
|
networks: true
|
||||||
|
volumes: true
|
||||||
|
builder_cache: true
|
||||||
|
|
||||||
|
- name: "docker - force prune"
|
||||||
|
ansible.builtin.command: "docker system prune --all --force --volumes"
|
||||||
|
changed_when: false
|
||||||
65
tasks/forgejo.yaml
Normal file
65
tasks/forgejo.yaml
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# create directories
|
||||||
|
- name: "create forgejo directories"
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: "directory"
|
||||||
|
owner: "1000"
|
||||||
|
group: "1000"
|
||||||
|
mode: "0755"
|
||||||
|
loop:
|
||||||
|
- "/mnt/forgejo/data"
|
||||||
|
|
||||||
|
# run forgejo
|
||||||
|
- name: "run forgejo"
|
||||||
|
community.docker.docker_container:
|
||||||
|
|
||||||
|
# docker defaults
|
||||||
|
auto_remove: "no"
|
||||||
|
container_default_behavior: "no_defaults"
|
||||||
|
detach: "yes"
|
||||||
|
init: "no"
|
||||||
|
interactive: "no"
|
||||||
|
log_driver: "json-file"
|
||||||
|
log_options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "3"
|
||||||
|
memory: "0"
|
||||||
|
paused: "no"
|
||||||
|
privileged: "no"
|
||||||
|
pull: "always"
|
||||||
|
read_only: "no"
|
||||||
|
state: "started"
|
||||||
|
tty: "no"
|
||||||
|
|
||||||
|
# forgejo
|
||||||
|
name: "forgejo"
|
||||||
|
image: "cr.simoncor.net/dockerhub/codeberg/forgejo:v11.0.13"
|
||||||
|
image_name_mismatch: "recreate"
|
||||||
|
restart_policy: "unless-stopped"
|
||||||
|
network_mode: "host"
|
||||||
|
volumes:
|
||||||
|
- "/mnt/forgejo/data:/data"
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- "3000:3000/tcp"
|
||||||
|
|
||||||
|
env:
|
||||||
|
|
||||||
|
# global
|
||||||
|
TZ: "{{ timezone }}"
|
||||||
|
|
||||||
|
# server
|
||||||
|
FORGEJO__server__DOMAIN: "git.simoncor.net"
|
||||||
|
FORGEJO__server__ROOT_URL: "https://git.simoncor.net"
|
||||||
|
FORGEJO__server__HTTP_PORT: "3000"
|
||||||
|
FORGEJO__server__DISABLE_SSH: "true"
|
||||||
|
|
||||||
|
# database
|
||||||
|
FORGEJO__database__DB_TYPE: "sqlite3"
|
||||||
|
FORGEJO__database__PATH: "/data/gitea/forgejo.db"
|
||||||
|
FORGEJO__database__SQLITE_JOURNAL_MODE: "WAL"
|
||||||
|
|
||||||
|
# mailer
|
||||||
|
FORGEJO__mailer__ENABLED: "false"
|
||||||
9
tasks/main.yaml
Normal file
9
tasks/main.yaml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# install forgejo
|
||||||
|
- name: "install forgejo"
|
||||||
|
ansible.builtin.import_tasks: "forgejo.yaml"
|
||||||
|
|
||||||
|
# cleanup docker
|
||||||
|
- name: "cleanup docker"
|
||||||
|
ansible.builtin.import_tasks: "cleanup.yaml"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue