Skip to content

Commit

Permalink
Merge pull request #126 from roles-ansible/j2
Browse files Browse the repository at this point in the history
andding jinja2 linter and improve template
  • Loading branch information
DO1JLR authored Oct 21, 2023
2 parents ec13147 + aa749c5 commit 4c00782
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 26 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ansible-linting-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ jobs:

steps:
- name: 'checkout git repo'
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
lfs: true
submodules: false
submodules: true
fetch-depth: 0

- name: Run ansible-lint
uses: ansible-actions/ansible-lint-action@v0.0.3
uses: ansible-actions/ansible-lint-action@v1.0.1
with:
target: "./"
python_dependency: "jmespath"
collections_yml: 'requirements.yml'
python_dependency: 'jmespath'
2 changes: 0 additions & 2 deletions .github/workflows/galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Galaxy release

# yamllint disable-line rule:truthy
on:
push:
branches: ['main']
release:
types: ['created']

Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/j2lint-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Jinja2 Linting check

# yamllint disable-line rule:truthy
on: [push, pull_request]

jobs:
build:
name: Jinja2 Linting
runs-on: ubuntu-latest

steps:
- name: 'checkout git repo'
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Run j2lint
uses: ansible-actions/[email protected]
with:
target: "./"
22 changes: 22 additions & 0 deletions .github/workflows/yamllint-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Yamllint check

# yamllint disable-line rule:truthy
on: [push, pull_request]

jobs:
build:
name: Yamllint
runs-on: ubuntu-latest

steps:
- name: 'checkout git repo'
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Run yamllint
uses: ansible-actions/[email protected]
with:
target: "./"
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.gitea.svg)](https://galaxy.ansible.com/l3d/gitea)
[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.gitea.svg)](https://galaxy.ansible.com/ui/standalone/roles/l3d/gitea/)
[![BSD-3 Clause](https://ansible.l3d.space/svg/l3d.gitea_license.svg)](LICENSE)
[![Maintainance](https://ansible.l3d.space/svg/l3d.gitea_maintainance.svg)](https://ansible.l3d.space/#l3d.gitea)

Expand All @@ -15,7 +15,7 @@ This role is also Part of the Ansible-Collection [l3d.git](https://galaxy.ansibl
The following code has been tested with the latest Debian Stable, it should work on Ubuntu and RedHat as well.

```yaml
# ansible-galaxy install l3d.gitea
# ansible-galaxy role install l3d.gitea

- name: "Install gitea"
hosts: git.example.com
Expand Down Expand Up @@ -385,11 +385,10 @@ This role uses the ``ansible.builtin`` and ``community.general`` ansible Collect
### Galaxy Collections
+ community.general


### Example requirements Installation
```
ansible-galaxy install community.general
pip3 install jmespath
ansible-galaxy collection install --update --role-file requirements.yml
pip3 install --update jmespath
```
## Contribute
Expand Down
4 changes: 4 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
collections:
- name: community.general
source: https://galaxy.ansible.com
28 changes: 14 additions & 14 deletions templates/gitea.ini.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
; this file is the configuration of your local gitea instance
; this file is the configuration of your local Gitea instance
; {{ ansible_managed }}
;
; This file overwrites the default values from gitea.
; undefined variables will use the default value from gitea.
; This file overwrites the default values from Gitea.
; undefined variables will use the default value from Gitea.
; Cheat Sheet: https://docs.gitea.com/next/administration/config-cheat-sheet/
;
; -> https://docs.gitea.com/next/administration/config-cheat-sheet#overall-default
Expand Down Expand Up @@ -90,7 +90,7 @@ APP_DATA_PATH = {{ gitea_home }}/data
PROTOCOL = {{ gitea_protocol }}
DOMAIN = {{ gitea_http_domain }}
ROOT_URL = {{ gitea_root_url }}
HTTP_ADDR = {{ gitea_http_listen }}
HTTP_ADDR = {{ gitea_http_listen }}
HTTP_PORT = {{ gitea_http_port }}
START_SSH_SERVER = {{ gitea_start_ssh | ternary('true', 'false') }}
SSH_DOMAIN = {{ gitea_ssh_domain }}
Expand All @@ -102,17 +102,17 @@ CERT_FILE = {{ gitea_tls_cert_file }}
KEY_FILE = {{ gitea_tls_key_file }}
{% endif %}
LANDING_PAGE = {{ gitea_landing_page }}
{% if gitea_lfs_server_enabled | bool -%}
{% if gitea_lfs_server_enabled | bool %}
LFS_START_SERVER = true
LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }}
{% endif %}
REDIRECT_OTHER_PORT = {{ gitea_redirect_other_port | ternary('true', 'false') }}
PORT_TO_REDIRECT = {{ gitea_port_to_redirect }}
ENABLE_ACME = {{ gitea_enable_acme | ternary('true', 'false') }}
{% if gitea_enable_acme | bool %}
{% if gitea_acme_url != '' %}
{% if gitea_acme_url != '' %}
ACME_URL = {{ gitea_acme_url }}
{% endif %}
{% endif %}
ACME_ACCEPTTOS = {{ gitea_acme_accepttos | ternary('true', 'false') }}
ACME_DIRECTORY = {{ gitea_acme_directory }}
ACME_EMAIL = {{ gitea_acme_email }}
Expand Down Expand Up @@ -194,14 +194,14 @@ ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_allow_only_external_registration | t
[mailer]
ENABLED = {{ gitea_mailer_enabled | ternary('true', 'false') }}
{% if gitea_mailer_enabled | bool %}
{% if gitea_mailer_use_client_cert | bool %}
CLIENT_CERT_FILE = {{ gitea_mailer_client_cert_file }}
CLIENT_KEY_FILE = {{ gitea_mailer_client_key_file }}
{% endif %}
PROTOCOL = {{ gitea_mailer_protocol }}
SMTP_ADDR = {{ gitea_mailer_smtp_addr }}
SMTP_PORT = {{ gitea_mailer_smtp_port }}
USE_CLIENT_CERT = {{ gitea_mailer_use_client_cert | ternary('true', 'false') }}
{% if gitea_mailer_use_client_cert | bool %}
CLIENT_CERT_FILE = {{ gitea_mailer_client_cert_file }}
CLIENT_KEY_FILE = {{ gitea_mailer_client_key_file }}
{% endif %}
FORCE_TRUST_SERVER_CERT = {{ gitea_mailer_force_trust_server_cert | ternary('true', 'false') }}
USER = {{ gitea_mailer_user }}
PASSWD = {{ gitea_mailer_password }}
Expand Down Expand Up @@ -305,8 +305,8 @@ SHOW_FOOTER_VERSION = {{ gitea_other_show_footer_version | ternary('true', 'fals
SHOW_FOOTER_TEMPLATE_LOAD_TIME = {{ gitea_other_show_footer_template_load_time | ternary('true', 'false') }}
ENABLE_SITEMAP = {{ gitea_other_enable_sitemap | ternary('true', 'false') }}
ENABLE_FEED = {{ gitea_other_enable_feed | ternary('true', 'false') }}
;
;
;
;
;
;
; Optional additional config
{{ gitea_extra_config }}
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ transfer_custom_footer:
- 'files/gitea_footer/extra_links_footer.tmpl'
- 'files/extra_links_footer.tmpl'

playbook_version_number: 51 # should be int
playbook_version_number: 52 # should be int
playbook_version_path: 'do1jlr.gitea.version'

0 comments on commit 4c00782

Please sign in to comment.