Initial commit
This commit is contained in:
103
.cruft.json
Normal file
103
.cruft.json
Normal file
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"template": "https://github.com/lkubb/salt-template-formula",
|
||||
"commit": "7dea11a9bc3cb4827bc8fda80a30271353ab3e09",
|
||||
"checkout": null,
|
||||
"context": {
|
||||
"cookiecutter": {
|
||||
"_extensions": [
|
||||
"local_extensions.YAMLDumper"
|
||||
],
|
||||
"_jinja2_env_vars": {
|
||||
"block_start_string": "{!",
|
||||
"block_end_string": "!}",
|
||||
"variable_start_string": "{=",
|
||||
"variable_end_string": "=}",
|
||||
"comment_start_string": "{@",
|
||||
"comment_end_string": "@}"
|
||||
},
|
||||
"name": "Gitea",
|
||||
"abbr": "gitea",
|
||||
"abbr_pysafe": "gitea",
|
||||
"pkg": "gitea",
|
||||
"needs_repo": "",
|
||||
"config": "/var/opt/gitea/custom/conf/app.ini",
|
||||
"service": "gitea",
|
||||
"subcomponent": "",
|
||||
"subcomponent_config": "",
|
||||
"git_username": "lkubb",
|
||||
"_lookup": {
|
||||
"paths": {
|
||||
"bin": "/opt/gitea",
|
||||
"conf": "/etc/opt/gitea",
|
||||
"custom": "/var/opt/gitea/custom",
|
||||
"data": "/var/opt/gitea/data",
|
||||
"home": "/var/opt/gitea/home",
|
||||
"internal_token_uri": "file:///etc/opt/gitea/internal_token",
|
||||
"log": "/var/opt/gitea/log",
|
||||
"repos": "/var/opt/gitea/data/gitea-repositories",
|
||||
"work": "/var/opt/gitea"
|
||||
},
|
||||
"requirements": [
|
||||
"git",
|
||||
"gpg",
|
||||
"python-gnupg"
|
||||
],
|
||||
"shell": "/bin/bash",
|
||||
"user": "git",
|
||||
"group": "git",
|
||||
"gpg": {
|
||||
"key": "7C9E68152594688862D62AF62D9AE806EC1592E2",
|
||||
"keyserver": "keys.openpgp.org"
|
||||
},
|
||||
"pkg": {
|
||||
"latest": "https://dl.gitea.io/gitea/version.json",
|
||||
"sig": "https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc",
|
||||
"source": "https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}",
|
||||
"source_hash": "https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256"
|
||||
}
|
||||
},
|
||||
"_settings": {
|
||||
"version": "latest",
|
||||
"database": {
|
||||
"db_type": "sqlite3",
|
||||
"name": "gitea",
|
||||
"user": "root",
|
||||
"password": "hunter1"
|
||||
},
|
||||
"secrets": {
|
||||
"internal_token": "",
|
||||
"jwt_secret": "",
|
||||
"lfs_jwt_secret": "",
|
||||
"secret_key": ""
|
||||
},
|
||||
"service": {
|
||||
"requires_mount": [],
|
||||
"wants": []
|
||||
},
|
||||
"config": {
|
||||
"default": {
|
||||
"app_name": "Gitea",
|
||||
"run_user": "git",
|
||||
"run_mode": "prod"
|
||||
},
|
||||
"server": {
|
||||
"protocol": "http",
|
||||
"domain": "localhost",
|
||||
"http_addr": "0.0.0.0",
|
||||
"http_port": 3000
|
||||
},
|
||||
"log": {
|
||||
"mode": "console",
|
||||
"level": "Info",
|
||||
"stacktrace_level": "None"
|
||||
},
|
||||
"repository.signing": {
|
||||
"signing_key": "default"
|
||||
}
|
||||
}
|
||||
},
|
||||
"_template": "https://github.com/lkubb/salt-template-formula"
|
||||
}
|
||||
},
|
||||
"directory": null
|
||||
}
|
||||
16
.github/workflows/commitlint.yml
vendored
Normal file
16
.github/workflows/commitlint.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
name: Commitlint
|
||||
'on': [pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: wagoid/commitlint-github-action@v1
|
||||
134
.gitignore
vendored
Normal file
134
.gitignore
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a packager
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.kitchen
|
||||
.kitchen.local.yml
|
||||
kitchen.local.yml
|
||||
junit-*.xml
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# dotenv
|
||||
.env
|
||||
|
||||
# virtualenv
|
||||
.venv
|
||||
venv/
|
||||
ENV/
|
||||
|
||||
# visual studio
|
||||
.vs/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
# Bundler
|
||||
.bundle/
|
||||
|
||||
# copied `.md` files used for conversion to `.rst` using `m2r`
|
||||
docs/*.md
|
||||
|
||||
# Vim
|
||||
*.sw?
|
||||
|
||||
## Collected when centralising formulas (check and sort)
|
||||
# `collectd-formula`
|
||||
.pytest_cache/
|
||||
/.idea/
|
||||
Dockerfile.*_*
|
||||
ignore/
|
||||
tmp/
|
||||
|
||||
# `salt-formula` -- Vagrant Specific files
|
||||
.vagrant
|
||||
top.sls
|
||||
!test/salt/pillar/top.sls
|
||||
|
||||
# `suricata-formula` -- Platform binaries
|
||||
*.rpm
|
||||
*.deb
|
||||
220
.gitlab-ci.yml
Normal file
220
.gitlab-ci.yml
Normal file
@@ -0,0 +1,220 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
###############################################################################
|
||||
# Define all YAML node anchors
|
||||
###############################################################################
|
||||
.node_anchors:
|
||||
# `only` (also used for `except` where applicable)
|
||||
only_branch_master_parent_repo: &only_branch_master_parent_repo
|
||||
- 'master@lkubb/salt-gitea-formula'
|
||||
# `stage`
|
||||
stage_lint: &stage_lint 'lint'
|
||||
stage_release: &stage_release 'release'
|
||||
stage_test: &stage_test 'test'
|
||||
# `image`
|
||||
image_commitlint: &image_commitlint 'myii/ssf-commitlint:11'
|
||||
image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3'
|
||||
image_dindrubybionic: &image_dindrubybionic 'myii/ssf-dind-ruby-bionic:2.7.5-1bbox1'
|
||||
image_precommit: &image_precommit
|
||||
name: 'myii/ssf-pre-commit:2.9.2'
|
||||
entrypoint: ['/bin/bash', '-c']
|
||||
image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest'
|
||||
image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14'
|
||||
# `services`
|
||||
services_docker_dind: &services_docker_dind
|
||||
- 'docker:dind'
|
||||
# `variables`
|
||||
# https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
|
||||
# https://bundler.io/v1.16/bundle_config.html
|
||||
variables_bundler: &variables_bundler
|
||||
BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
|
||||
BUNDLE_WITHOUT: 'production'
|
||||
# `cache`
|
||||
cache_bundler: &cache_bundler
|
||||
key: '${CI_JOB_STAGE}'
|
||||
paths:
|
||||
- '${BUNDLE_CACHE_PATH}'
|
||||
|
||||
###############################################################################
|
||||
# Define stages and global variables
|
||||
###############################################################################
|
||||
stages:
|
||||
- *stage_lint
|
||||
- *stage_test
|
||||
- *stage_release
|
||||
variables:
|
||||
DOCKER_DRIVER: 'overlay2'
|
||||
|
||||
###############################################################################
|
||||
# `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed)
|
||||
###############################################################################
|
||||
commitlint:
|
||||
stage: *stage_lint
|
||||
image: *image_commitlint
|
||||
script:
|
||||
# Add `upstream` remote to get access to `upstream/master`
|
||||
- 'git remote add upstream
|
||||
https://gitlab.com/lkubb/salt-gitea-formula.git'
|
||||
- 'git fetch --all'
|
||||
# Set default commit hashes for `--from` and `--to`
|
||||
- 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
|
||||
- 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
|
||||
# `coqbot` adds a merge commit to test PRs on top of the latest commit in
|
||||
# the repo; amend this merge commit message to avoid failure
|
||||
- |
|
||||
if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \
|
||||
&& [ "${CI_COMMIT_BRANCH}" != "master" ]; then
|
||||
git commit --amend -m \
|
||||
'chore: reword coqbot merge commit message for commitlint'
|
||||
export COMMITLINT_TO=HEAD
|
||||
fi
|
||||
# Run `commitlint`
|
||||
- 'commitlint --from "${COMMITLINT_FROM}"
|
||||
--to "${COMMITLINT_TO}"
|
||||
--verbose'
|
||||
|
||||
pre-commit:
|
||||
stage: *stage_lint
|
||||
image: *image_precommit
|
||||
# https://pre-commit.com/#gitlab-ci-example
|
||||
variables:
|
||||
PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
|
||||
cache:
|
||||
key: '${CI_JOB_NAME}'
|
||||
paths:
|
||||
- '${PRE_COMMIT_HOME}'
|
||||
script:
|
||||
- 'pre-commit run --all-files --color always --verbose'
|
||||
|
||||
# Use a separate job for `rubocop` other than the one potentially run by `pre-commit`
|
||||
# - The `pre-commit` check will only be available for formulas that pass the default
|
||||
# `rubocop` check -- and must continue to do so
|
||||
# - This job is allowed to fail, so can be used for all formulas
|
||||
# - Furthermore, this job uses all of the latest `rubocop` features & cops,
|
||||
# which will help when upgrading the `rubocop` linter used in `pre-commit`
|
||||
rubocop:
|
||||
allow_failure: true
|
||||
stage: *stage_lint
|
||||
image: *image_rubocop
|
||||
script:
|
||||
- 'rubocop -d -P -S --enable-pending-cops'
|
||||
|
||||
###############################################################################
|
||||
# Define `test` template
|
||||
###############################################################################
|
||||
.test_instance: &test_instance
|
||||
stage: *stage_test
|
||||
image: *image_dindruby
|
||||
services: *services_docker_dind
|
||||
variables: *variables_bundler
|
||||
cache: *cache_bundler
|
||||
before_script:
|
||||
# TODO: This should work from the env vars above automatically
|
||||
- 'bundle config set path "${BUNDLE_CACHE_PATH}"'
|
||||
- 'bundle config set without "${BUNDLE_WITHOUT}"'
|
||||
- 'bundle install'
|
||||
script:
|
||||
# Alternative value to consider: `${CI_JOB_NAME}`
|
||||
- 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
|
||||
|
||||
###############################################################################
|
||||
# Define `test` template (`allow_failure: true`)
|
||||
###############################################################################
|
||||
.test_instance_failure_permitted:
|
||||
<<: *test_instance
|
||||
allow_failure: true
|
||||
|
||||
###############################################################################
|
||||
# `test` stage: each instance below uses the `test` template above
|
||||
###############################################################################
|
||||
## Define the rest of the matrix based on Kitchen testing
|
||||
# Make sure the instances listed below match up with
|
||||
# the `platforms` defined in `kitchen.yml`
|
||||
# yamllint disable rule:line-length
|
||||
# default-debian-11-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-debian-10-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-debian-9-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-2004-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-centos-stream8-tiamat-py3: {extends: '.test_instance_failure_permitted'}
|
||||
# default-centos-7-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-amazonlinux-2-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-8-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-7-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-almalinux-8-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-rockylinux-8-tiamat-py3: {extends: '.test_instance'}
|
||||
default-debian-11-master-py3: {extends: '.test_instance'}
|
||||
default-debian-10-master-py3: {extends: '.test_instance'}
|
||||
default-debian-9-master-py3: {extends: '.test_instance'}
|
||||
default-ubuntu-2004-master-py3: {extends: '.test_instance'}
|
||||
default-ubuntu-1804-master-py3: {extends: '.test_instance'}
|
||||
default-centos-stream8-master-py3: {extends: '.test_instance_failure_permitted'}
|
||||
default-centos-7-master-py3: {extends: '.test_instance'}
|
||||
default-fedora-36-master-py3: {extends: '.test_instance_failure_permitted'}
|
||||
default-fedora-35-master-py3: {extends: '.test_instance'}
|
||||
default-fedora-34-master-py3: {extends: '.test_instance'}
|
||||
default-opensuse-leap-153-master-py3: {extends: '.test_instance'}
|
||||
default-opensuse-tmbl-latest-master-py3: {extends: '.test_instance_failure_permitted'}
|
||||
default-amazonlinux-2-master-py3: {extends: '.test_instance'}
|
||||
default-oraclelinux-8-master-py3: {extends: '.test_instance'}
|
||||
default-oraclelinux-7-master-py3: {extends: '.test_instance'}
|
||||
default-arch-base-latest-master-py3: {extends: '.test_instance'}
|
||||
default-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
|
||||
default-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
|
||||
default-almalinux-8-master-py3: {extends: '.test_instance'}
|
||||
default-rockylinux-8-master-py3: {extends: '.test_instance'}
|
||||
# default-debian-11-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-debian-10-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-debian-9-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-2004-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1804-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-centos-stream8-3004-1-py3: {extends: '.test_instance_failure_permitted'}
|
||||
# default-centos-7-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-fedora-36-3004-1-py3: {extends: '.test_instance_failure_permitted'}
|
||||
# default-fedora-35-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-fedora-34-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-amazonlinux-2-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-8-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-7-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-arch-base-latest-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-gentoo-stage3-latest-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-gentoo-stage3-systemd-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-almalinux-8-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-rockylinux-8-3004-1-py3: {extends: '.test_instance'}
|
||||
# default-opensuse-leap-153-3004-0-py3: {extends: '.test_instance'}
|
||||
# default-opensuse-tmbl-latest-3004-0-py3: {extends: '.test_instance_failure_permitted'}
|
||||
# default-debian-10-3003-4-py3: {extends: '.test_instance'}
|
||||
# default-debian-9-3003-4-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-2004-3003-4-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1804-3003-4-py3: {extends: '.test_instance'}
|
||||
# default-centos-stream8-3003-4-py3: {extends: '.test_instance_failure_permitted'}
|
||||
# default-centos-7-3003-4-py3: {extends: '.test_instance'}
|
||||
# default-amazonlinux-2-3003-4-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-8-3003-4-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-7-3003-4-py3: {extends: '.test_instance'}
|
||||
# default-almalinux-8-3003-4-py3: {extends: '.test_instance'}
|
||||
# default-debian-10-3002-8-py3: {extends: '.test_instance'}
|
||||
# default-debian-9-3002-8-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-2004-3002-8-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1804-3002-8-py3: {extends: '.test_instance'}
|
||||
# default-centos-7-3002-8-py3: {extends: '.test_instance'}
|
||||
# default-amazonlinux-2-3002-8-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-8-3002-8-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-7-3002-8-py3: {extends: '.test_instance'}
|
||||
# yamllint enable rule:line-length
|
||||
|
||||
###############################################################################
|
||||
# `release` stage: `semantic-release`
|
||||
###############################################################################
|
||||
semantic-release:
|
||||
only: *only_branch_master_parent_repo
|
||||
stage: *stage_release
|
||||
image: *image_semanticrelease
|
||||
variables:
|
||||
MAINTAINER_TOKEN: '${GH_TOKEN}'
|
||||
script:
|
||||
# Update `AUTHORS.md`
|
||||
- '${HOME}/go/bin/maintainer contributor'
|
||||
# Run `semantic-release`
|
||||
- 'semantic-release'
|
||||
78
.pre-commit-config.yaml
Normal file
78
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,78 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
default_stages: [commit]
|
||||
repos:
|
||||
- repo: https://github.com/dafyddj/commitlint-pre-commit-hook
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: commitlint
|
||||
name: Check commit message using commitlint
|
||||
description: Lint commit message against @commitlint/config-conventional rules
|
||||
stages: [commit-msg]
|
||||
additional_dependencies: ['@commitlint/config-conventional@8.3.4']
|
||||
- id: commitlint-travis
|
||||
stages: [manual]
|
||||
additional_dependencies: ['@commitlint/config-conventional@8.3.4']
|
||||
always_run: true
|
||||
- repo: https://github.com/rubocop-hq/rubocop
|
||||
rev: v1.25.1
|
||||
hooks:
|
||||
- id: rubocop
|
||||
name: Check Ruby files with rubocop
|
||||
args: [--debug]
|
||||
always_run: true
|
||||
pass_filenames: false
|
||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||
rev: v0.8.0.4
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
name: Check shell scripts with shellcheck
|
||||
files: ^.*\.(sh|bash|ksh)$
|
||||
types: []
|
||||
- repo: https://github.com/adrienverge/yamllint
|
||||
rev: v1.26.3
|
||||
hooks:
|
||||
- id: yamllint
|
||||
name: Check YAML syntax with yamllint
|
||||
args: [--strict, '.']
|
||||
always_run: true
|
||||
pass_filenames: false
|
||||
- repo: https://github.com/warpnet/salt-lint
|
||||
rev: v0.8.0
|
||||
hooks:
|
||||
- id: salt-lint
|
||||
name: Check Salt files using salt-lint
|
||||
files: ^.*\.(sls|jinja|j2|tmpl|tst)$
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: slsdoc
|
||||
name: Dump state documentation with slsdoc
|
||||
entry: ./bin/slsdoc
|
||||
language: system
|
||||
require_serial: true
|
||||
always_run: true
|
||||
pass_filenames: false
|
||||
- repo: https://github.com/myint/rstcheck
|
||||
rev: 3f929574
|
||||
hooks:
|
||||
- id: rstcheck
|
||||
name: Check reST files using rstcheck
|
||||
exclude: 'docs/CHANGELOG.rst'
|
||||
additional_dependencies: [sphinx==4.3.0]
|
||||
- repo: https://github.com/saltstack-formulas/mirrors-rst-lint
|
||||
rev: v1.3.2
|
||||
hooks:
|
||||
- id: rst-lint
|
||||
name: Check reST files using rst-lint
|
||||
exclude: |
|
||||
(?x)^(
|
||||
docs/CHANGELOG.rst|
|
||||
docs/TOFS_pattern.rst|
|
||||
docs/CONTRIBUTING_DOCS.rst|
|
||||
docs/index.rst|
|
||||
docs/pillar.rst|
|
||||
)$
|
||||
additional_dependencies: [pygments==2.9.0]
|
||||
4
.rstcheck.cfg
Normal file
4
.rstcheck.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[rstcheck]
|
||||
report=info
|
||||
ignore_language=rst
|
||||
ignore_messages=(Duplicate (ex|im)plicit target.*|Hyperlink target ".*" is not referenced\.$)
|
||||
23
.rubocop.yml
Normal file
23
.rubocop.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
# General overrides used across formulas in the org
|
||||
Layout/LineLength:
|
||||
# Increase from default of `80`
|
||||
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
|
||||
Max: 88
|
||||
Metrics/BlockLength:
|
||||
IgnoredMethods:
|
||||
- control
|
||||
- describe
|
||||
# Increase from default of `25`
|
||||
Max: 30
|
||||
Security/YAMLLoad:
|
||||
Exclude:
|
||||
- test/integration/**/_mapdata.rb
|
||||
|
||||
# General settings across all cops in this formula
|
||||
AllCops:
|
||||
NewCops: enable
|
||||
|
||||
# Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config`
|
||||
14
.salt-lint
Normal file
14
.salt-lint
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
exclude_paths: []
|
||||
rules: {}
|
||||
skip_list:
|
||||
# Using `salt-lint` for linting other files as well, such as Jinja macros/templates
|
||||
- 205 # Use ".sls" as a Salt State file extension
|
||||
# Skipping `207` and `208` because `210` is sufficient, at least for the time-being
|
||||
# I.e. Allows 3-digit unquoted codes to still be used, such as `644` and `755`
|
||||
- 207 # File modes should always be encapsulated in quotation marks
|
||||
- 208 # File modes should always contain a leading zero
|
||||
tags: []
|
||||
verbosity: 1
|
||||
192
.travis.yml
Normal file
192
.travis.yml
Normal file
@@ -0,0 +1,192 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
################################################################################
|
||||
# NOTE: This file is UNMAINTAINED; it is provided for references purposes only.
|
||||
# No guarantees are tendered that this structure will work after 2020.
|
||||
################################################################################
|
||||
# * https://en.wikipedia.org/wiki/Travis_CI:
|
||||
# - "... free open-source plans were removed in [sic] the end of 2020"
|
||||
# - https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing
|
||||
# - https://ropensci.org/technotes/2020/11/19/moving-away-travis/
|
||||
################################################################################
|
||||
## Machine config
|
||||
os: 'linux'
|
||||
arch: 'amd64'
|
||||
dist: 'bionic'
|
||||
version: '~> 1.0'
|
||||
|
||||
## Language and cache config
|
||||
language: 'ruby'
|
||||
cache: 'bundler'
|
||||
|
||||
## Services config
|
||||
services:
|
||||
- docker
|
||||
|
||||
## Script to run for the test stage
|
||||
script:
|
||||
- bin/kitchen verify "${INSTANCE}"
|
||||
|
||||
## Stages and jobs matrix
|
||||
stages:
|
||||
- test
|
||||
# # As part of the switch away from Travis CI, ensure that the `release` stage
|
||||
# # is not run inadvertently
|
||||
# - name: 'release'
|
||||
# if: 'branch = master AND type != pull_request'
|
||||
jobs:
|
||||
include:
|
||||
## Define the test stage that runs the linters (and testing matrix, if applicable)
|
||||
|
||||
# Run all of the linters in a single job
|
||||
- language: 'node_js'
|
||||
node_js: 'lts/*'
|
||||
env: 'Lint'
|
||||
name: 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint'
|
||||
before_install: 'skip'
|
||||
script:
|
||||
# Install and run `salt-lint`
|
||||
- pip install --user salt-lint
|
||||
- git ls-files -- '*.sls' '*.jinja' '*.j2' '*.tmpl' '*.tst'
|
||||
| xargs salt-lint
|
||||
# Install and run `yamllint`
|
||||
# Need at least `v1.17.0` for the `yaml-files` setting
|
||||
- pip install --user yamllint>=1.17.0
|
||||
- yamllint -s .
|
||||
# Install and run `rubocop`
|
||||
- gem install rubocop
|
||||
- rubocop -d
|
||||
# Run `shellcheck` (already pre-installed in Travis)
|
||||
- shellcheck --version
|
||||
- git ls-files -- '*.sh' '*.bash' '*.ksh'
|
||||
| xargs shellcheck
|
||||
# Install and run `commitlint`
|
||||
- npm i -D @commitlint/config-conventional
|
||||
@commitlint/travis-cli
|
||||
- commitlint-travis
|
||||
|
||||
# Run `pre-commit` linters in a single job
|
||||
- language: 'python'
|
||||
env: 'Lint_pre-commit'
|
||||
name: 'Lint: pre-commit'
|
||||
before_install: 'skip'
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/pre-commit
|
||||
script:
|
||||
# Install and run `pre-commit`
|
||||
- pip install pre-commit==2.7.1
|
||||
- pre-commit run --all-files --color always --verbose
|
||||
- pre-commit run --color always --hook-stage manual --verbose commitlint-travis
|
||||
|
||||
## Define the rest of the matrix based on Kitchen testing
|
||||
# Make sure the instances listed below match up with
|
||||
# the `platforms` defined in `kitchen.yml`
|
||||
# NOTE: Please try to select up to six instances that add some meaningful
|
||||
# testing of the formula's behaviour. If possible, try to refrain from
|
||||
# the classical "chosing all the instances because I want to test on
|
||||
# another/all distro/s" trap: it will just add time to the testing (see
|
||||
# the discussion on #121). As an example, the set chosen below covers
|
||||
# the most used distros families, systemd and non-systemd and the latest
|
||||
# three supported Saltstack versions with python2 and 3.
|
||||
# As for `kitchen.yml`, that should still contain all of the platforms,
|
||||
# to allow for comprehensive local testing
|
||||
# Ref: https://github.com/saltstack-formulas/template-formula/issues/118
|
||||
# Ref: https://github.com/saltstack-formulas/template-formula/issues/121
|
||||
# - env: INSTANCE=default-debian-11-tiamat-py3
|
||||
# - env: INSTANCE=default-debian-10-tiamat-py3
|
||||
# - env: INSTANCE=default-debian-9-tiamat-py3
|
||||
# - env: INSTANCE=default-ubuntu-2004-tiamat-py3
|
||||
# - env: INSTANCE=default-ubuntu-1804-tiamat-py3
|
||||
# - env: INSTANCE=default-centos-stream8-tiamat-py3
|
||||
# - env: INSTANCE=default-centos-7-tiamat-py3
|
||||
# - env: INSTANCE=default-amazonlinux-2-tiamat-py3
|
||||
# - env: INSTANCE=default-oraclelinux-8-tiamat-py3
|
||||
# - env: INSTANCE=default-oraclelinux-7-tiamat-py3
|
||||
# - env: INSTANCE=default-almalinux-8-tiamat-py3
|
||||
# - env: INSTANCE=default-rockylinux-8-tiamat-py3
|
||||
- env: INSTANCE=default-debian-11-master-py3
|
||||
- env: INSTANCE=default-debian-10-master-py3
|
||||
- env: INSTANCE=default-debian-9-master-py3
|
||||
- env: INSTANCE=default-ubuntu-2004-master-py3
|
||||
- env: INSTANCE=default-ubuntu-1804-master-py3
|
||||
- env: INSTANCE=default-centos-stream8-master-py3
|
||||
- env: INSTANCE=default-centos-7-master-py3
|
||||
- env: INSTANCE=default-fedora-36-master-py3
|
||||
- env: INSTANCE=default-fedora-35-master-py3
|
||||
- env: INSTANCE=default-fedora-34-master-py3
|
||||
- env: INSTANCE=default-opensuse-leap-153-master-py3
|
||||
- env: INSTANCE=default-opensuse-tmbl-latest-master-py3
|
||||
- env: INSTANCE=default-amazonlinux-2-master-py3
|
||||
- env: INSTANCE=default-oraclelinux-8-master-py3
|
||||
- env: INSTANCE=default-oraclelinux-7-master-py3
|
||||
- env: INSTANCE=default-arch-base-latest-master-py3
|
||||
- env: INSTANCE=default-gentoo-stage3-latest-master-py3
|
||||
- env: INSTANCE=default-gentoo-stage3-systemd-master-py3
|
||||
- env: INSTANCE=default-almalinux-8-master-py3
|
||||
- env: INSTANCE=default-rockylinux-8-master-py3
|
||||
# - env: INSTANCE=default-debian-11-3004-1-py3
|
||||
# - env: INSTANCE=default-debian-10-3004-1-py3
|
||||
# - env: INSTANCE=default-debian-9-3004-1-py3
|
||||
# - env: INSTANCE=default-ubuntu-2004-3004-1-py3
|
||||
# - env: INSTANCE=default-ubuntu-1804-3004-1-py3
|
||||
# - env: INSTANCE=default-centos-stream8-3004-1-py3
|
||||
# - env: INSTANCE=default-centos-7-3004-1-py3
|
||||
# - env: INSTANCE=default-fedora-36-3004-1-py3
|
||||
# - env: INSTANCE=default-fedora-35-3004-1-py3
|
||||
# - env: INSTANCE=default-fedora-34-3004-1-py3
|
||||
# - env: INSTANCE=default-amazonlinux-2-3004-1-py3
|
||||
# - env: INSTANCE=default-oraclelinux-8-3004-1-py3
|
||||
# - env: INSTANCE=default-oraclelinux-7-3004-1-py3
|
||||
# - env: INSTANCE=default-arch-base-latest-3004-1-py3
|
||||
# - env: INSTANCE=default-gentoo-stage3-latest-3004-1-py3
|
||||
# - env: INSTANCE=default-gentoo-stage3-systemd-3004-1-py3
|
||||
# - env: INSTANCE=default-almalinux-8-3004-1-py3
|
||||
# - env: INSTANCE=default-rockylinux-8-3004-1-py3
|
||||
# - env: INSTANCE=default-opensuse-leap-153-3004-0-py3
|
||||
# - env: INSTANCE=default-opensuse-tmbl-latest-3004-0-py3
|
||||
# - env: INSTANCE=default-debian-10-3003-4-py3
|
||||
# - env: INSTANCE=default-debian-9-3003-4-py3
|
||||
# - env: INSTANCE=default-ubuntu-2004-3003-4-py3
|
||||
# - env: INSTANCE=default-ubuntu-1804-3003-4-py3
|
||||
# - env: INSTANCE=default-centos-stream8-3003-4-py3
|
||||
# - env: INSTANCE=default-centos-7-3003-4-py3
|
||||
# - env: INSTANCE=default-amazonlinux-2-3003-4-py3
|
||||
# - env: INSTANCE=default-oraclelinux-8-3003-4-py3
|
||||
# - env: INSTANCE=default-oraclelinux-7-3003-4-py3
|
||||
# - env: INSTANCE=default-almalinux-8-3003-4-py3
|
||||
# - env: INSTANCE=default-debian-10-3002-8-py3
|
||||
# - env: INSTANCE=default-debian-9-3002-8-py3
|
||||
# - env: INSTANCE=default-ubuntu-2004-3002-8-py3
|
||||
# - env: INSTANCE=default-ubuntu-1804-3002-8-py3
|
||||
# - env: INSTANCE=default-centos-7-3002-8-py3
|
||||
# - env: INSTANCE=default-amazonlinux-2-3002-8-py3
|
||||
# - env: INSTANCE=default-oraclelinux-8-3002-8-py3
|
||||
# - env: INSTANCE=default-oraclelinux-7-3002-8-py3
|
||||
|
||||
## Define the release stage that runs `semantic-release`
|
||||
- stage: 'release'
|
||||
language: 'node_js'
|
||||
node_js: 'lts/*'
|
||||
env: 'Release'
|
||||
name: 'Run semantic-release inc. file updates to AUTHORS, CHANGELOG & FORMULA'
|
||||
before_install: 'skip'
|
||||
script:
|
||||
# Update `AUTHORS.md`
|
||||
- export MAINTAINER_TOKEN=${GH_TOKEN}
|
||||
- go get github.com/myii/maintainer
|
||||
- maintainer contributor
|
||||
|
||||
# Install all dependencies required for `semantic-release`
|
||||
- npm i -D @semantic-release/changelog@3
|
||||
@semantic-release/exec@3
|
||||
@semantic-release/git@7
|
||||
deploy:
|
||||
provider: 'script'
|
||||
# Opt-in to `dpl v2` to complete the Travis build config validation (beta)
|
||||
# * https://docs.travis-ci.com/user/build-config-validation
|
||||
# Deprecated `skip_cleanup` can now be avoided, `cleanup: false` is by default
|
||||
edge: true
|
||||
# Run `semantic-release`
|
||||
script: 'npx semantic-release@15.14'
|
||||
44
.yamllint
Normal file
44
.yamllint
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
# Extend the `default` configuration provided by `yamllint`
|
||||
extends: 'default'
|
||||
|
||||
# Files to ignore completely
|
||||
# 1. All YAML files under directory `.bundle/`, introduced if gems are installed locally
|
||||
# 2. All YAML files under directory `.cache/`, introduced during the CI run
|
||||
# 3. All YAML files under directory `.git/`
|
||||
# 4. All YAML files under directory `node_modules/`, introduced during the CI run
|
||||
# 5. Any SLS files under directory `test/`, which are actually state files
|
||||
# 6. Any YAML files under directory `.kitchen/`, introduced during local testing
|
||||
# 7. `kitchen.vagrant.yml`, which contains Embedded Ruby (ERB) template syntax
|
||||
ignore: |
|
||||
.bundle/
|
||||
.cache/
|
||||
.git/
|
||||
node_modules/
|
||||
test/**/states/**/*.sls
|
||||
.kitchen/
|
||||
kitchen.vagrant.yml
|
||||
|
||||
yaml-files:
|
||||
# Default settings
|
||||
- '*.yaml'
|
||||
- '*.yml'
|
||||
- .salt-lint
|
||||
- .yamllint
|
||||
# SaltStack Formulas additional settings
|
||||
- '*.example'
|
||||
- test/**/*.sls
|
||||
|
||||
rules:
|
||||
empty-values:
|
||||
forbid-in-block-mappings: true
|
||||
forbid-in-flow-mappings: true
|
||||
line-length:
|
||||
# Increase from default of `80`
|
||||
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
|
||||
max: 88
|
||||
octal-values:
|
||||
forbid-implicit-octal: true
|
||||
forbid-explicit-octal: true
|
||||
53
CODEOWNERS
Normal file
53
CODEOWNERS
Normal file
@@ -0,0 +1,53 @@
|
||||
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
|
||||
|
||||
# SECTION: Owner(s) for everything in the repo, unless a later match takes precedence
|
||||
# FILE PATTERN OWNER(S)
|
||||
* @lkubb
|
||||
|
||||
# SECTION: Owner(s) for specific directories
|
||||
# FILE PATTERN OWNER(S)
|
||||
|
||||
# SECTION: Owner(s) for files/directories related to `semantic-release`
|
||||
# FILE PATTERN OWNER(S)
|
||||
/.github/workflows/ @saltstack-formulas/ssf
|
||||
/bin/install-hooks @saltstack-formulas/ssf
|
||||
/bin/kitchen @saltstack-formulas/ssf
|
||||
/docs/AUTHORS.rst @saltstack-formulas/ssf
|
||||
/docs/CHANGELOG.rst @saltstack-formulas/ssf
|
||||
/docs/TOFS_pattern.rst @saltstack-formulas/ssf
|
||||
/*/_mapdata/ @saltstack-formulas/ssf
|
||||
/*/libmapstack.jinja @saltstack-formulas/ssf
|
||||
/*/libmatchers.jinja @saltstack-formulas/ssf
|
||||
/*/libsaltcli.jinja @saltstack-formulas/ssf
|
||||
/*/libtofs.jinja @saltstack-formulas/ssf
|
||||
/*/map.jinja @saltstack-formulas/ssf
|
||||
/test/integration/**/_mapdata.rb @saltstack-formulas/ssf
|
||||
/test/integration/**/libraries/system.rb @saltstack-formulas/ssf
|
||||
/test/integration/**/inspec.yml @saltstack-formulas/ssf
|
||||
/test/integration/**/README.md @saltstack-formulas/ssf
|
||||
/test/salt/pillar/top.sls @saltstack-formulas/ssf
|
||||
/.gitignore @saltstack-formulas/ssf
|
||||
/.cirrus.yml @saltstack-formulas/ssf
|
||||
/.gitlab-ci.yml @saltstack-formulas/ssf
|
||||
/.pre-commit-config.yaml @saltstack-formulas/ssf
|
||||
/.rstcheck.cfg @saltstack-formulas/ssf
|
||||
/.rubocop.yml @saltstack-formulas/ssf
|
||||
/.salt-lint @saltstack-formulas/ssf
|
||||
/.travis.yml @saltstack-formulas/ssf
|
||||
/.yamllint @saltstack-formulas/ssf
|
||||
/AUTHORS.md @saltstack-formulas/ssf
|
||||
/CHANGELOG.md @saltstack-formulas/ssf
|
||||
/CODEOWNERS @saltstack-formulas/ssf
|
||||
/commitlint.config.js @saltstack-formulas/ssf
|
||||
/FORMULA @saltstack-formulas/ssf
|
||||
/Gemfile @saltstack-formulas/ssf
|
||||
/Gemfile.lock @saltstack-formulas/ssf
|
||||
/kitchen.yml @saltstack-formulas/ssf
|
||||
/kitchen.vagrant.yml @saltstack-formulas/ssf
|
||||
/kitchen.windows.yml @saltstack-formulas/ssf
|
||||
/pre-commit_semantic-release.sh @saltstack-formulas/ssf
|
||||
/release-rules.js @saltstack-formulas/ssf
|
||||
/release.config.js @saltstack-formulas/ssf
|
||||
|
||||
# SECTION: Owner(s) for specific files
|
||||
# FILE PATTERN OWNER(S)
|
||||
9
FORMULA
Normal file
9
FORMULA
Normal file
@@ -0,0 +1,9 @@
|
||||
name: gitea
|
||||
os: Debian, Ubuntu, Raspbian, RedHat, Fedora, CentOS, Amazon, Oracle, Suse, openSUSE, Gentoo, Funtoo, Arch, Manjaro, Alpine, FreeBSD, OpenBSD, Solaris, SmartOS, Windows, MacOS
|
||||
os_family: Debian, RedHat, Suse, Gentoo, Arch, Alpine, FreeBSD, OpenBSD, Solaris, Windows, MacOS
|
||||
version: 1.0.0
|
||||
release: 1
|
||||
minimum_version: 2019.2
|
||||
summary: Gitea formula
|
||||
description: Manage Gitea with Salt
|
||||
top_level_dir: gitea
|
||||
19
Gemfile
Normal file
19
Gemfile
Normal file
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source ENV['PROXY_RUBYGEMSORG'] || 'https://rubygems.org'
|
||||
|
||||
# Install the `inspec` gem using `git` because versions after `4.22.22`
|
||||
# suppress diff output; this version fixes this for our uses.
|
||||
# rubocop:disable Layout/LineLength
|
||||
gem 'inspec', git: 'https://gitlab.com/saltstack-formulas/infrastructure/inspec', branch: 'ssf'
|
||||
# rubocop:enable Layout/LineLength
|
||||
|
||||
# Install the `kitchen-docker` gem using `git` in order to gain a performance
|
||||
# improvement: avoid package installations which are already covered by the
|
||||
# `salt-image-builder` (i.e. the pre-salted images that we're using)
|
||||
# rubocop:disable Layout/LineLength
|
||||
gem 'kitchen-docker', git: 'https://gitlab.com/saltstack-formulas/infrastructure/kitchen-docker', branch: 'ssf'
|
||||
# rubocop:enable Layout/LineLength
|
||||
|
||||
gem 'kitchen-inspec', '>= 2.5.0'
|
||||
gem 'kitchen-salt', '>= 0.7.2'
|
||||
675
Gemfile.lock
Normal file
675
Gemfile.lock
Normal file
@@ -0,0 +1,675 @@
|
||||
GIT
|
||||
remote: https://gitlab.com/saltstack-formulas/infrastructure/inspec
|
||||
revision: 1821d2dfd3365e8f05b8439845c58fa4d069806b
|
||||
branch: ssf
|
||||
specs:
|
||||
inspec (5.12.2)
|
||||
cookstyle
|
||||
faraday_middleware (>= 0.12.2, < 1.1)
|
||||
inspec-core (= 5.12.2)
|
||||
mongo (= 2.13.2)
|
||||
progress_bar (~> 1.3.3)
|
||||
rake
|
||||
train (~> 3.0)
|
||||
train-aws (~> 0.2)
|
||||
train-habitat (~> 0.1)
|
||||
train-winrm (~> 0.2)
|
||||
inspec-core (5.12.2)
|
||||
addressable (~> 2.4)
|
||||
chef-telemetry (~> 1.0, >= 1.0.8)
|
||||
faraday (>= 0.9.0, < 1.5)
|
||||
faraday_middleware (~> 1.0)
|
||||
hashie (>= 3.4, < 5.0)
|
||||
license-acceptance (>= 0.2.13, < 3.0)
|
||||
method_source (>= 0.8, < 2.0)
|
||||
mixlib-log (~> 3.0)
|
||||
multipart-post (~> 2.0)
|
||||
parallel (~> 1.9)
|
||||
parslet (>= 1.5, < 2.0)
|
||||
pry (~> 0.13)
|
||||
rspec (>= 3.9, <= 3.11)
|
||||
rspec-its (~> 1.2)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
semverse (~> 3.0)
|
||||
sslshake (~> 1.2)
|
||||
thor (>= 0.20, < 2.0)
|
||||
tomlrb (>= 1.2, < 2.1)
|
||||
train-core (~> 3.0)
|
||||
tty-prompt (~> 0.17)
|
||||
tty-table (~> 0.10)
|
||||
|
||||
GIT
|
||||
remote: https://gitlab.com/saltstack-formulas/infrastructure/kitchen-docker
|
||||
revision: 9a09bc1e571e25f3ccabf4725ca2048d970fff82
|
||||
branch: ssf
|
||||
specs:
|
||||
kitchen-docker (2.12.0)
|
||||
test-kitchen (>= 1.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (7.0.2.3)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
ast (2.4.2)
|
||||
aws-eventstream (1.2.0)
|
||||
aws-partitions (1.577.0)
|
||||
aws-sdk-alexaforbusiness (1.56.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-amplify (1.32.0)
|
||||
aws-sdk-core (~> 3, >= 3.120.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-apigateway (1.76.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-apigatewayv2 (1.42.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-applicationautoscaling (1.51.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-athena (1.53.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-autoscaling (1.63.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-batch (1.47.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-budgets (1.49.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudformation (1.68.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudfront (1.63.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudhsm (1.39.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudhsmv2 (1.42.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudtrail (1.48.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudwatch (1.64.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudwatchevents (1.46.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudwatchlogs (1.52.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-codecommit (1.51.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-codedeploy (1.49.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-codepipeline (1.53.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cognitoidentity (1.31.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cognitoidentityprovider (1.53.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-configservice (1.77.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-core (3.130.1)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
aws-partitions (~> 1, >= 1.525.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
jmespath (~> 1.0)
|
||||
aws-sdk-costandusagereportservice (1.40.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-databasemigrationservice (1.53.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-dynamodb (1.74.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ec2 (1.307.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ecr (1.56.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ecrpublic (1.12.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ecs (1.99.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-efs (1.54.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-eks (1.74.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-elasticache (1.76.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-elasticbeanstalk (1.51.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-elasticloadbalancing (1.40.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-elasticloadbalancingv2 (1.77.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-elasticsearchservice (1.65.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-emr (1.53.0)
|
||||
aws-sdk-core (~> 3, >= 3.121.2)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-eventbridge (1.24.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-firehose (1.48.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-glue (1.88.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-guardduty (1.56.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-iam (1.68.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-kafka (1.49.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-kinesis (1.41.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-kms (1.55.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-lambda (1.83.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-mq (1.40.0)
|
||||
aws-sdk-core (~> 3, >= 3.120.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-networkfirewall (1.15.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-networkmanager (1.22.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-organizations (1.59.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ram (1.26.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-rds (1.143.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-redshift (1.80.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-route53 (1.62.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-route53domains (1.40.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-route53resolver (1.37.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-s3 (1.113.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.4)
|
||||
aws-sdk-s3control (1.43.0)
|
||||
aws-sdk-core (~> 3, >= 3.122.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-secretsmanager (1.46.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-securityhub (1.63.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-servicecatalog (1.60.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ses (1.41.0)
|
||||
aws-sdk-core (~> 3, >= 3.120.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-shield (1.48.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-signer (1.32.0)
|
||||
aws-sdk-core (~> 3, >= 3.120.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-simpledb (1.29.0)
|
||||
aws-sdk-core (~> 3, >= 3.120.0)
|
||||
aws-sigv2 (~> 1.0)
|
||||
aws-sdk-sms (1.40.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-sns (1.53.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-sqs (1.51.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ssm (1.134.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-states (1.39.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-synthetics (1.19.0)
|
||||
aws-sdk-core (~> 3, >= 3.121.2)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-transfer (1.34.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-waf (1.43.0)
|
||||
aws-sdk-core (~> 3, >= 3.122.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sigv2 (1.1.0)
|
||||
aws-sigv4 (1.4.0)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
azure_graph_rbac (0.17.2)
|
||||
ms_rest_azure (~> 0.12.0)
|
||||
azure_mgmt_key_vault (0.17.7)
|
||||
ms_rest_azure (~> 0.12.0)
|
||||
azure_mgmt_resources (0.18.2)
|
||||
ms_rest_azure (~> 0.12.0)
|
||||
azure_mgmt_security (0.19.0)
|
||||
ms_rest_azure (~> 0.12.0)
|
||||
azure_mgmt_storage (0.23.0)
|
||||
ms_rest_azure (~> 0.12.0)
|
||||
bcrypt_pbkdf (1.1.0)
|
||||
bson (4.14.1)
|
||||
builder (3.2.4)
|
||||
chef-config (17.10.0)
|
||||
addressable
|
||||
chef-utils (= 17.10.0)
|
||||
fuzzyurl
|
||||
mixlib-config (>= 2.2.12, < 4.0)
|
||||
mixlib-shellout (>= 2.0, < 4.0)
|
||||
tomlrb (~> 1.2)
|
||||
chef-telemetry (1.1.1)
|
||||
chef-config
|
||||
concurrent-ruby (~> 1.0)
|
||||
chef-utils (17.10.0)
|
||||
concurrent-ruby
|
||||
coderay (1.1.3)
|
||||
concurrent-ruby (1.1.10)
|
||||
cookstyle (7.32.1)
|
||||
rubocop (= 1.25.1)
|
||||
declarative (0.0.20)
|
||||
diff-lcs (1.5.0)
|
||||
docker-api (2.2.0)
|
||||
excon (>= 0.47.0)
|
||||
multi_json
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
ed25519 (1.3.0)
|
||||
erubi (1.10.0)
|
||||
excon (0.92.2)
|
||||
faraday (1.4.3)
|
||||
faraday-em_http (~> 1.0)
|
||||
faraday-em_synchrony (~> 1.0)
|
||||
faraday-excon (~> 1.1)
|
||||
faraday-net_http (~> 1.0)
|
||||
faraday-net_http_persistent (~> 1.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-cookie_jar (0.0.7)
|
||||
faraday (>= 0.8.0)
|
||||
http-cookie (~> 1.0.0)
|
||||
faraday-em_http (1.0.0)
|
||||
faraday-em_synchrony (1.0.0)
|
||||
faraday-excon (1.1.0)
|
||||
faraday-net_http (1.0.1)
|
||||
faraday-net_http_persistent (1.2.0)
|
||||
faraday_middleware (1.0.0)
|
||||
faraday (~> 1.0)
|
||||
ffi (1.15.5)
|
||||
fuzzyurl (0.9.0)
|
||||
google-api-client (0.52.0)
|
||||
addressable (~> 2.5, >= 2.5.1)
|
||||
googleauth (~> 0.9)
|
||||
httpclient (>= 2.8.1, < 3.0)
|
||||
mini_mime (~> 1.0)
|
||||
representable (~> 3.0)
|
||||
retriable (>= 2.0, < 4.0)
|
||||
rexml
|
||||
signet (~> 0.12)
|
||||
googleauth (0.14.0)
|
||||
faraday (>= 0.17.3, < 2.0)
|
||||
jwt (>= 1.4, < 3.0)
|
||||
memoist (~> 0.16)
|
||||
multi_json (~> 1.11)
|
||||
os (>= 0.9, < 2.0)
|
||||
signet (~> 0.14)
|
||||
gssapi (1.3.1)
|
||||
ffi (>= 1.0.1)
|
||||
gyoku (1.4.0)
|
||||
builder (>= 2.1.2)
|
||||
rexml (~> 3.0)
|
||||
hashie (4.1.0)
|
||||
highline (2.0.3)
|
||||
http-cookie (1.0.4)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
i18n (1.10.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
inifile (3.0.0)
|
||||
jmespath (1.6.1)
|
||||
json (2.6.1)
|
||||
jwt (2.3.0)
|
||||
kitchen-inspec (2.5.2)
|
||||
hashie (>= 3.4, <= 5.0)
|
||||
inspec (>= 2.2.64, < 6.0)
|
||||
test-kitchen (>= 2.7, < 4)
|
||||
kitchen-salt (0.7.2)
|
||||
hashie (>= 3.5)
|
||||
test-kitchen (>= 1.4)
|
||||
license-acceptance (2.1.13)
|
||||
pastel (~> 0.7)
|
||||
tomlrb (>= 1.2, < 3.0)
|
||||
tty-box (~> 0.6)
|
||||
tty-prompt (~> 0.20)
|
||||
little-plugger (1.1.4)
|
||||
logging (2.3.0)
|
||||
little-plugger (~> 1.1)
|
||||
multi_json (~> 1.14)
|
||||
memoist (0.16.2)
|
||||
method_source (1.0.0)
|
||||
mini_mime (1.1.2)
|
||||
minitest (5.15.0)
|
||||
mixlib-config (3.0.9)
|
||||
tomlrb
|
||||
mixlib-install (3.12.16)
|
||||
mixlib-shellout
|
||||
mixlib-versioning
|
||||
thor
|
||||
mixlib-log (3.0.9)
|
||||
mixlib-shellout (3.2.7)
|
||||
chef-utils
|
||||
mixlib-versioning (1.2.12)
|
||||
mongo (2.13.2)
|
||||
bson (>= 4.8.2, < 5.0.0)
|
||||
ms_rest (0.7.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
faraday (>= 0.9, < 2.0.0)
|
||||
timeliness (~> 0.3.10)
|
||||
ms_rest_azure (0.12.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
faraday (>= 0.9, < 2.0.0)
|
||||
faraday-cookie_jar (~> 0.0.6)
|
||||
ms_rest (~> 0.7.6)
|
||||
multi_json (1.15.0)
|
||||
multipart-post (2.1.1)
|
||||
net-scp (3.0.0)
|
||||
net-ssh (>= 2.6.5, < 7.0.0)
|
||||
net-ssh (6.1.0)
|
||||
net-ssh-gateway (2.0.0)
|
||||
net-ssh (>= 4.0.0)
|
||||
nori (2.6.0)
|
||||
options (2.3.2)
|
||||
os (1.1.4)
|
||||
parallel (1.22.1)
|
||||
parser (3.1.2.0)
|
||||
ast (~> 2.4.1)
|
||||
parslet (1.8.2)
|
||||
pastel (0.8.0)
|
||||
tty-color (~> 0.5)
|
||||
progress_bar (1.3.3)
|
||||
highline (>= 1.6, < 3)
|
||||
options (~> 2.3.0)
|
||||
pry (0.14.1)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
public_suffix (4.0.7)
|
||||
rainbow (3.1.1)
|
||||
rake (13.0.6)
|
||||
regexp_parser (2.3.0)
|
||||
representable (3.1.1)
|
||||
declarative (< 0.1.0)
|
||||
trailblazer-option (>= 0.1.1, < 0.2.0)
|
||||
uber (< 0.2.0)
|
||||
retriable (3.1.2)
|
||||
rexml (3.2.5)
|
||||
rspec (3.11.0)
|
||||
rspec-core (~> 3.11.0)
|
||||
rspec-expectations (~> 3.11.0)
|
||||
rspec-mocks (~> 3.11.0)
|
||||
rspec-core (3.11.0)
|
||||
rspec-support (~> 3.11.0)
|
||||
rspec-expectations (3.11.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.11.0)
|
||||
rspec-its (1.3.0)
|
||||
rspec-core (>= 3.0.0)
|
||||
rspec-expectations (>= 3.0.0)
|
||||
rspec-mocks (3.11.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.11.0)
|
||||
rspec-support (3.11.0)
|
||||
rubocop (1.25.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.1.0.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml
|
||||
rubocop-ast (>= 1.15.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.17.0)
|
||||
parser (>= 3.1.1.0)
|
||||
ruby-progressbar (1.11.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyntlm (0.6.3)
|
||||
rubyzip (2.3.2)
|
||||
semverse (3.0.0)
|
||||
signet (0.16.1)
|
||||
addressable (~> 2.8)
|
||||
faraday (>= 0.17.5, < 3.0)
|
||||
jwt (>= 1.5, < 3.0)
|
||||
multi_json (~> 1.10)
|
||||
sslshake (1.3.1)
|
||||
strings (0.2.1)
|
||||
strings-ansi (~> 0.2)
|
||||
unicode-display_width (>= 1.5, < 3.0)
|
||||
unicode_utils (~> 1.4)
|
||||
strings-ansi (0.2.0)
|
||||
test-kitchen (3.2.2)
|
||||
bcrypt_pbkdf (~> 1.0)
|
||||
chef-utils (>= 16.4.35)
|
||||
ed25519 (~> 1.2)
|
||||
license-acceptance (>= 1.0.11, < 3.0)
|
||||
mixlib-install (~> 3.6)
|
||||
mixlib-shellout (>= 1.2, < 4.0)
|
||||
net-scp (>= 1.1, < 4.0)
|
||||
net-ssh (>= 2.9, < 7.0)
|
||||
net-ssh-gateway (>= 1.2, < 3.0)
|
||||
thor (>= 0.19, < 2.0)
|
||||
winrm (~> 2.0)
|
||||
winrm-elevated (~> 1.0)
|
||||
winrm-fs (~> 1.1)
|
||||
thor (1.2.1)
|
||||
timeliness (0.3.10)
|
||||
tomlrb (1.3.0)
|
||||
trailblazer-option (0.1.2)
|
||||
train (3.9.2)
|
||||
activesupport (>= 6.0.3.1)
|
||||
azure_graph_rbac (~> 0.16)
|
||||
azure_mgmt_key_vault (~> 0.17)
|
||||
azure_mgmt_resources (~> 0.15)
|
||||
azure_mgmt_security (~> 0.18)
|
||||
azure_mgmt_storage (~> 0.18)
|
||||
docker-api (>= 1.26, < 3.0)
|
||||
google-api-client (>= 0.23.9, <= 0.52.0)
|
||||
googleauth (>= 0.6.6, <= 0.14.0)
|
||||
inifile (~> 3.0)
|
||||
train-core (= 3.9.2)
|
||||
train-winrm (~> 0.2)
|
||||
train-aws (0.2.24)
|
||||
aws-sdk-alexaforbusiness (~> 1.0)
|
||||
aws-sdk-amplify (~> 1.32.0)
|
||||
aws-sdk-apigateway (~> 1.0)
|
||||
aws-sdk-apigatewayv2 (~> 1.0)
|
||||
aws-sdk-applicationautoscaling (>= 1.46, < 1.52)
|
||||
aws-sdk-athena (~> 1.0)
|
||||
aws-sdk-autoscaling (>= 1.22, < 1.64)
|
||||
aws-sdk-batch (>= 1.36, < 1.48)
|
||||
aws-sdk-budgets (~> 1.0)
|
||||
aws-sdk-cloudformation (~> 1.0)
|
||||
aws-sdk-cloudfront (~> 1.0)
|
||||
aws-sdk-cloudhsm (~> 1.0)
|
||||
aws-sdk-cloudhsmv2 (~> 1.0)
|
||||
aws-sdk-cloudtrail (~> 1.8)
|
||||
aws-sdk-cloudwatch (~> 1.13)
|
||||
aws-sdk-cloudwatchevents (>= 1.36, < 1.47)
|
||||
aws-sdk-cloudwatchlogs (~> 1.13)
|
||||
aws-sdk-codecommit (~> 1.0)
|
||||
aws-sdk-codedeploy (~> 1.0)
|
||||
aws-sdk-codepipeline (~> 1.0)
|
||||
aws-sdk-cognitoidentity (>= 1.26, < 1.32)
|
||||
aws-sdk-cognitoidentityprovider (>= 1.46, < 1.54)
|
||||
aws-sdk-configservice (~> 1.21)
|
||||
aws-sdk-core (~> 3.0)
|
||||
aws-sdk-costandusagereportservice (~> 1.6)
|
||||
aws-sdk-databasemigrationservice (>= 1.42, < 1.54)
|
||||
aws-sdk-dynamodb (~> 1.31)
|
||||
aws-sdk-ec2 (~> 1.70)
|
||||
aws-sdk-ecr (~> 1.18)
|
||||
aws-sdk-ecrpublic (~> 1.3)
|
||||
aws-sdk-ecs (~> 1.30)
|
||||
aws-sdk-efs (~> 1.0)
|
||||
aws-sdk-eks (~> 1.9)
|
||||
aws-sdk-elasticache (~> 1.0)
|
||||
aws-sdk-elasticbeanstalk (~> 1.0)
|
||||
aws-sdk-elasticloadbalancing (~> 1.8)
|
||||
aws-sdk-elasticloadbalancingv2 (~> 1.0)
|
||||
aws-sdk-elasticsearchservice (~> 1.0)
|
||||
aws-sdk-emr (~> 1.53.0)
|
||||
aws-sdk-eventbridge (~> 1.24.0)
|
||||
aws-sdk-firehose (~> 1.0)
|
||||
aws-sdk-glue (>= 1.71, < 1.89)
|
||||
aws-sdk-guardduty (~> 1.31)
|
||||
aws-sdk-iam (~> 1.13)
|
||||
aws-sdk-kafka (~> 1.0)
|
||||
aws-sdk-kinesis (~> 1.0)
|
||||
aws-sdk-kms (~> 1.13)
|
||||
aws-sdk-lambda (~> 1.0)
|
||||
aws-sdk-mq (~> 1.40.0)
|
||||
aws-sdk-networkfirewall (>= 1.6.0)
|
||||
aws-sdk-networkmanager (>= 1.13.0)
|
||||
aws-sdk-organizations (>= 1.17, < 1.60)
|
||||
aws-sdk-ram (>= 1.21, < 1.27)
|
||||
aws-sdk-rds (~> 1.43)
|
||||
aws-sdk-redshift (~> 1.0)
|
||||
aws-sdk-route53 (~> 1.0)
|
||||
aws-sdk-route53domains (~> 1.0)
|
||||
aws-sdk-route53resolver (~> 1.0)
|
||||
aws-sdk-s3 (~> 1.30)
|
||||
aws-sdk-s3control (~> 1.43.0)
|
||||
aws-sdk-secretsmanager (>= 1.42, < 1.47)
|
||||
aws-sdk-securityhub (~> 1.0)
|
||||
aws-sdk-servicecatalog (>= 1.48, < 1.61)
|
||||
aws-sdk-ses (~> 1.41.0)
|
||||
aws-sdk-shield (~> 1.30)
|
||||
aws-sdk-signer (~> 1.32.0)
|
||||
aws-sdk-simpledb (~> 1.29.0)
|
||||
aws-sdk-sms (~> 1.0)
|
||||
aws-sdk-sns (~> 1.9)
|
||||
aws-sdk-sqs (~> 1.10)
|
||||
aws-sdk-ssm (~> 1.0)
|
||||
aws-sdk-states (>= 1.35, < 1.40)
|
||||
aws-sdk-synthetics (~> 1.19.0)
|
||||
aws-sdk-transfer (>= 1.26, < 1.35)
|
||||
aws-sdk-waf (~> 1.43.0)
|
||||
train-core (3.9.2)
|
||||
addressable (~> 2.5)
|
||||
ffi (!= 1.13.0)
|
||||
json (>= 1.8, < 3.0)
|
||||
mixlib-shellout (>= 2.0, < 4.0)
|
||||
net-scp (>= 1.2, < 4.0)
|
||||
net-ssh (>= 2.9, < 7.0)
|
||||
train-habitat (0.2.22)
|
||||
train-winrm (0.2.13)
|
||||
winrm (>= 2.3.6, < 3.0)
|
||||
winrm-elevated (~> 1.2.2)
|
||||
winrm-fs (~> 1.0)
|
||||
tty-box (0.7.0)
|
||||
pastel (~> 0.8)
|
||||
strings (~> 0.2.0)
|
||||
tty-cursor (~> 0.7)
|
||||
tty-color (0.6.0)
|
||||
tty-cursor (0.7.1)
|
||||
tty-prompt (0.23.1)
|
||||
pastel (~> 0.8)
|
||||
tty-reader (~> 0.8)
|
||||
tty-reader (0.9.0)
|
||||
tty-cursor (~> 0.7)
|
||||
tty-screen (~> 0.8)
|
||||
wisper (~> 2.0)
|
||||
tty-screen (0.8.1)
|
||||
tty-table (0.12.0)
|
||||
pastel (~> 0.8)
|
||||
strings (~> 0.2.0)
|
||||
tty-screen (~> 0.8)
|
||||
tzinfo (2.0.4)
|
||||
concurrent-ruby (~> 1.0)
|
||||
uber (0.1.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.8.1)
|
||||
unicode-display_width (2.1.0)
|
||||
unicode_utils (1.4.0)
|
||||
winrm (2.3.6)
|
||||
builder (>= 2.1.2)
|
||||
erubi (~> 1.8)
|
||||
gssapi (~> 1.2)
|
||||
gyoku (~> 1.0)
|
||||
httpclient (~> 2.2, >= 2.2.0.2)
|
||||
logging (>= 1.6.1, < 3.0)
|
||||
nori (~> 2.0)
|
||||
rubyntlm (~> 0.6.0, >= 0.6.3)
|
||||
winrm-elevated (1.2.3)
|
||||
erubi (~> 1.8)
|
||||
winrm (~> 2.0)
|
||||
winrm-fs (~> 1.0)
|
||||
winrm-fs (1.3.5)
|
||||
erubi (~> 1.8)
|
||||
logging (>= 1.6.1, < 3.0)
|
||||
rubyzip (~> 2.0)
|
||||
winrm (~> 2.0)
|
||||
wisper (2.0.1)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
inspec!
|
||||
kitchen-docker!
|
||||
kitchen-inspec (>= 2.5.0)
|
||||
kitchen-salt (>= 0.7.2)
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.2
|
||||
13
LICENSE
Normal file
13
LICENSE
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright (c) 2014 Salt Stack Formulas
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
16
bin/install-hooks
Executable file
16
bin/install-hooks
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env sh
|
||||
set -o nounset # Treat unset variables as an error and immediately exit
|
||||
set -o errexit # If a command fails exit the whole script
|
||||
|
||||
if [ "${DEBUG:-false}" = "true" ]; then
|
||||
set -x # Run the entire script in debug mode
|
||||
fi
|
||||
|
||||
if ! command -v pre-commit >/dev/null 2>&1; then
|
||||
echo "pre-commit not found: please install or check your PATH" >&2
|
||||
echo "See https://pre-commit.com/#installation" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pre-commit install --install-hooks
|
||||
pre-commit install --hook-type commit-msg --install-hooks
|
||||
32
bin/kitchen
Executable file
32
bin/kitchen
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'kitchen' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require 'pathname'
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
bundle_binstub = File.expand_path('bundle', __dir__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort(
|
||||
'Your `bin/bundle` was not generated by Bundler, '\
|
||||
'so this binstub cannot run. Replace `bin/bundle` by running '\
|
||||
'`bundle binstubs bundler --force`, then run this command again.'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
|
||||
load Gem.bin_path('test-kitchen', 'kitchen')
|
||||
571
bin/slsdoc
Executable file
571
bin/slsdoc
Executable file
@@ -0,0 +1,571 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
This script renders Jinja comments found at the beginning
|
||||
of `.sls` files.
|
||||
|
||||
Since this was written for the salt tool suite,
|
||||
it should be placed in a sibling directory
|
||||
of a directory named tool_<something> containing
|
||||
the actual states to be able autodiscover them.
|
||||
|
||||
Of course, it can be used by other formulae by manually
|
||||
providing the root path and I might publish this at some
|
||||
point as a python module or at least in a separate repo
|
||||
to be used by pre-commit. It would need to be configurable
|
||||
without editing the source code for that. @TODO
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from jinja2 import Environment
|
||||
from jinja2.exceptions import TemplateSyntaxError
|
||||
|
||||
# import sphinx.util.docstrings as d
|
||||
|
||||
base_dir = Path(__file__).parent.parent.absolute()
|
||||
|
||||
|
||||
class State:
|
||||
"""
|
||||
Object representing a documented state.
|
||||
"""
|
||||
|
||||
def __init__(self, path, comment):
|
||||
self.path = path
|
||||
self.comment = comment
|
||||
|
||||
def tostateid(self, include_init=True, relative_to=""):
|
||||
ret = self.path.with_suffix("")
|
||||
|
||||
if not include_init and "init" == ret.parts[-1]:
|
||||
ret = ret.parent
|
||||
|
||||
if relative_to:
|
||||
relative_to = Path(relative_to.replace(".", "/"))
|
||||
ret = ret.relative_to(relative_to)
|
||||
|
||||
return str(ret).replace("/", ".")
|
||||
|
||||
def isinit(self):
|
||||
return "init.sls" == self.path.parts[-1]
|
||||
|
||||
def isclean(self):
|
||||
return "clean.sls" == self.path.parts[-1]
|
||||
|
||||
|
||||
class StateRegistry:
|
||||
"""
|
||||
Registers State objects. It generates several indices:
|
||||
|
||||
1. nested dictionary containing the states
|
||||
2. flattened list of states
|
||||
3. flattened list of prefixes ~ directories containing .sls files
|
||||
|
||||
All of them are guaranteed to be sorted, which is required
|
||||
by some of the downstream classes.
|
||||
"""
|
||||
|
||||
def __init__(self, reg=None, states=None, prefixes=None):
|
||||
if reg is None:
|
||||
reg = {}
|
||||
if states is None:
|
||||
states = []
|
||||
if prefixes is None:
|
||||
prefixes = []
|
||||
self.reg = reg
|
||||
self.states = states
|
||||
self.prefixes = prefixes
|
||||
|
||||
def lookup(self, state, tree=False):
|
||||
"""
|
||||
Looks up State objects by ID ('some.example' or ['some', 'example']).
|
||||
If tree, also returns pointers to dicts inside the nested registry.
|
||||
"""
|
||||
ptr = self.reg
|
||||
if isinstance(state, str):
|
||||
state = state.split(".")
|
||||
|
||||
try:
|
||||
while state:
|
||||
cur = state.pop(0)
|
||||
ptr = ptr[cur]
|
||||
except KeyError:
|
||||
return False
|
||||
|
||||
if isinstance(ptr, State) or tree:
|
||||
return ptr
|
||||
# map init.sls same way as salt does
|
||||
elif "init" in ptr:
|
||||
return ptr["init"]
|
||||
|
||||
raise ValueError("State could not be found.")
|
||||
|
||||
def register(self, state):
|
||||
state_id = state.tostateid()
|
||||
self.states.append(state_id)
|
||||
|
||||
parts = state_id.split(".")
|
||||
|
||||
ptr = self.reg
|
||||
prefix = ""
|
||||
|
||||
while len(parts) > 1:
|
||||
cur = parts.pop(0)
|
||||
prefix = (prefix + "." + cur) if prefix else cur
|
||||
# make sure subdicts are initialized
|
||||
if cur not in ptr:
|
||||
ptr[cur] = {}
|
||||
self.prefixes.append(prefix)
|
||||
ptr = ptr[cur]
|
||||
|
||||
ptr[parts.pop(0)] = state
|
||||
|
||||
self.prefixes.sort()
|
||||
self.states.sort()
|
||||
|
||||
def unregister(self, state):
|
||||
state_id = state.tostateid()
|
||||
self.states.remove(state_id)
|
||||
|
||||
if state_id.find("."):
|
||||
path, key = state_id.rsplit(".", maxsplit=1)
|
||||
parent = self.lookup(path, tree=True)
|
||||
else:
|
||||
parent = self.reg
|
||||
key = state_id
|
||||
|
||||
del parent[key]
|
||||
|
||||
def depth(self, prefix=""):
|
||||
"""
|
||||
Returns depth of nested dict. Optionally from a specified prefix.
|
||||
"""
|
||||
d = self.lookup(prefix, tree=True) if prefix else self.reg
|
||||
return self._get_depth(d)
|
||||
|
||||
def _get_depth(self, d):
|
||||
"""
|
||||
Recursively look up depth.
|
||||
"""
|
||||
if isinstance(d, dict) and set(d.keys()) - {"init", "clean"}:
|
||||
return 1 + (max(map(self._get_depth, d.values())) if d else 0)
|
||||
return 0
|
||||
|
||||
def count(self):
|
||||
return len(self.states)
|
||||
|
||||
def dump(self, prefix=""):
|
||||
"""
|
||||
Returns all states sorted alphabetically, optionally
|
||||
from a prefix onwards.
|
||||
"""
|
||||
for s in self.states:
|
||||
if not prefix or s.startswith(prefix):
|
||||
yield self.lookup(s)
|
||||
|
||||
|
||||
class Renderer:
|
||||
"""
|
||||
Base class for Renderer objects.
|
||||
"""
|
||||
|
||||
opts = {}
|
||||
|
||||
def __init__(self, target="docs", opts=None):
|
||||
if opts is not None:
|
||||
self.opts = self.opts | opts
|
||||
|
||||
if isinstance(target, str):
|
||||
target = Path(target)
|
||||
self.target = base_dir / target
|
||||
|
||||
self._ensurepath(self.target)
|
||||
|
||||
def render(self, states):
|
||||
raise NotImplementedError()
|
||||
|
||||
def _write(self, text, ncount=1):
|
||||
"""
|
||||
Convenience method to mimic writeln
|
||||
This is bad form though, implicitly requires
|
||||
self.f to be set before being called
|
||||
"""
|
||||
if not hasattr(self, "f"):
|
||||
raise ValueError(
|
||||
"Sorry, you need to set self.f to a file pointer before calling self._write methods."
|
||||
)
|
||||
self.f.write(text + "\n" * ncount)
|
||||
|
||||
def _write_heading(self, text, uline="-"):
|
||||
"""
|
||||
Convenience method to write a subheading
|
||||
"""
|
||||
self._write(text)
|
||||
self._write(uline * len(text))
|
||||
|
||||
def _write_main_heading(self, text, uline="="):
|
||||
"""
|
||||
Convenience method to write the main heading
|
||||
"""
|
||||
self.f.write(text + "\n")
|
||||
self.f.write(uline * len(text) + "\n\n")
|
||||
|
||||
def _write_main_description(self, text):
|
||||
"""
|
||||
Convenience method to write the main description
|
||||
"""
|
||||
self.f.write(text + "\n\n")
|
||||
|
||||
def _get_main_heading(self, states):
|
||||
"""
|
||||
Returns a string to be used as the main heading of an
|
||||
rst file. Looks up in the following order:
|
||||
1. If there is a documented root init.sls, return its first line.
|
||||
2. If a header was specified in opts, return that.
|
||||
3. If this renderer was instantiated with a prefix, return the
|
||||
capitalized last part of it.
|
||||
4. "Available States"
|
||||
"""
|
||||
if main := states.lookup(self.prefix + ".init"):
|
||||
lines = main.comment.splitlines()
|
||||
header = lines.pop(0)
|
||||
# make sure the header does not get printed twice
|
||||
main.comment = "\n".join(lines).strip("\n")
|
||||
return header
|
||||
if main := self.opts.get("header"):
|
||||
return main
|
||||
if self.prefix:
|
||||
return self.prefix.split(".")[-1].title()
|
||||
return "Available States"
|
||||
|
||||
def _get_main_description(self, states):
|
||||
"""
|
||||
Returns a string to be used as the main description (after the main header).
|
||||
Looks up in the following order:
|
||||
1. If there is a documented root init.sls, return everything but its first line.
|
||||
If it was found, unregister it to not render it twice (bad form again, maybe consider was_rendered on State)
|
||||
2. If a description was specified in opts, return that.
|
||||
3. general description
|
||||
"""
|
||||
if main := states.lookup(self.prefix + ".init"):
|
||||
comment = main.comment
|
||||
# make sure the comment does not get printed twice
|
||||
states.unregister(main)
|
||||
return comment
|
||||
if main := self.opts.get("description"):
|
||||
return main
|
||||
return "The following states are found in {}:".format(
|
||||
self.prefix if self.prefix else "this formula"
|
||||
)
|
||||
|
||||
def _write_header(self, states):
|
||||
"""
|
||||
Convenience method to write the main heading and description.
|
||||
"""
|
||||
self._write_main_heading(self._get_main_heading(states))
|
||||
self._write_main_description(self._get_main_description(states))
|
||||
self.f.write("\n")
|
||||
|
||||
def _ensurepath(self, path):
|
||||
"""
|
||||
Convenience method to mimic mkdir -p on the parent dir of a path
|
||||
"""
|
||||
if not path.parent.is_dir():
|
||||
path.parent.mkdir(parents=True)
|
||||
|
||||
|
||||
class SingleRenderer(Renderer):
|
||||
"""
|
||||
Renders documented Salt states in a single file. When a prefix
|
||||
is specified, it only considers states nested inside that prefix.
|
||||
|
||||
If there is a documented top-layer init.sls, the first line of
|
||||
its comment will become the main heading of the file, the stripped
|
||||
rest will be rendered directly below before any nested states.
|
||||
"""
|
||||
|
||||
opts = {
|
||||
# include init.sls files
|
||||
"init": True,
|
||||
# include .init suffix
|
||||
"init_suffix": False,
|
||||
# include clean.sls files
|
||||
"clean": False,
|
||||
# when rendering with prefix `settings.something`,
|
||||
# write `else` instead of `settings.something.else`
|
||||
"cut_prefix": False,
|
||||
}
|
||||
|
||||
def __init__(self, target="docs/states.rst", prefix="", opts=None):
|
||||
self.prefix = prefix
|
||||
|
||||
if isinstance(target, str):
|
||||
target = Path(target)
|
||||
|
||||
target = target.with_suffix(".rst")
|
||||
super().__init__(target, self.opts | opts or {})
|
||||
|
||||
def render(self, states):
|
||||
relative_to = self.prefix if self.opts["cut_prefix"] else ""
|
||||
|
||||
with open(self.target, "w") as f:
|
||||
self.f = f
|
||||
|
||||
self._write_header(states)
|
||||
|
||||
for state in states.dump(self.prefix):
|
||||
if not self.opts["clean"] and state.isclean():
|
||||
continue
|
||||
if not self.opts["init"] and state.isinit():
|
||||
continue
|
||||
self._write_heading(
|
||||
state.tostateid(self.opts["init_suffix"], relative_to)
|
||||
)
|
||||
self._write(state.comment, 3)
|
||||
|
||||
|
||||
class DepthRenderer(Renderer):
|
||||
"""
|
||||
Renders documented Salt states in separate files. They are combined
|
||||
according to the maximum nesting depth specified during instantiation.
|
||||
|
||||
Consider an example with max_depth=1.
|
||||
|
||||
This directory structure:
|
||||
settings
|
||||
├── animations
|
||||
│ ├── cursor_blinking
|
||||
│ └── window_resize_time
|
||||
└── apps
|
||||
└── messages
|
||||
└── read_receipts
|
||||
|
||||
will result in these files:
|
||||
* docs/settings/index.rst
|
||||
- animations
|
||||
- apps/index
|
||||
* docs/settings/animations.rst
|
||||
- cursor_blinking doc
|
||||
- window_resize_time doc
|
||||
* docs/settings/apps/index.rst
|
||||
- messages
|
||||
* docs/settings/apps/messages.rst
|
||||
- read_receipts doc
|
||||
"""
|
||||
|
||||
opts = {
|
||||
# maxdepth for generated index.rst files
|
||||
"index_maxdepth": 4,
|
||||
# also any options are passed through to the
|
||||
# delegate renderer, by default SingleRenderer
|
||||
}
|
||||
|
||||
def __init__(self, max_depth=1, target="docs/states", delegate_cls=None, opts=None):
|
||||
if delegate_cls is None:
|
||||
delegate_cls = SingleRenderer
|
||||
|
||||
self.max_depth = max_depth
|
||||
self.delegate = delegate_cls
|
||||
|
||||
super().__init__(target, self.opts | opts or {})
|
||||
|
||||
def render(self, states):
|
||||
found = []
|
||||
indices = {}
|
||||
cur_top = ""
|
||||
|
||||
# find at which prefix length the maxdepth is fulfilled
|
||||
for prefix in states.prefixes:
|
||||
# filtering out more specific = shallower dicts
|
||||
# this requires the list to be sorted!
|
||||
if cur_top:
|
||||
if prefix.startswith(cur_top):
|
||||
continue
|
||||
else:
|
||||
cur_top = ""
|
||||
if states.depth(prefix) <= self.max_depth:
|
||||
found.append(prefix)
|
||||
cur_top = prefix
|
||||
|
||||
# fill indices with relative links to
|
||||
# a) other indices if there are nested prefixes
|
||||
# b) the rendered files at that depth
|
||||
# example: settings.one settings.two.[subone, subtwo] =>
|
||||
# { settings: {'_index': ['one', 'two/index'],
|
||||
# 'two': {'_index': [subone, subtwo]}},
|
||||
# '_index': 'settings/index'}
|
||||
|
||||
for prefix in found:
|
||||
ptr = indices
|
||||
prefix = prefix.split(".")
|
||||
|
||||
while prefix:
|
||||
cur = prefix.pop(0)
|
||||
if prefix and cur not in ptr:
|
||||
ptr[cur] = {}
|
||||
if "_index" not in ptr:
|
||||
ptr["_index"] = []
|
||||
if prefix and cur + "/index" not in ptr["_index"]:
|
||||
ptr["_index"].append(cur + "/index")
|
||||
elif not prefix and cur not in ptr["_index"]:
|
||||
ptr["_index"].append(cur)
|
||||
if prefix:
|
||||
ptr = ptr[cur]
|
||||
|
||||
if "_index" in indices:
|
||||
self._render_index(states, indices)
|
||||
|
||||
for prefix in found:
|
||||
self._render_single(states, prefix)
|
||||
|
||||
def _render_single(self, states, prefix):
|
||||
target = self._get_target(prefix)
|
||||
renderer = self.delegate(target=target, prefix=prefix, opts=self.opts)
|
||||
renderer.render(states)
|
||||
|
||||
def _render_index(self, states, indices, prefix=""):
|
||||
target = self._get_target(prefix) / Path("index.rst")
|
||||
self._ensurepath(target)
|
||||
with open(target, "w") as f:
|
||||
self.f = f
|
||||
self.prefix = prefix
|
||||
self._write_header(states)
|
||||
self.prefix = ""
|
||||
f.write(
|
||||
"""
|
||||
.. toctree::
|
||||
:maxdepth: {}
|
||||
:caption: Contents:
|
||||
|
||||
""".format(
|
||||
self.opts.get("index_maxdepth", 4)
|
||||
)
|
||||
)
|
||||
for s in indices["_index"]:
|
||||
f.write(" " + s + "\n")
|
||||
for sub in indices:
|
||||
if "_index" == sub:
|
||||
continue
|
||||
if "_index" in indices[sub]:
|
||||
new_prefix = prefix + "." + sub if prefix else sub
|
||||
self._render_index(states, indices[sub], new_prefix)
|
||||
|
||||
def _get_target(self, prefix):
|
||||
target_prefix = Path(prefix.replace(".", "/"))
|
||||
target = self.target / target_prefix
|
||||
self._ensurepath(target)
|
||||
return target
|
||||
|
||||
|
||||
class SaltAutodoc:
|
||||
"""
|
||||
Looks for salt state files (*.sls) relative to base,
|
||||
reads them and looks for the first token being a Jinja
|
||||
comment. If the comment does not start with the string
|
||||
'@internal', it will be saved in the registry.
|
||||
|
||||
The registry is then passed to the renderer.
|
||||
"""
|
||||
|
||||
SKIP_FILE = "@internal"
|
||||
|
||||
def __init__(self, base=None, renderer=None, registry=None, env=None):
|
||||
"""
|
||||
base: base path containing Salt states to autodocument
|
||||
renderer: renderer to use for rendering
|
||||
"""
|
||||
if base is None:
|
||||
base = list(base_dir.glob("tool_*"))[0]
|
||||
self.base = base
|
||||
if renderer is None:
|
||||
renderer = SingleRenderer()
|
||||
self.renderer = renderer
|
||||
if env is None:
|
||||
env = Environment()
|
||||
self.env = env
|
||||
if registry is None:
|
||||
registry = StateRegistry()
|
||||
self.registry = registry
|
||||
|
||||
def run(self, src=""):
|
||||
"""
|
||||
1. look for .sls files
|
||||
2. lex them with Jinja and see if the first token is a comment
|
||||
3. in that case, save it to the registry
|
||||
4. pass the registry to the renderer
|
||||
"""
|
||||
states = {}
|
||||
|
||||
for file in self.glob(src):
|
||||
with open(file, "r") as f:
|
||||
text = "".join(f.readlines())
|
||||
try:
|
||||
comment = self.find_comment(text)
|
||||
except TemplateSyntaxError as e:
|
||||
raise RuntimeError(
|
||||
"There was an error parsing the Jinja syntax in file '{}':\n\n{}".format(
|
||||
file, str(e)
|
||||
)
|
||||
)
|
||||
|
||||
if comment and not comment.startswith(self.SKIP_FILE):
|
||||
path = self.path2saltpath(file)
|
||||
self.registry.register(State(path, comment))
|
||||
|
||||
self.renderer.render(self.registry)
|
||||
|
||||
def path2saltpath(self, path):
|
||||
"""
|
||||
Returns a Path object relative to the base directory.
|
||||
"""
|
||||
return path.relative_to(self.base)
|
||||
|
||||
def glob(self, src):
|
||||
"""
|
||||
Returns Path objects pointing to Salt states provided by this formula.
|
||||
"""
|
||||
for path in (self.base / Path(src)).rglob("*.sls"):
|
||||
yield path
|
||||
|
||||
def find_comment(self, text):
|
||||
"""
|
||||
Lexes files with Jinja. If the first token is a comment, return it.
|
||||
"""
|
||||
lexed = list(self.env.lex(text))
|
||||
try:
|
||||
i, t, content = lexed[1]
|
||||
except IndexError:
|
||||
i = t = content = ""
|
||||
|
||||
if "comment" == t:
|
||||
return self.parse(content)
|
||||
|
||||
return ""
|
||||
|
||||
def parse(self, comment):
|
||||
"""
|
||||
Strips indentation from [multiline] strings. Could have used
|
||||
docutils.prepare_docstring.
|
||||
"""
|
||||
# return d.prepare_docstring(comment)
|
||||
ws = min([len(x) - len(x.lstrip()) for x in comment.splitlines() if len(x) > 0])
|
||||
return "\n".join([x[ws:] for x in comment.splitlines()]).strip("\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
options = {
|
||||
"init": True,
|
||||
"init_suffix": False,
|
||||
"clean": False,
|
||||
"cut_prefix": False,
|
||||
"index_maxdepth": 4,
|
||||
}
|
||||
|
||||
# by default,
|
||||
# - render all documented states to a single file
|
||||
# - skip clean.sls descriptions
|
||||
# - do not include .init suffix on state ID
|
||||
r = SingleRenderer(target="docs/states.rst", opts=options)
|
||||
a = SaltAutodoc(base=base_dir / "gitea", renderer=r)
|
||||
a.run()
|
||||
8
commitlint.config.js
Normal file
8
commitlint.config.js
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
extends: ['@commitlint/config-conventional'],
|
||||
rules: {
|
||||
'body-max-line-length': [2, 'always', 120],
|
||||
'footer-max-line-length': [2, 'always', 120],
|
||||
'header-max-length': [2, 'always', 72],
|
||||
},
|
||||
};
|
||||
20
docs/Makefile
Normal file
20
docs/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line, and also
|
||||
# from the environment for the first two.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
SOURCEDIR = .
|
||||
BUILDDIR = _build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
188
docs/README.rst
Normal file
188
docs/README.rst
Normal file
@@ -0,0 +1,188 @@
|
||||
.. _readme:
|
||||
|
||||
Gitea Formula
|
||||
=============
|
||||
|
||||
|img_sr| |img_pc|
|
||||
|
||||
.. |img_sr| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
||||
:alt: Semantic Release
|
||||
:scale: 100%
|
||||
:target: https://github.com/semantic-release/semantic-release
|
||||
.. |img_pc| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
|
||||
:alt: pre-commit
|
||||
:scale: 100%
|
||||
:target: https://github.com/pre-commit/pre-commit
|
||||
|
||||
Manage Gitea with Salt.
|
||||
|
||||
.. contents:: **Table of Contents**
|
||||
:depth: 1
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
See the full `SaltStack Formulas installation and usage instructions
|
||||
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_.
|
||||
|
||||
If you are interested in writing or contributing to formulas, please pay attention to the `Writing Formula Section
|
||||
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#writing-formulas>`_.
|
||||
|
||||
If you want to use this formula, please pay attention to the ``FORMULA`` file and/or ``git tag``,
|
||||
which contains the currently released version. This formula is versioned according to `Semantic Versioning <http://semver.org/>`_.
|
||||
|
||||
See `Formula Versioning Section <https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#versioning>`_ for more details.
|
||||
|
||||
If you need (non-default) configuration, please refer to:
|
||||
|
||||
- `how to configure the formula with map.jinja <map.jinja.rst>`_
|
||||
- the ``pillar.example`` file
|
||||
- the `Special notes`_ section
|
||||
|
||||
Special notes
|
||||
-------------
|
||||
* This installs from the `official binary source <https://dl.gitea.io/gitea/>`_.
|
||||
* The formula is currently Linux/systemd-centric. It should be relatively easy to provide the correct parameters and service file for other platforms though.
|
||||
* Since the formula skips the web installer, you will need to provide at least the database configuration.
|
||||
* You can optionally specify the secrets, but they can be autogenerated by Salt as well. In that case, they will be saved in a grain value.
|
||||
* Secrets and database config will be written to the global config file, the rest into ``custom/conf/app.ini``.
|
||||
* All the paths are modifiable, find them in ``lookup:paths``. You should not need to set the corresponding values in your config, they are added automatically.
|
||||
* If Gitea requires mounts for some of the paths, you can specify them in ``service:requires_mount`` as a list.
|
||||
* If Gitea requires a local service unit (e.g. database server), specify it/them in ``service:wants`` as a list.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
An example pillar is provided, please see `pillar.example`. Note that you do not need to specify everything by pillar. Often, it's much easier and less resource-heavy to use the ``parameters/<grain>/<value>.yaml`` files for non-sensitive settings. The underlying logic is explained in `map.jinja`.
|
||||
|
||||
Available states
|
||||
----------------
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
``gitea``
|
||||
^^^^^^^^^
|
||||
|
||||
*Meta-state (This is a state that includes other states)*.
|
||||
|
||||
This installs the gitea package,
|
||||
manages the gitea configuration file and then
|
||||
starts the associated gitea service.
|
||||
|
||||
``gitea.package``
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will install the gitea package only.
|
||||
|
||||
``gitea.config``
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will configure the gitea service and has a dependency on ``gitea.install``
|
||||
via include list.
|
||||
|
||||
``gitea.service``
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will start the gitea service and has a dependency on ``gitea.config``
|
||||
via include list.
|
||||
|
||||
``gitea.clean``
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
*Meta-state (This is a state that includes other states)*.
|
||||
|
||||
This state will undo everything performed in the ``gitea`` meta-state in reverse order, i.e.
|
||||
stops the service,
|
||||
removes the configuration file and
|
||||
then uninstalls the package. Some paths are left to avoid accidental data loss (namely ``GITEA_WORKDIR``, ``APP_DATA_PATH`` and the gitea user home).
|
||||
|
||||
``gitea.service.clean``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will stop the gitea service and disable it at boot time.
|
||||
|
||||
``gitea.config.clean``
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will remove the configuration of the gitea service and has a
|
||||
dependency on ``gitea.service.clean`` via include list.
|
||||
|
||||
``gitea.package.clean``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will remove the gitea package and has a depency on
|
||||
``gitea.config.clean`` via include list.
|
||||
|
||||
Contributing to this repo
|
||||
-------------------------
|
||||
|
||||
Commit messages
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
**Commit message formatting is significant!**
|
||||
|
||||
Please see `How to contribute <https://github.com/saltstack-formulas/.github/blob/master/CONTRIBUTING.rst>`_ for more details.
|
||||
|
||||
pre-commit
|
||||
^^^^^^^^^^
|
||||
|
||||
`pre-commit <https://pre-commit.com/>`_ is configured for this formula, which you may optionally use to ease the steps involved in submitting your changes.
|
||||
First install the ``pre-commit`` package manager using the appropriate `method <https://pre-commit.com/#installation>`_, then run ``bin/install-hooks`` and
|
||||
now ``pre-commit`` will run automatically on each ``git commit``. ::
|
||||
|
||||
$ bin/install-hooks
|
||||
pre-commit installed at .git/hooks/pre-commit
|
||||
pre-commit installed at .git/hooks/commit-msg
|
||||
|
||||
State documentation
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
There is a script that semi-autodocuments available states: ``bin/slsdoc``.
|
||||
|
||||
If a ``.sls`` file begins with a Jinja comment, it will dump that into the docs. It can be configured differently depending on the formula. See the script source code for details currently.
|
||||
|
||||
This means if you feel a state should be documented, make sure to write a comment explaining it.
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
Linux testing is done with ``kitchen-salt``.
|
||||
|
||||
Requirements
|
||||
^^^^^^^^^^^^
|
||||
|
||||
* Ruby
|
||||
* Docker
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ gem install bundler
|
||||
$ bundle install
|
||||
$ bin/kitchen test [platform]
|
||||
|
||||
Where ``[platform]`` is the platform name defined in ``kitchen.yml``,
|
||||
e.g. ``debian-9-2019-2-py3``.
|
||||
|
||||
``bin/kitchen converge``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Creates the docker instance and runs the ``gitea`` main state, ready for testing.
|
||||
|
||||
``bin/kitchen verify``
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Runs the ``inspec`` tests on the actual instance.
|
||||
|
||||
``bin/kitchen destroy``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Removes the docker instance.
|
||||
|
||||
``bin/kitchen test``
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``.
|
||||
|
||||
``bin/kitchen login``
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Gives you SSH access to the instance for manual testing.
|
||||
518
docs/TOFS_pattern.rst
Normal file
518
docs/TOFS_pattern.rst
Normal file
@@ -0,0 +1,518 @@
|
||||
.. _tofs_pattern:
|
||||
|
||||
TOFS: A pattern for using SaltStack
|
||||
===================================
|
||||
|
||||
.. list-table::
|
||||
:name: tofs-authors
|
||||
:header-rows: 1
|
||||
:stub-columns: 1
|
||||
:widths: 2,2,3,2
|
||||
|
||||
* -
|
||||
- Person
|
||||
- Contact
|
||||
- Date
|
||||
* - Authored by
|
||||
- Roberto Moreda
|
||||
- moreda@allenta.com
|
||||
- 29/12/2014
|
||||
* - Modified by
|
||||
- Daniel Dehennin
|
||||
- daniel.dehennin@baby-gnu.org
|
||||
- 07/02/2019
|
||||
* - Modified by
|
||||
- Imran Iqbal
|
||||
- https://github.com/myii
|
||||
- 23/02/2019
|
||||
|
||||
All that follows is a proposal based on my experience with `SaltStack <http://www.saltstack.com/>`_. The good thing of a piece of software like this is that you can "bend it" to suit your needs in many possible ways, and this is one of them. All the recommendations and thoughts are given "as it is" with no warranty of any type.
|
||||
|
||||
.. contents:: **Table of Contents**
|
||||
|
||||
Usage of values in pillar vs templates in ``file_roots``
|
||||
--------------------------------------------------------
|
||||
|
||||
Among other functions, the *master* (or *salt-master*) serves files to the *minions* (or *salt-minions*). The `file_roots <http://docs.saltstack.com/en/latest/ref/file_server/file_roots.html>`_ is the list of directories used in sequence to find a file when a minion requires it: the first match is served to the minion. Those files could be `state files <http://docs.saltstack.com/en/latest/topics/tutorials/starting_states.html>`_ or configuration templates, among others.
|
||||
|
||||
Using SaltStack is a simple and effective way to implement configuration management, but even in a `non-multitenant <http://en.wikipedia.org/wiki/Multitenancy>`_ scenario, it is not a good idea to generally access some data (e.g. the database password in our `Zabbix <http://www.zabbix.com/>`_ server configuration file or the private key of our `Nginx <http://nginx.org/en/>`_ TLS certificate).
|
||||
|
||||
To avoid this situation we can use the `pillar mechanism <http://docs.saltstack.com/en/latest/topics/pillar/>`_, which is designed to provide controlled access to data from the minions based on some selection rules. As pillar data could be easily integrated in the `Jinja <http://docs.saltstack.com/en/latest/topics/tutorials/pillar.html>`_ templates, it is a good mechanism to store values to be used in the final rendering of state files and templates.
|
||||
|
||||
There are a variety of approaches on the usage of pillar and templates as seen in the `saltstack-formulas <https://github.com/saltstack-formulas>`_' repositories. `Some <https://github.com/saltstack-formulas/nginx-formula/pull/18>`_ `developments <https://github.com/saltstack-formulas/php-formula/pull/14>`_ stress the initial purpose of pillar data into a storage for most of the possible variables for a determined system configuration. This, in my opinion, is shifting too much load from the original template files approach. Adding up some `non-trivial Jinja <https://github.com/saltstack-formulas/nginx-formula/blob/f74254c07e188bd448eaf1c5f9c802d78c4c005e/nginx/files/default/nginx.conf>`_ code as essential part of composing the state file definitely makes SaltStack state files (hence formulas) more difficult to read. The extreme of this approach is that we could end up with a new render mechanism, implemented in Jinja, storing everything needed in pillar data to compose configurations. Additionally, we are establishing a strong dependency with the Jinja renderer.
|
||||
|
||||
In opposition to the *put the code in file_roots and the data in pillars* approach, there is the *pillar as a store for a set of key-values* approach. A full-blown configuration file abstracted in pillar and jinja is complicated to develop, understand and maintain. I think a better and simpler approach is to keep a configuration file templated using just a basic (non-extensive but extensible) set of pillar values.
|
||||
|
||||
On the reusability of SaltStack state files
|
||||
-------------------------------------------
|
||||
|
||||
There is a brilliant initiative of the SaltStack community called `salt-formulas <https://github.com/saltstack-formulas>`_. Their goal is to provide state files, pillar examples and configuration templates ready to be used for provisioning. I am a contributor for two small ones: `zabbix-formula <https://github.com/saltstack-formulas/zabbix-formula>`_ and `varnish-formula <https://github.com/saltstack-formulas/varnish-formula>`_.
|
||||
|
||||
The `design guidelines <http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_ for formulas are clear in many aspects and it is a recommended reading for anyone willing to write state files, even non-formulaic ones.
|
||||
|
||||
In the next section, I am going to describe my proposal to extend further the reusability of formulas, suggesting some patterns of usage.
|
||||
|
||||
The Template Override and Files Switch (TOFS) pattern
|
||||
-----------------------------------------------------
|
||||
|
||||
I understand a formula as a **complete, independent set of SaltStack state and configuration template files sufficient to configure a system**. A system could be something as simple as an NTP server or some other much more complex service that requires many state and configuration template files.
|
||||
|
||||
The customization of a formula should be done mainly by providing pillar data used later to render either the state or the configuration template files.
|
||||
|
||||
Example: NTP before applying TOFS
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Let's work with the NTP example. A basic formula that follows the `design guidelines <http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_ has the following files and directories tree:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
/srv/saltstack/salt-formulas/ntp-saltstack-formula/
|
||||
ntp/
|
||||
map.jinja
|
||||
init.sls
|
||||
conf.sls
|
||||
files/
|
||||
default/
|
||||
etc/
|
||||
ntp.conf.jinja
|
||||
|
||||
In order to use it, let's assume a `masterless configuration <http://docs.saltstack.com/en/latest/topics/tutorials/quickstart.html>`_ and this relevant section of ``/etc/salt/minion``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
pillar_roots:
|
||||
base:
|
||||
- /srv/saltstack/pillar
|
||||
file_client: local
|
||||
file_roots:
|
||||
base:
|
||||
- /srv/saltstack/salt
|
||||
- /srv/saltstack/salt-formulas/ntp-saltstack-formula
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{#- /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/map.jinja #}
|
||||
{%- set ntp = salt['grains.filter_by']({
|
||||
'default': {
|
||||
'pkg': 'ntp',
|
||||
'service': 'ntp',
|
||||
'config': '/etc/ntp.conf',
|
||||
},
|
||||
}, merge=salt['pillar.get']('ntp:lookup')) %}
|
||||
|
||||
In ``init.sls`` we have the minimal states required to have NTP configured. In many cases ``init.sls`` is almost equivalent to an ``apt-get install`` or a ``yum install`` of the package.
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/init.sls
|
||||
{%- from 'ntp/map.jinja' import ntp with context %}
|
||||
|
||||
Install NTP:
|
||||
pkg.installed:
|
||||
- name: {{ ntp.pkg }}
|
||||
|
||||
Enable and start NTP:
|
||||
service.running:
|
||||
- name: {{ ntp.service }}
|
||||
- enabled: True
|
||||
- require:
|
||||
- pkg: Install NTP package
|
||||
|
||||
In ``conf.sls`` we have the configuration states. In most cases, that is just managing configuration file templates and making them to be watched by the service.
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/conf.sls
|
||||
include:
|
||||
- ntp
|
||||
|
||||
{%- from 'ntp/map.jinja' import ntp with context %}
|
||||
|
||||
Configure NTP:
|
||||
file.managed:
|
||||
- name: {{ ntp.config }}
|
||||
- template: jinja
|
||||
- source: salt://ntp/files/default/etc/ntp.conf.jinja
|
||||
- watch_in:
|
||||
- service: Enable and start NTP service
|
||||
- require:
|
||||
- pkg: Install NTP package
|
||||
|
||||
Under ``files/default``, there is a structure that mimics the one in the minion in order to avoid clashes and confusion on where to put the needed templates. There you can find a mostly standard template for the configuration file.
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{#- /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/files/default/etc/ntp.conf.jinja #}
|
||||
{#- Managed by saltstack #}
|
||||
{#- Edit pillars or override this template in saltstack if you need customization #}
|
||||
{%- set settings = salt['pillar.get']('ntp', {}) %}
|
||||
{%- set default_servers = ['0.ubuntu.pool.ntp.org',
|
||||
'1.ubuntu.pool.ntp.org',
|
||||
'2.ubuntu.pool.ntp.org',
|
||||
'3.ubuntu.pool.ntp.org'] %}
|
||||
|
||||
driftfile /var/lib/ntp/ntp.drift
|
||||
statistics loopstats peerstats clockstats
|
||||
filegen loopstats file loopstats type day enable
|
||||
filegen peerstats file peerstats type day enable
|
||||
filegen clockstats file clockstats type day enable
|
||||
|
||||
{%- for server in settings.get('servers', default_servers) %}
|
||||
server {{ server }}
|
||||
{%- endfor %}
|
||||
|
||||
restrict -4 default kod notrap nomodify nopeer noquery
|
||||
restrict -6 default kod notrap nomodify nopeer noquery
|
||||
|
||||
restrict 127.0.0.1
|
||||
restrict ::1
|
||||
|
||||
With all this, it is easy to install and configure a simple NTP server by just running ``salt-call state.sls ntp.conf``: the package will be installed, the service will be running and the configuration should be correct for most of cases, even without pillar data.
|
||||
|
||||
Alternatively, you can define a highstate in ``/srv/saltstack/salt/top.sls`` and run ``salt-call state.highstate``.
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
## /srv/saltstack/salt/top.sls
|
||||
base:
|
||||
'*':
|
||||
- ntp.conf
|
||||
|
||||
**Customizing the formula just with pillar data**, we have the option to define the NTP servers.
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
## /srv/saltstack/pillar/top.sls
|
||||
base:
|
||||
'*':
|
||||
- ntp
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
## /srv/saltstack/pillar/ntp.sls
|
||||
ntp:
|
||||
servers:
|
||||
- 0.ch.pool.ntp.org
|
||||
- 1.ch.pool.ntp.org
|
||||
- 2.ch.pool.ntp.org
|
||||
- 3.ch.pool.ntp.org
|
||||
|
||||
Template Override
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
If the customization based on pillar data is not enough, we can override the template by creating a new one in ``/srv/saltstack/salt/ntp/files/default/etc/ntp.conf.jinja``
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{#- /srv/saltstack/salt/ntp/files/default/etc/ntp.conf.jinja #}
|
||||
{#- Managed by saltstack #}
|
||||
{#- Edit pillars or override this template in saltstack if you need customization #}
|
||||
|
||||
{#- Some bizarre configurations here #}
|
||||
{#- ... #}
|
||||
|
||||
{%- for server in settings.get('servers', default_servers) %}
|
||||
server {{ server }}
|
||||
{%- endfor %}
|
||||
|
||||
This way we are locally **overriding the template files** offered by the formula in order to make a more complex adaptation. Of course, this could be applied as well to any of the files, including the state files.
|
||||
|
||||
Files Switch
|
||||
^^^^^^^^^^^^
|
||||
|
||||
To bring some order into the set of template files included in a formula, as we commented, we suggest having a similar structure to a normal final file system under ``files/default``.
|
||||
|
||||
We can make different templates coexist for different minions, classified by any `grain <http://docs.saltstack.com/en/latest/topics/targeting/grains.html>`_ value, by simply creating new directories under ``files``. This mechanism is based on **using values of some grains as a switch for the directories under** ``files/``.
|
||||
|
||||
If we decide that we want ``os_family`` as switch, then we could provide the formula template variants for both the ``RedHat`` and ``Debian`` families.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
/srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/files/
|
||||
default/
|
||||
etc/
|
||||
ntp.conf.jinja
|
||||
RedHat/
|
||||
etc/
|
||||
ntp.conf.jinja
|
||||
Debian/
|
||||
etc/
|
||||
ntp.conf.jinja
|
||||
|
||||
To make this work we need a ``conf.sls`` state file that takes a list of possible files as the configuration template.
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/conf.sls
|
||||
include:
|
||||
- ntp
|
||||
|
||||
{%- from 'ntp/map.jinja' import ntp with context %}
|
||||
|
||||
Configure NTP:
|
||||
file.managed:
|
||||
- name: {{ ntp.config }}
|
||||
- template: jinja
|
||||
- source:
|
||||
- salt://ntp/files/{{ grains.get('os_family', 'default') }}/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/default/etc/ntp.conf.jinja
|
||||
- watch_in:
|
||||
- service: Enable and start NTP service
|
||||
- require:
|
||||
- pkg: Install NTP package
|
||||
|
||||
If we want to cover the possibility of a special template for a minion identified by ``node01`` then we could have a specific template in ``/srv/saltstack/salt/ntp/files/node01/etc/ntp.conf.jinja``.
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{#- /srv/saltstack/salt/ntp/files/node01/etc/ntp.conf.jinja #}
|
||||
{#- Managed by saltstack #}
|
||||
{#- Edit pillars or override this template in saltstack if you need customization #}
|
||||
|
||||
{#- Some crazy configurations here for node01 #}
|
||||
{#- ... #}
|
||||
|
||||
To make this work we could write a specially crafted ``conf.sls``.
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/conf.sls
|
||||
include:
|
||||
- ntp
|
||||
|
||||
{%- from 'ntp/map.jinja' import ntp with context %}
|
||||
|
||||
Configure NTP:
|
||||
file.managed:
|
||||
- name: {{ ntp.config }}
|
||||
- template: jinja
|
||||
- source:
|
||||
- salt://ntp/files/{{ grains.get('id') }}/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/{{ grains.get('os_family') }}/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/default/etc/ntp.conf.jinja
|
||||
- watch_in:
|
||||
- service: Enable and start NTP service
|
||||
- require:
|
||||
- pkg: Install NTP package
|
||||
|
||||
Using the ``files_switch`` macro
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
We can simplify the ``conf.sls`` with the new ``files_switch`` macro to use in the ``source`` parameter for the ``file.managed`` state.
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/conf.sls
|
||||
include:
|
||||
- ntp
|
||||
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- from 'ntp/map.jinja' import ntp with context %}
|
||||
{%- from 'ntp/libtofs.jinja' import files_switch %}
|
||||
|
||||
Configure NTP:
|
||||
file.managed:
|
||||
- name: {{ ntp.config }}
|
||||
- template: jinja
|
||||
- source: {{ files_switch(['/etc/ntp.conf.jinja'],
|
||||
lookup='Configure NTP'
|
||||
)
|
||||
}}
|
||||
- watch_in:
|
||||
- service: Enable and start NTP service
|
||||
- require:
|
||||
- pkg: Install NTP package
|
||||
|
||||
|
||||
* This uses ``config.get``, searching for ``ntp:tofs:source_files:Configure NTP`` to determine the list of template files to use.
|
||||
* If this returns a result, the default of ``['/etc/ntp.conf.jinja']`` will be appended to it.
|
||||
* If this does not yield any results, the default of ``['/etc/ntp.conf.jinja']`` will be used.
|
||||
|
||||
In ``libtofs.jinja``, we define this new macro ``files_switch``.
|
||||
|
||||
.. literalinclude:: ../template/libtofs.jinja
|
||||
:caption: /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/libtofs.jinja
|
||||
:language: jinja
|
||||
|
||||
How to customise the ``source`` further
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The examples below are based on an ``Ubuntu`` minion called ``theminion`` being configured via. pillar.
|
||||
|
||||
Using the default settings of the ``files_switch`` macro above,
|
||||
the ``source`` will be:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
- source:
|
||||
- salt://ntp/files/theminion/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/Debian/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/default/etc/ntp.conf.jinja
|
||||
|
||||
Customise ``files``
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``files`` portion can be customised:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
ntp:
|
||||
tofs:
|
||||
dirs:
|
||||
files: files_alt
|
||||
|
||||
Resulting in:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
- source:
|
||||
- salt://ntp/files_alt/theminion/etc/ntp.conf.jinja
|
||||
- salt://ntp/files_alt/Debian/etc/ntp.conf.jinja
|
||||
- salt://ntp/files_alt/default/etc/ntp.conf.jinja
|
||||
|
||||
Customise the use of grains
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Grains can be customised and even arbitrary paths can be supplied:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
ntp:
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- os
|
||||
- os_family
|
||||
|
||||
Resulting in:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
- source:
|
||||
- salt://ntp/files/any/path/can/be/used/here/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/theminion/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/Ubuntu/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/Debian/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/default/etc/ntp.conf.jinja
|
||||
|
||||
Customise the ``default`` path
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``default`` portion of the path can be customised:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
ntp:
|
||||
tofs:
|
||||
dirs:
|
||||
default: default_alt
|
||||
|
||||
Resulting in:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
- source:
|
||||
...
|
||||
- salt://ntp/files/default_alt/etc/ntp.conf.jinja
|
||||
|
||||
Customise the list of ``source_files``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The list of ``source_files`` can be given:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
ntp:
|
||||
tofs:
|
||||
source_files:
|
||||
Configure NTP:
|
||||
- '/etc/ntp.conf_alt.jinja'
|
||||
|
||||
Resulting in:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
- source:
|
||||
- salt://ntp/files/theminion/etc/ntp.conf_alt.jinja
|
||||
- salt://ntp/files/theminion/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/Debian/etc/ntp.conf_alt.jinja
|
||||
- salt://ntp/files/Debian/etc/ntp.conf.jinja
|
||||
- salt://ntp/files/default/etc/ntp.conf_alt.jinja
|
||||
- salt://ntp/files/default/etc/ntp.conf.jinja
|
||||
|
||||
Note: This does *not* override the default value.
|
||||
Rather, the value from the pillar/config is prepended to the default.
|
||||
|
||||
Using sub-directories for ``components``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
If your formula is composed of several components, you may prefer to provides files under sub-directories, like in the `systemd-formula <https://github.com/saltstack-formulas/systemd-formula>`_.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
/srv/saltstack/systemd-formula/
|
||||
systemd/
|
||||
init.sls
|
||||
libtofs.jinja
|
||||
map.jinja
|
||||
networkd/
|
||||
init.sls
|
||||
files/
|
||||
default/
|
||||
network/
|
||||
99-default.link
|
||||
resolved/
|
||||
init.sls
|
||||
files/
|
||||
default/
|
||||
resolved.conf
|
||||
timesyncd/
|
||||
init.sls
|
||||
files/
|
||||
Arch/
|
||||
resolved.conf
|
||||
Debian/
|
||||
resolved.conf
|
||||
default/
|
||||
resolved.conf
|
||||
Ubuntu/
|
||||
resolved.conf
|
||||
|
||||
For example, the following ``formula.component.config`` SLS:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
{%- from "formula/libtofs.jinja" import files_switch with context %}
|
||||
|
||||
formula configuration file:
|
||||
file.managed:
|
||||
- name: /etc/formula.conf
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 644
|
||||
- template: jinja
|
||||
- source: {{ files_switch(['formula.conf'],
|
||||
lookup='formula',
|
||||
use_subpath=True
|
||||
)
|
||||
}}
|
||||
|
||||
will be rendered on a ``Debian`` minion named ``salt-formula.ci.local`` as:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
formula configuration file:
|
||||
file.managed:
|
||||
- name: /etc/formula.conf
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 644
|
||||
- template: jinja
|
||||
- source:
|
||||
- salt://formula/component/files/salt-formula.ci.local/formula.conf
|
||||
- salt://formula/component/files/Debian/formula.conf
|
||||
- salt://formula/component/files/default/formula.conf
|
||||
- salt://formula/files/salt-formula.ci.local/formula.conf
|
||||
- salt://formula/files/Debian/formula.conf
|
||||
- salt://formula/files/default/formula.conf
|
||||
78
docs/conf.py
Normal file
78
docs/conf.py
Normal file
@@ -0,0 +1,78 @@
|
||||
# Configuration file for the Sphinx documentation builder.
|
||||
#
|
||||
# This file only contains a selection of the most common options. For a full
|
||||
# list see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
import os
|
||||
import sys
|
||||
# import sphinx_rtd_theme
|
||||
# import sphinx-material-saltstack # official Salt Sphinx theme
|
||||
|
||||
# -- Path setup --------------------------------------------------------------
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
# import os
|
||||
# import sys
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'gitea-formula'
|
||||
copyright = '2022, lkubb'
|
||||
author = 'lkubb'
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = '1.0.0'
|
||||
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autosummary',
|
||||
'sphinx.ext.viewcode',
|
||||
# 'sphinxcontrib.fulltoc',
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This pattern also affects html_static_path and html_extra_path.
|
||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
# html_theme = 'sphinx_rtd_theme'
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
html_theme_options = {
|
||||
# 'logo_only': False,
|
||||
# 'display_version': True,
|
||||
# 'prev_next_buttons_location': 'bottom',
|
||||
# 'style_external_links': False,
|
||||
# 'vcs_pageview_mode': '',
|
||||
# 'style_nav_header_background': 'white',
|
||||
# Toc options
|
||||
# 'collapse_navigation': False, # needs sphinxcontrib.fulltoc
|
||||
# 'sticky_navigation': True,
|
||||
# 'navigation_depth': 4,
|
||||
# 'includehidden': True,
|
||||
# 'titles_only': False
|
||||
}
|
||||
20
docs/index.rst
Normal file
20
docs/index.rst
Normal file
@@ -0,0 +1,20 @@
|
||||
Welcome to gitea-formula's documentation!
|
||||
=========================================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
||||
README
|
||||
states
|
||||
pillar
|
||||
map.jinja
|
||||
TOFS_pattern
|
||||
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`search`
|
||||
35
docs/make.bat
Normal file
35
docs/make.bat
Normal file
@@ -0,0 +1,35 @@
|
||||
@ECHO OFF
|
||||
|
||||
pushd %~dp0
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set SOURCEDIR=.
|
||||
set BUILDDIR=_build
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.https://www.sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
|
||||
:end
|
||||
popd
|
||||
542
docs/map.jinja.rst
Normal file
542
docs/map.jinja.rst
Normal file
@@ -0,0 +1,542 @@
|
||||
.. _map.jinja:
|
||||
|
||||
``map.jinja``: gather formula configuration values
|
||||
==================================================
|
||||
|
||||
The `documentation`_ explains the use of a ``map.jinja`` to gather parameters values for a formula.
|
||||
|
||||
As `pillars`_ are rendered on the Salt master for every minion, this increases the load on the master as the pillar values and the number of minions grows.
|
||||
|
||||
As a good practice, you should:
|
||||
|
||||
- store non-secret data in YAML files distributed by the `fileserver`_
|
||||
- store secret data in:
|
||||
|
||||
- `pillars`_ (and look for the use of something like `pillar.vault`_)
|
||||
- `SDB`_ (and look for the use of something like `sdb.vault`_)
|
||||
|
||||
Current best practice is to let ``map.jinja`` handle parameters from all sources, to minimise the use of pillars, grains or configuration from ``sls`` files and templates directly.
|
||||
|
||||
|
||||
.. contents:: **Table of Contents**
|
||||
|
||||
|
||||
For formula users
|
||||
-----------------
|
||||
|
||||
|
||||
Quick start: configure per role and per DNS domain name values
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
We will see a quick setup to configure the ``gitea`` formula for different DNS domain names and several roles.
|
||||
|
||||
For this example, I'll define 2 kinds of `fileserver`_ sources:
|
||||
|
||||
1. formulas git repositories with hard-coded version reference to avoid breaking my setup randomly at upstream update. they are the last sources where files are looked up
|
||||
2. parameters of the formulas in the file backend `roots`_
|
||||
|
||||
|
||||
Configure the fileserver backends
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
I configure the `fileserver`_ backends to serve:
|
||||
|
||||
1. files from `roots`_ first
|
||||
2. `gitfs`_ repositories last
|
||||
|
||||
Create the file ``/etc/salt/master.d/fileserver.conf`` and restart the ``master``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
##
|
||||
## file server
|
||||
##
|
||||
fileserver_backend:
|
||||
# parameters values and override
|
||||
- roots
|
||||
# formulas
|
||||
- gitfs
|
||||
|
||||
# The files in this directory will take precedence over git repositories
|
||||
file_roots:
|
||||
base:
|
||||
- /srv/salt
|
||||
|
||||
# List of formulas I'm using
|
||||
gitfs_remotes:
|
||||
- https://github.com/saltstack-formulas/template-formula.git:
|
||||
- base: v4.1.1
|
||||
- https://github.com/saltstack-formulas/openssh-formula.git:
|
||||
- base: v2.0.1
|
||||
...
|
||||
|
||||
|
||||
Create per DNS configuration for ``gitea`` formula
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Now, we can provides the per DNS domain name configuration files for the ``gitea`` formulas under ``/srv/salt/gitea/parameters/``.
|
||||
|
||||
We create the directory for ``dns:domain`` grain and we add a symlink for the ``domain`` grain which is extracted from the minion ``id``:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
mkdir -p /srv/salt/gitea/parameters/dns:domain/
|
||||
ln -s dns:domain /srv/salt/gitea/parameters/domain
|
||||
|
||||
We create a configuration for the DNS domain ``example.net`` in ``/srv/salt/gitea/parameters/dns:domain/example.net.yaml``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
values:
|
||||
config: /etc/template-formula-example-net.conf
|
||||
...
|
||||
|
||||
We create another configuration for the DNS domain ``example.com`` in the Jinja YAML template ``/srv/salt/gitea/parameters/dns:domain/example.com.yaml.jinja``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
values:
|
||||
config: /etc/template-formula-{{ grains['os_family'] }}.conf
|
||||
...
|
||||
|
||||
|
||||
Create per role configuration for ``gitea`` formula
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Now, we can provides the per role configuration files for the ``gitea`` formulas under ``/srv/salt/gitea/parameters/``.
|
||||
|
||||
We create the directory for roles:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
mkdir -p /srv/salt/gitea/parameters/roles
|
||||
|
||||
We will define 2 roles:
|
||||
|
||||
- ``gitea/server``
|
||||
- ``gitea/client``
|
||||
|
||||
We create a configuration for the role ``gitea/server`` in ``/srv/salt/gitea/parameters/roles/gitea/server.yaml``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
values:
|
||||
config: /etc/template-formula-server.conf
|
||||
...
|
||||
|
||||
We create another configuration for the role ``gitea/client`` in ``/srv/salt/gitea/parameters/roles/gitea/client.yaml``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
values:
|
||||
config: /etc/template-formula-client.conf
|
||||
...
|
||||
|
||||
|
||||
Enable roles and the ``dns:domain`` and ``domain`` grains for ``map.jinja``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
We need to redefine the sources for ``map.jinja`` to load values from our new configuration files, we provide a global configuration for all our minions.
|
||||
|
||||
We create the global parameters file ``/srv/salt/parameters/map_jinja.yaml``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
values:
|
||||
sources:
|
||||
# default values
|
||||
- "Y:G@osarch"
|
||||
- "Y:G@os_family"
|
||||
- "Y:G@os"
|
||||
- "Y:G@osfinger"
|
||||
- "C@{{ tplroot ~ ':lookup' }}"
|
||||
- "C@{{ tplroot }}"
|
||||
|
||||
# Roles activate/deactivate things
|
||||
# then thing are configured depending on environment
|
||||
# So roles comes before `dns:domain`, `domain` and `id`
|
||||
- "Y:C@roles"
|
||||
|
||||
# DNS domain configured (DHCP or resolv.conf)
|
||||
- "Y:G@dns:domain"
|
||||
|
||||
# Based on minion ID
|
||||
- "Y:G@domain"
|
||||
|
||||
# default values
|
||||
- "Y:G@id"
|
||||
...
|
||||
|
||||
The syntax is explained later at `Sources of configuration values`_.
|
||||
|
||||
|
||||
Bind roles to minions
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
We associate roles `grains`_ to minion using `grains.append`_.
|
||||
|
||||
For the servers:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
salt 'server-*' grains.append roles gitea/server
|
||||
|
||||
For the clients:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
salt 'client-*' grains.append roles gitea/client
|
||||
|
||||
.. note::
|
||||
|
||||
Since we used ``Y:C@roles``, ``map.jinja`` will do a ``salt['config.get']('roles')`` to retrieve the roles so you could use any other method to bind roles to minions (`pillars`_ or `SDB`_) but `grains`_ seems to be the preferred method.
|
||||
|
||||
Note for Microsoft Windows systems
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you have a minion running under windows, you can't use colon ``:`` as a delimiter for grain path query (see `bug 58726`_) in which case you should use an alternate delimiter:
|
||||
|
||||
Modify ``/srv/salt/parameters/map_jinja.yaml`` to change the query for ``dns:domain`` to define the `alternate delimiter`_:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
values:
|
||||
sources:
|
||||
# default values
|
||||
- "Y:G@osarch"
|
||||
- "Y:G@os_family"
|
||||
- "Y:G@os"
|
||||
- "Y:G@osfinger"
|
||||
- "C@{{ tplroot ~ ':lookup' }}"
|
||||
- "C@{{ tplroot }}"
|
||||
|
||||
# Roles activate/deactivate things
|
||||
# then thing are configured depending on environment
|
||||
# So roles comes before `dns:domain`, `domain` and `id`
|
||||
- "Y:C@roles"
|
||||
|
||||
# DNS domain configured (DHCP or resolv.conf)
|
||||
- "Y:G:!@dns!domain"
|
||||
|
||||
# Based on minion ID
|
||||
- "Y:G@domain"
|
||||
|
||||
# default values
|
||||
- "Y:G@id"
|
||||
...
|
||||
|
||||
And then, rename the directory:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
mv /srv/salt/gitea/parameters/dns:domain/ '/srv/salt/gitea/parameters/dns!domain/'
|
||||
|
||||
|
||||
Format of configuration YAML files
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
When you write a new YAML file, note that it must conform to the following layout:
|
||||
|
||||
- a mandatory ``values`` key to store the configuration values
|
||||
- two optional keys to configure the use of `salt.slsutil.merge`_
|
||||
|
||||
- an optional ``strategy`` key to configure the merging strategy, for example ``strategy: 'recurse'``, the default is ``smart``
|
||||
- an optional ``merge_lists`` key to configure if lists should be merged or overridden for the ``recurse`` and ``overwrite`` strategy, for example ``merge_lists: 'true'``
|
||||
|
||||
Here is a valid example:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
strategy: 'recurse'
|
||||
merge_lists: 'false'
|
||||
values:
|
||||
pkg:
|
||||
name: 'some-package'
|
||||
config: '/path/to/a/configuration/file'
|
||||
...
|
||||
|
||||
|
||||
Using Jinja2 YAML template
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can provide a Jinja2 YAML template file with a name suffixed with ``.yaml.jinja``, it must produce a YAML file conform to the `Format of configuration YAML files`_, for example:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
---
|
||||
strategy: 'overwrite'
|
||||
merge_lists: 'true'
|
||||
values:
|
||||
{%- if grains["os"] == "Debian" %}
|
||||
output_dir: /tmp/{{ grains["id"] }}
|
||||
{%- endif %}
|
||||
...
|
||||
|
||||
|
||||
Sources of configuration values
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The ``map.jinja`` file aggregates configuration values from several sources:
|
||||
|
||||
- YAML files stored in the `fileserver`_
|
||||
- `pillars`_
|
||||
- `grains`_
|
||||
- configuration gathered with `salt['config.get']`_
|
||||
|
||||
For the values loaded from YAML files, ``map.jinja`` will automatically try to load a Jinja2 template with the same name as the YAML file with the addition of the ``.jinja`` extension, for example ``foo/bar/quux.yaml.jinja``.
|
||||
|
||||
After loading values from all sources, it will try to include the ``salt://{{ tplroot }}/post-map.jinja`` Jinja file if it exists which can post-process the ``mapdata`` variable.
|
||||
|
||||
Configuring ``map.jinja`` sources
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``map.jinja`` file uses several sources where to lookup parameter values. The list of sources can be configured in two places:
|
||||
|
||||
1. globally
|
||||
|
||||
1. with a plain YAML file ``salt://parameters/map_jinja.yaml``
|
||||
2. with a Jinja2 YAML template file ``salt://parameters/map_jinja.yaml.jinja``
|
||||
|
||||
2. per formula
|
||||
|
||||
1. with a plain YAML file ``salt://{{ tplroot }}/parameters/map_jinja.yaml``
|
||||
2. with a Jinja2 YAML template file ``salt://{{ tplroot }}/parameters/map_jinja.yaml.jinja``
|
||||
|
||||
.. note::
|
||||
|
||||
The ``map.jinja`` configuration files must conform to the `format of configuration YAML files`_.
|
||||
|
||||
Each source definition has the form ``[<TYPE>[:<OPTION>[:<DELIMITER>]]@]<KEY>`` where ``<TYPE>`` can be one of:
|
||||
|
||||
- ``Y`` to load values from YAML files from the `fileserver`_, this is the default when no type is defined
|
||||
- ``C`` to lookup values with `salt['config.get']`_
|
||||
- ``G`` to lookup values with `salt['grains.get']`_
|
||||
- ``I`` to lookup values with `salt['pillar.get']`_
|
||||
|
||||
The YAML type option can define the query method to lookup the key value to build the file name:
|
||||
|
||||
- ``C`` to query with `salt['config.get']`_, this is the default when no query method is defined
|
||||
- ``G`` to query with `salt['grains.get']`_
|
||||
- ``I`` to query with `salt['pillar.get']`_
|
||||
|
||||
The ``C``, ``G`` or ``I`` types can define the ``SUB`` option to store values in the sub key ``mapdata.<KEY>`` instead of directly in ``mapdata``.
|
||||
|
||||
All types can define the ``<DELIMITER>`` option to use an `alternate delimiter`_ of the ``<KEY>``, for example: on windows system you can't use colon ``:`` for YAML file path name and you should use something else like exclamation mark ``!``.
|
||||
|
||||
Finally, the ``<KEY>`` describes what to lookup to either build the YAML filename or gather values using one of the query methods.
|
||||
|
||||
.. note::
|
||||
|
||||
For the YAML type:
|
||||
|
||||
- if the ``<KEY>`` can't be looked up, then it's used a literal string path to a YAML file, for example: ``any/path/can/be/used/here.yaml`` will result in the loading of ``salt://{{ tplroot }}/parameters/any/path/can/be/used/here.yaml`` if it exists
|
||||
- ``map.jinja`` will automatically try to load a Jinja2 template, after the corresponding YAML file, with the same name as the YAML file extended with the ``.jinja`` extension, for example ``any/path/can/be/used/here.yaml.jinja``
|
||||
|
||||
The built-in ``map.jinja`` sources are:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
- "Y:G@osarch"
|
||||
- "Y:G@os_family"
|
||||
- "Y:G@os"
|
||||
- "Y:G@osfinger"
|
||||
- "C@{{ tplroot ~ ':lookup' }}"
|
||||
- "C@{{ tplroot }}"
|
||||
- "Y:G@id"
|
||||
|
||||
This is strictly equivalent to the following ``map_jinja.yaml.jinja``:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
values:
|
||||
sources:
|
||||
- "parameters/osarch/{{ salt['grains.get']('osarch') }}.yaml"
|
||||
- "parameters/osarch/{{ salt['grains.get']('osarch') }}.yaml.jinja"
|
||||
- "parameters/os_family/{{ salt['grains.get']('os_family') }}.yaml"
|
||||
- "parameters/os_family/{{ salt['grains.get']('os_family') }}.yaml.jinja"
|
||||
- "parameters/os/{{ salt['grains.get']('os') }}.yaml"
|
||||
- "parameters/os/{{ salt['grains.get']('os') }}.yaml.jinja"
|
||||
- "parameters/osfinger/{{ salt['grains.get']('osfinger') }}.yaml"
|
||||
- "parameters/osfinger/{{ salt['grains.get']('osfinger') }}.yaml.jinja"
|
||||
- "C@{{ tplroot ~ ':lookup' }}"
|
||||
- "C@{{ tplroot }}"
|
||||
- "parameters/id/{{ salt['grains.get']('id') }}.yaml"
|
||||
- "parameters/id/{{ salt['grains.get']('id') }}.yaml.jinja"
|
||||
|
||||
|
||||
Loading values from the configuration sources
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For each configuration source defined, ``map.jinja`` will:
|
||||
|
||||
#. load values depending on the source type:
|
||||
|
||||
- for YAML file sources
|
||||
|
||||
- if the ``<KEY>`` can be looked up:
|
||||
|
||||
- load values from the YAML file named ``salt://{{ tplroot }}/paramaters/<KEY>/{{ salt['<QUERY_METHOD>']('<KEY>') }}.yaml`` if it exists
|
||||
- load values from the Jinja2 YAML template file named ``salt://{{ tplroot }}/paramaters/<KEY>/{{ salt['<QUERY_METHOD>']('<KEY>') }}.yaml.jinja`` if it exists
|
||||
|
||||
- otherwise:
|
||||
|
||||
- load the YAML file named ``salt://{{ tplroot }}/parameters/<KEY>.yaml`` if it exists
|
||||
- load the Jinja2 YAML template file named ``salt://{{ tplroot }}/parameters/<KEY>.yaml.jinja`` if it exists
|
||||
|
||||
- for ``C``, ``G`` or ``I`` source type, lookup the value of ``salt['<QUERY_METHOD>']('<KEY>')``
|
||||
|
||||
#. merge the loaded values with the previous ones using `salt.slsutil.merge`_
|
||||
|
||||
There will be no error if a YAML or Jinja2 file does not exists, they are all optional.
|
||||
|
||||
|
||||
Configuration values from ``salt['config.get']``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For sources with of type ``C`` declared in ``map_jinja:sources``, you can configure the ``merge`` option of `salt['config.get']`_ by defining per formula ``strategy`` configuration key (retrieved with ``salt['config.get'](tplroot ~ ':strategy')`` with one of the following values:
|
||||
|
||||
- ``recurse`` merge recursively dictionaries. Non dictionary values replace already defined values
|
||||
- ``overwrite`` new value completely replace old ones
|
||||
|
||||
By default, no merging is done, the first value found is returned.
|
||||
|
||||
|
||||
Global view of the order of preferences
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To summarise, here is a complete example of the load order of formula configuration values for an ``AMD64`` ``Ubuntu 18.04`` minion named ``minion1.example.net`` for the ``libvirt`` formula:
|
||||
|
||||
#. ``parameters/defaults.yaml``
|
||||
#. ``parameters/defaults.yaml.jinja``
|
||||
#. ``parameters/osarch/amd64.yaml``
|
||||
#. ``parameters/osarch/amd64.yaml.jinja``
|
||||
#. ``parameters/os_family/Debian.yaml``
|
||||
#. ``parameters/os_family/Debian.yaml.jinja``
|
||||
#. ``parameters/os/Ubuntu.yaml``
|
||||
#. ``parameters/os/Ubuntu.yaml.jinja``
|
||||
#. ``parameters/osfinger/Ubuntu-18.04.yaml``
|
||||
#. ``parameters/osfinger/Ubuntu-18.04.yaml.jinja``
|
||||
#. ``salt['config.get']('libvirt:lookup')``
|
||||
#. ``salt['config.get']('libvirt')``
|
||||
#. ``parameters/id/minion1.example.net.yaml``
|
||||
#. ``parameters/id/minion1.example.net.yaml.jinja``
|
||||
|
||||
Remember that the order is important, for example, the value of ``key1:subkey1`` loaded from ``parameters/os_family/Debian.yaml`` is overridden by a value loaded from ``parameters/id/minion1.example.net.yaml``.
|
||||
|
||||
|
||||
For formula authors and contributors
|
||||
------------------------------------
|
||||
|
||||
Dependencies
|
||||
^^^^^^^^^^^^
|
||||
|
||||
``map.jinja`` requires:
|
||||
|
||||
- salt minion 2018.3.3 minimum to use the `traverse`_ jinja filter
|
||||
- to be located at the root of the formula named directory (e.g. ``libvirt-formula/libvirt/map.jinja``)
|
||||
- the ``libsaltcli.jinja`` library, stored in the same directory, to disable the ``merge`` option of `salt['config.get']`_ over `salt-ssh`_
|
||||
- the ``libmapstack.jinja`` library to load the configuration values
|
||||
- the ``libmatchers.jinja`` library used by ``libmapstack.jinja`` to parse compound like matchers
|
||||
|
||||
|
||||
Use formula configuration values in ``sls``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The ``map.jinja`` exports a unique ``mapdata`` variable which could be renamed during import.
|
||||
|
||||
Here is the best way to use it in an ``sls`` file:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split("/")[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as gitea with context %}
|
||||
|
||||
test-does-nothing-but-display-gitea-as-json:
|
||||
test.nop:
|
||||
- name: {{ gitea | json }}
|
||||
|
||||
|
||||
Use formula configuration values in templates
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
When you need to process salt templates, you should avoid calling `salt['config.get']`_ (or `salt['pillar.get']`_ and `salt['grains.get']`_) directly from the template. All the needed values should be available within the ``mapdata`` variable exported by ``map.jinja``.
|
||||
|
||||
Here is an example based on `template-formula/gitea/config/file.sls`_:
|
||||
|
||||
.. code-block:: sls
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- set sls_package_install = tplroot ~ '.package.install' %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as gitea with context %}
|
||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_package_install }}
|
||||
|
||||
gitea-config-file-file-managed:
|
||||
file.managed:
|
||||
- name: {{ gitea.config }}
|
||||
- source: {{ files_switch(['example.tmpl'],
|
||||
lookup='gitea-config-file-file-managed'
|
||||
)
|
||||
}}
|
||||
- mode: 644
|
||||
- user: root
|
||||
- group: {{ gitea.rootgroup }}
|
||||
- makedirs: True
|
||||
- template: jinja
|
||||
- require:
|
||||
- sls: {{ sls_package_install }}
|
||||
- context:
|
||||
gitea: {{ gitea | json }}
|
||||
|
||||
This ``sls`` file expose a ``gitea`` context variable to the jinja template which could be used like this:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
########################################################################
|
||||
# File managed by Salt at <{{ source }}>.
|
||||
# Your changes will be overwritten.
|
||||
########################################################################
|
||||
|
||||
This is another example file from SaltStack template-formula.
|
||||
|
||||
# This is here for testing purposes
|
||||
{{ gitea | json }}
|
||||
|
||||
winner of the merge: {{ gitea['winner'] }}
|
||||
|
||||
|
||||
.. _documentation: https://docs.saltproject.io/en/latest/topics/development/conventions/formulas.html#writing-formulas
|
||||
.. _fileserver: https://docs.saltproject.io/en/latest/ref/file_server
|
||||
.. _salt['config.get']: https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.config.html#salt.modules.config.get
|
||||
.. _salt['grains.get']: https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.grains.html#salt.modules.grains.get
|
||||
.. _salt['pillar.get']: https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.pillar.html#salt.modules.pillar.get
|
||||
.. _alternate delimiter: https://docs.saltproject.io/en/latest/topics/targeting/compound.html#alternate-delimiters
|
||||
.. _pillar.vault: https://docs.saltproject.io/en/latest/ref/pillar/all/salt.pillar.vault.html
|
||||
.. _pillars: https://docs.saltproject.io/en/latest/topics/pillar/
|
||||
.. _grains: https://docs.saltproject.io/en/latest/topics/grains/
|
||||
.. _grains.append: https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.grains.html#salt.modules.grains.append
|
||||
.. _SDB: https://docs.saltproject.io/en/latest/topics/sdb/index.html
|
||||
.. _sdb.vault: https://docs.saltproject.io/en/latest/ref/sdb/all/salt.sdb.vault.html
|
||||
.. _Jinja: https://docs.saltproject.io/en/latest/topics/jinja
|
||||
.. _roots: https://docs.saltproject.io/en/latest/ref/file_server/all/salt.fileserver.roots.html
|
||||
.. _gitfs: https://docs.saltproject.io/en/latest/topics/tutorials/gitfs.html
|
||||
.. _salt.slsutil.merge: https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.slsutil.html#salt.modules.slsutil.merge
|
||||
.. _traverse: https://docs.saltproject.io/en/latest/topics/jinja/index.html#traverse
|
||||
.. _salt-ssh: https://docs.saltproject.io/en/latest/topics/ssh/
|
||||
.. _template-formula/gitea/config/file.sls: https://github.com/saltstack-formulas/template-formula/blob/master/gitea/config/file.sls
|
||||
.. _bug 58726: https://github.com/saltstack/salt/issues/58726
|
||||
7
docs/pillar.rst
Normal file
7
docs/pillar.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
.. _pillar.example:
|
||||
|
||||
Example Pillar
|
||||
==============
|
||||
|
||||
.. literalinclude:: ../pillar.example
|
||||
:language: yaml
|
||||
6
docs/states.rst
Normal file
6
docs/states.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
Available States
|
||||
================
|
||||
|
||||
The following states are found in this formula:
|
||||
|
||||
|
||||
13
gitea/_mapdata/_mapdata.jinja
Normal file
13
gitea/_mapdata/_mapdata.jinja
Normal file
@@ -0,0 +1,13 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# {{ grains.get("osfinger", grains.os) }}
|
||||
---
|
||||
{#- use salt.slsutil.serialize to avoid encoding errors on some platforms #}
|
||||
{{ salt["slsutil.serialize"](
|
||||
"yaml",
|
||||
map,
|
||||
default_flow_style=False,
|
||||
allow_unicode=True,
|
||||
)
|
||||
| regex_replace("^\s+'$", "'", multiline=True)
|
||||
| trim
|
||||
}}
|
||||
21
gitea/_mapdata/init.sls
Normal file
21
gitea/_mapdata/init.sls
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
---
|
||||
{%- set tplroot = tpldir.split("/")[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata with context %}
|
||||
|
||||
{%- set _mapdata = {
|
||||
"values": mapdata,
|
||||
} %}
|
||||
{%- do salt["log.debug"]("### MAP.JINJA DUMP ###\n" ~ _mapdata | yaml(False)) %}
|
||||
|
||||
{%- set output_dir = "/temp" if grains.os_family == "Windows" else "/tmp" %}
|
||||
{%- set output_file = output_dir ~ "/salt_mapdata_dump.yaml" %}
|
||||
|
||||
{{ tplroot }}-mapdata-dump:
|
||||
file.managed:
|
||||
- name: {{ output_file }}
|
||||
- source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja
|
||||
- template: jinja
|
||||
- context:
|
||||
map: {{ _mapdata | yaml }}
|
||||
7
gitea/clean.sls
Normal file
7
gitea/clean.sls
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .service.clean
|
||||
- .config.clean
|
||||
- .package.clean
|
||||
17
gitea/config/clean.sls
Normal file
17
gitea/config/clean.sls
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as gitea with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_service_clean }}
|
||||
|
||||
gitea-config-clean-file-absent:
|
||||
file.absent:
|
||||
- names:
|
||||
- {{ gitea.lookup.paths.conf | path_join('app.ini') }}
|
||||
- {{ gitea.lookup.paths.custom | path_join('conf', 'app.ini') }}
|
||||
- require:
|
||||
- sls: {{ sls_service_clean }}
|
||||
60
gitea/config/file.sls
Normal file
60
gitea/config/file.sls
Normal file
@@ -0,0 +1,60 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- set sls_package_install = tplroot ~ '.package.install' %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as gitea with context %}
|
||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_package_install }}
|
||||
|
||||
# Since this formula does not rely on the web installer,
|
||||
# the global configuration should include:
|
||||
# - database configuration
|
||||
# - secrets
|
||||
# Otherwise, gitea would not run at all.
|
||||
Required Gitea config is setup:
|
||||
file.managed:
|
||||
- name: {{ gitea.lookup.paths.conf | path_join('app.ini') }}
|
||||
- source: {{ files_switch(['etc/app.ini.j2'],
|
||||
lookup='Required Gitea config is setup'
|
||||
)
|
||||
}}
|
||||
- template: jinja
|
||||
- mode: '0640'
|
||||
- user: root
|
||||
- group: {{ gitea.lookup.group }}
|
||||
- require:
|
||||
- sls: {{ sls_package_install }}
|
||||
- context:
|
||||
gitea: {{ gitea | json }}
|
||||
{%- if not gitea.secrets.internal_token and 'file://' == gitea.lookup.paths.internal_token_uri[:7] %}
|
||||
# gitea complained about permissions with mode = 640, root:git ownership
|
||||
cmd.run:
|
||||
- name: >
|
||||
{{ gitea.lookup.paths.bin | path_join('gitea') }} generate secret INTERNAL_TOKEN > '{{ gitea.lookup.paths.internal_token_uri[7:] }}' &&
|
||||
chmod 0640 '{{ gitea.lookup.paths.internal_token_uri[7:] }}' &&
|
||||
chown {{ gitea.lookup.user }}:{{ gitea.lookup.group }} '{{ gitea.lookup.paths.internal_token_uri[7:] }}'
|
||||
- creates: {{ gitea.lookup.paths.internal_token_uri[7:] }}
|
||||
- require:
|
||||
- sls: {{ sls_package_install }}
|
||||
{%- endif %}
|
||||
|
||||
gitea-config-file-file-managed:
|
||||
file.managed:
|
||||
- name: {{ gitea.lookup.paths.custom | path_join('conf', 'app.ini') }}
|
||||
- source: {{ files_switch(['app.ini.j2'],
|
||||
lookup='gitea-config-file-file-managed'
|
||||
)
|
||||
}}
|
||||
- mode: '0640'
|
||||
- makedirs: true
|
||||
- dir_mode: '0750'
|
||||
- user: {{ gitea.lookup.user }}
|
||||
- group: {{ gitea.lookup.group }}
|
||||
- template: jinja
|
||||
- require:
|
||||
- sls: {{ sls_package_install }}
|
||||
- context:
|
||||
gitea: {{ gitea | json }}
|
||||
5
gitea/config/init.sls
Normal file
5
gitea/config/init.sls
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .file
|
||||
30
gitea/files/default/app.ini.j2
Normal file
30
gitea/files/default/app.ini.j2
Normal file
@@ -0,0 +1,30 @@
|
||||
{%- macro render_opt(name, val) %}
|
||||
{%- if val is boolean %}
|
||||
{%- set rendered = val | string | lower %}
|
||||
{%- elif val | is_list %}
|
||||
{%- set rendered = val | join(',') %}
|
||||
{#- some special characters might make problems, escape the value just in case #}
|
||||
{%- elif val is string %}
|
||||
{%- set rendered = '`{}`'.format(val) %}
|
||||
{%- else %}
|
||||
{%- set rendered = val | string %}
|
||||
{%- endif %}
|
||||
{{- name | upper }} = {{ rendered }}
|
||||
{%- endmacro -%}
|
||||
|
||||
;; This file is managed by Salt.
|
||||
;; Manual changes might be overwritten.
|
||||
|
||||
{% for name, val in gitea.config.default.items() %}
|
||||
{{ render_opt(name, val) }}
|
||||
{%- endfor %}
|
||||
|
||||
{%- for topic in gitea.config %}
|
||||
{%- if 'default' != topic %}
|
||||
|
||||
[{{ topic | lower }}]
|
||||
{%- for name, val in gitea.config[topic].items() %}
|
||||
{{ render_opt(name, val) }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
24
gitea/files/default/etc/app.ini.j2
Normal file
24
gitea/files/default/etc/app.ini.j2
Normal file
@@ -0,0 +1,24 @@
|
||||
;; Global Gitea configuration managed by salt state.
|
||||
;; These values are necessary to skip the web installer.
|
||||
|
||||
[database]
|
||||
{%- for conf, val in gitea.database.items() %}
|
||||
{{ conf | upper }} = {{ val if conf | upper != 'PASSWD' else '`{}`'.format(val) }}
|
||||
{%- endfor %}
|
||||
|
||||
{#- The following secrets are guaranteed to be set by `post-map.jinja`. #}
|
||||
|
||||
[oauth2]
|
||||
JWT_SECRET = {{ gitea.secrets.jwt_secret }}
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
{%- if gitea.secrets.internal_token %}
|
||||
INTERNAL_TOKEN = {{ gitea.secrets.internal_token }}
|
||||
{%- else %}
|
||||
INTERNAL_TOKEN_URI = {{ gitea.lookup.paths.internal_token_uri }}
|
||||
{%- endif %}
|
||||
SECRET_KEY = {{ gitea.secrets.secret_key }}
|
||||
|
||||
[server]
|
||||
LFS_JWT_SECRET = {{ gitea.secrets.lfs_jwt_secret }}
|
||||
103
gitea/files/default/gitea.service.j2
Normal file
103
gitea/files/default/gitea.service.j2
Normal file
@@ -0,0 +1,103 @@
|
||||
{#- To keep the below "readable", set short vars here. -#}
|
||||
{%- set work = gitea.lookup.paths.work -%}
|
||||
{%- set bin = gitea.lookup.paths.bin | path_join('gitea') -%}
|
||||
{%- set user = gitea.lookup.user -%}
|
||||
{%- set home = salt['user.info'](gitea.lookup.user).home -%}
|
||||
{%- set config = gitea.lookup.paths.conf | path_join('app.ini') -%}
|
||||
{%- set custom_needed = gitea.lookup.paths.custom != (gitea.lookup.paths.work | path_join('custom')) -%}
|
||||
{%- set custom = gitea.lookup.paths.custom -%}
|
||||
|
||||
[Unit]
|
||||
Description=Gitea (Git with a cup of tea)
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
{%- if gitea.service.wants %}
|
||||
{%- for wanted in gitea.service.wants %}
|
||||
Wants={{ wanted }}.service
|
||||
After={{ wanted }}.service
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- if gitea.service.requires_mount %}
|
||||
{%- for mount in gitea.service.requires_mount %}
|
||||
RequiresMountsFor={{ mount }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
###
|
||||
# Don't forget to add the database service dependencies
|
||||
###
|
||||
#
|
||||
#Wants=mysql.service
|
||||
#After=mysql.service
|
||||
#
|
||||
#Wants=mariadb.service
|
||||
#After=mariadb.service
|
||||
#
|
||||
#Wants=postgresql.service
|
||||
#After=postgresql.service
|
||||
#
|
||||
#Wants=memcached.service
|
||||
#After=memcached.service
|
||||
#
|
||||
#Wants=redis.service
|
||||
#After=redis.service
|
||||
#
|
||||
###
|
||||
# If using socket activation for main http/s
|
||||
###
|
||||
#
|
||||
#After=gitea.main.socket
|
||||
#Requires=gitea.main.socket
|
||||
#
|
||||
###
|
||||
# (You can also provide gitea an http fallback and/or ssh socket too)
|
||||
#
|
||||
# An example of /etc/systemd/system/gitea.main.socket
|
||||
###
|
||||
##
|
||||
## [Unit]
|
||||
## Description=Gitea Web Socket
|
||||
## PartOf=gitea.service
|
||||
##
|
||||
## [Socket]
|
||||
## Service=gitea.service
|
||||
## ListenStream=<some_port>
|
||||
## NoDelay=true
|
||||
##
|
||||
## [Install]
|
||||
## WantedBy=sockets.target
|
||||
##
|
||||
###
|
||||
|
||||
[Service]
|
||||
# Modify these two values and uncomment them if you have
|
||||
# repos with lots of files and get an HTTP error 500 because
|
||||
# of that
|
||||
###
|
||||
#LimitMEMLOCK=infinity
|
||||
#LimitNOFILE=65535
|
||||
RestartSec=2s
|
||||
Type=simple
|
||||
User={{ user }}
|
||||
Group={{ gitea.lookup.group }}
|
||||
WorkingDirectory={{ work }}
|
||||
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
|
||||
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
|
||||
#RuntimeDirectory=gitea
|
||||
ExecStart={{ bin }} web --config '{{ config }}'
|
||||
Restart=always
|
||||
Environment=USER={{ user }} HOME={{ home }} GITEA_WORK_DIR={{ work }}{% if custom_needed %} GITEA_CUSTOM={{ custom }}{% endif %}
|
||||
# If you install Git to directory prefix other than default PATH (which happens
|
||||
# for example if you install other versions of Git side-to-side with
|
||||
# distribution version), uncomment below line and add that prefix to PATH
|
||||
# Don't forget to place git-lfs binary on the PATH below if you want to enable
|
||||
# Git LFS support
|
||||
#Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin
|
||||
# If you want to bind Gitea to a port below 1024, uncomment
|
||||
# the two values below, or use socket activation to pass Gitea its ports as above
|
||||
###
|
||||
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
#AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
###
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
158
gitea/files/default/key.asc
Normal file
158
gitea/files/default/key.asc
Normal file
@@ -0,0 +1,158 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
xsFNBFsvDSkBEADtyFKGhQ/sh9KmVAzivJfMGbasytWkZNdIrwCoxSTEijl2QLyi
|
||||
E8b5xEOK2+9b3OXF+Nbm+tdfVCaKfoDhXdglxvENSdXA0mKxt4RhKxXAkWHrLfeA
|
||||
A4RbUj0ndfpJWpoRoEPZTP2a8UXOctUVQP+JzC+D028nawzpSVrXN7UYkszJ5j06
|
||||
oR6+ZMjpEMbPRnOWRuaJONPvBuTHGDSsD3UPJlWyeUv7+GmcVJzjc8uq1HeX/5Ap
|
||||
NTrESldIDPgcxfTWhscj1+s8gvW5SqcNQnWSIUtI+Bi2sW9ibj9XlkFJMU7QFV+S
|
||||
1uF9D8lynZCSDIjnsqSuX3TMgr2CPk7+0eLNFAVrrTUbGwcoyge3d8osJD5PS3z6
|
||||
COwDlzAXRJECScRo1ynxCxJTLVf6JoGQEFzVc5HSlM8Lx1zm/Al+AYdhdToCQNDF
|
||||
vLLuHkMqh3OLG3yxS142BUHDrd0KaiY+sxoUQjVjo7PHpLZRJKGZCxSS6vPr9I+o
|
||||
OTDO2h7rWdTtodmkSz9+NnUD1cGYWwL8j4Cpi4yozg+8Gbtywnm/q0TPMYhyiBbn
|
||||
hU+sowfmo1RPn2aQnxSS55L7cMTNzP95cU4FQDNzYhget9X5UJJPWdSRcknykMcQ
|
||||
oAo0IfswMDC7LWf8uObZo/0DQeGBVBx2y/+Ir9dt5MhcrmO/U+fCF+O2xwARAQAB
|
||||
zRhUZWFib3QgPHRlYWJvdEBnaXRlYS5pbz7CwZQEEwEIAD4CGwMFCwkIBwIGFQoJ
|
||||
CAsCBBYCAwECHgECF4AWIQR8nmgVJZRoiGLWKvYtmugG7BWS4gUCXvKlFgUJB4X+
|
||||
7QAKCRAtmugG7BWS4nDAEADttD9mPkKlrUhpJxPbzblstIsv5OvTGjemjrTJc6UT
|
||||
HsjUe1eZ3+QsHN0TGZEP0WigA1hseA4j+7/S8CeYeAf7K7LS4KVGJ9AlZC1xEuII
|
||||
HnQURNWOubEDuRkuYvK2HZ5sEQfRbgW6q8bLAHGvsqQG7fw8elwpERI5y0qDZZhX
|
||||
iVNqMmeaCnLVp5GTS6j7+gT7ySqwun+02K5UjtUjhDdyu4fyPctPcNkI2kzcXUnv
|
||||
TeAOPZSgdvmF8SlG27K0pXn+aeGopLamt2dD2nXQgwECMYfu9vFEEqn9TN899eVe
|
||||
EWeLMBmBWDMfE3NPDTitKyGwQ1XGa+SRt3kVuIClZVa8hiCdl0AZcReHmUK9L0i5
|
||||
hggQQfeoPofAJUbM4PzjKjaJ/P328T5o/Rz7QQaRUudPPdTvoxi4DojynBwqjg0g
|
||||
pagywiNfzH8LOTVFXjRhbmhy8w1zs5z4rCIZZo3fC6Dk2MwgcJEolbCC+7iEu/R7
|
||||
kziTisMA2l0TTYIjuaFveTHorS6VfzK/xdq3OhY6YEEDHnch5mnQ3Lxms9z6H2GC
|
||||
FnVeXJR90qNDy91lGFtCQ5ks4xzW1NqNDJRlWn4+sw7rD/41scEeVZGWKuohm3cQ
|
||||
r39OX1W8xo1eesk6wniHmwr5x6RZi6tVuKi+0UkXu8E3ez2rde3BicdWESpvbFdM
|
||||
zMLBlAQTAQgAPhYhBHyeaBUllGiIYtYq9i2a6AbsFZLiBQJbLw0pAhsDBQkDwmcA
|
||||
BQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEC2a6AbsFZLiw44P/0MpkiOcklDm
|
||||
T3yGJPzVotanLpzzwxLRFACBlecNo5RfZlwn4lnVu4ZAfcKHdCgQAtHtMqEjz5Ue
|
||||
6PLuDCdIxSVlK1WsegCKT/jzl36TTw035nlo1ahgrqVx3XU4WLq4/LwOASfZZQcV
|
||||
9BR6wH8WE6cbxbsNDPgeIygwUwAoQR54D07Ztwtbu6QXU5RXBgGhZAap0S59buGI
|
||||
TtY4B6hhjMQkcBkafFDdskrgZjH9GFqvS1qchgWFfnxK0Q1ZT1qXDgQJR2ZALf4X
|
||||
5u7zWSOcPRMNA/2rA+Oh2jyNnkxAkMpwA6OTiyaA0xo3lups1vx/CYGCQurBpAHt
|
||||
KITVaVx5PGoHpJN1QEBJrFdcC8xiVd25qUYMSbjAVRXI9EFSPy5JZBlsYeFnQ0Qw
|
||||
WnIQCRAQe0DI9oZkk7BAuptCdMRXo+GO85c6w6nMbuKOiakE6djyXst6Vle0pCOT
|
||||
81F8G+DF8crDl3VKE6IPmq5N0XX0lRYDL7XkNUaqO0iEA/gtfWAYtSUWiHwcnzW5
|
||||
C6fHMRa8sG0R1CluPOabhAs2pQnaFAwGDRyFRYcfmKro9267I8eiydq1z8y8tl3B
|
||||
XPYWsvZgZuLF5ahgNjYB9XRQZWMXVboraiiwQsCHeMzG/2Uas/idPQfA1TU0CDHn
|
||||
9/LktcnScN7BHQEi5lkxmadLfzn8uNtmzsFNBFsvDSkBEADYL0eMn3ZZfk5EV+Zb
|
||||
4FmBZw4+/3nhMInX6PMzu/3WxczcORQtgzN0/VQ19OHhsv8I29Pr+SPOaDm0ASdM
|
||||
gzNYq//qdKYgQsjAaGHzGcgomGYqV9Bix0MpK5yuo+IKD6q5cQAeqFD/h82+TCiW
|
||||
7G+y2Hxgeu9MAvvTp8pU4pk1WbNrgTZvhOxwbrRv2AGzxsUxgqyj5ox30dvIo8n5
|
||||
WsoXpl0OOlpLRg9U7uBNMmUu12TOlEE4HFO5xjRO5EwfKWAHP6EUGk0JLTfAMQ/A
|
||||
MZa5WeWqeWzV/Pni6/RpuAmY2SEu/+gro1XqytkeQCV877WcC0VT/C1QihuvNGy3
|
||||
ovv7j4Qroh2L6NgeAyym01OqI5bV4+EJ+6cIbC4ohQAfj6nhY/E/6bkYmzs1uwMv
|
||||
SULVjFAtRD8m3lypy0xHTX64N5yICi65WVTuFUqDQiFfjP9Si2BS08mBM5lCOC/F
|
||||
wtkAMC0IRfNSYNdAjo0BDh59Yana5vfW1VNNCHD7ZG08cOBaHhg+qiZK8t28UX6r
|
||||
kxDxghk2HEw3sxKEW7pJoHc5OiltL5/4Oq2AVC/Sm63VeeDlfVu8qj4xMikyjVG0
|
||||
c86XOpoCDxlzmKbG5YYiUGER1WCTB9uuJ3e6AO+3wAJ8p2s8NB6f3vWeeyzZhtsm
|
||||
41Amge/sZggSQGqytjPydTxGxQARAQABwsF8BBgBCAAmAhsMFiEEfJ5oFSWUaIhi
|
||||
1ir2LZroBuwVkuIFAl7yokcFCQeF/B4ACgkQLZroBuwVkuKAag/9EYvfWSBC34sz
|
||||
MCeZ3CZpJJzshF54l7+RG3pujxLbZZdgpmCTWZ4QM+oyqb+iSTO+9H0txLvI8sah
|
||||
o3kd1PbgefBhWlxq4sAYOpNJ1ymHVB0FOvHUo1YbzkmyRZL1KbSRZKfyc6E3crQN
|
||||
djeSFF6H46rOrLe2K2Dq3cRzoIoYcI3aDofKXlwM4nzb/HMQ/DzCRwS1ETwvdhVz
|
||||
hoWTJlF37fzKLN8Bcwgfyc6tbN5xeywVnSYdavWpuCa1x+jmeeIUiXuMXVpw50rZ
|
||||
tLJCOkczS3dSfzNMc37QmwtT5N/rrHfQKutuBKCmmBlspLAEVUx2R3dssbpn59Rp
|
||||
QTOZ25WYRT8dFQGvxt+oin0FNxf9s9m0wzcor26bOdOnayKsHShIJWYIrxzLQl/s
|
||||
vpGEk7vaBfAwYuaCK2x198j+zTgufZ7Kq0RCul9l6Pec3yxOo7cLI5Efh9K9kh12
|
||||
2FUgGCKrf5WVGUi3/n/RPhJw+RiRuERLGBxi+vXDrdt7hrntOiJej3MsPdzo02B/
|
||||
9Q9sjU4S45NM0XyQpnUAqTY+z2zth97Z04aSR/wasHg7o3rLNPX3w/eIvqXTPmzr
|
||||
7KsqzPaPXPQ5WX3qSKQGLCiSrmjxQiprS0LXlmvW2xEiJERYFR2vovqpiLXwz+SF
|
||||
45cewQ6ABG0T1Fa70kpMvWA1+vqMUCLCwXwEGAEIACYWIQR8nmgVJZRoiGLWKvYt
|
||||
mugG7BWS4gUCWy8NKQIbDAUJA8JnAAAKCRAtmugG7BWS4sKID/9CF5QnNyKsfJoB
|
||||
+CuNNW1GN8JRcd9z9fmwrCtZr0STuP3tgJY96euM4xvUqbfuI+nLw0fa8yXOEOrr
|
||||
jMGyqzzMyaFiyFyXLEISQN+HMDMbsJHmvfeC0RUERtfAlVwrjebjDQetHTqJjSf/
|
||||
//ZXJ6yfdO1Boz0Jik4U198GK8mVBVJrFtM28KRyiPpqoZEvCGEx3Gylk18yOtJn
|
||||
tOR9H/u0xV34X7mXcrPbaf3D+uYgUPeHcWlI0H7mjl60RdImesFXGSL40B0MG6vx
|
||||
XRHiH+j+32dvovNQPKPPOcJGxyep2AvQQDsY262FM9JUIX0Kx2WMsSAAveJ8549f
|
||||
fIRfyLegO3XGv107jCAjdD7KW8LLaKJsBcy9AtdWrjDuStmJo2yIWoUlg2Vd59//
|
||||
qu0pEUJLm5lZEVXa/bLspPIxedLstlwrasapczMOktb5d/igt9OIUFUaEjaQUGKp
|
||||
yhHBm9zJD06cJs9MfvqEubuJzSsxkrOK2senPYw/RotV0zfrtxefv6SKYmSDOy6x
|
||||
Y0W2Gtrn3PhOkIdnT4L58e+5mQc1cWqbbbTnVpEc31HX22kSzqWtWxbTcE3Y4SMO
|
||||
D9LvC7jhn6fNN9VBmSsFO5Mn70o4tqQrAueSJptVAvMwse4OaBNJn9XzeIwxbLoo
|
||||
vDuICSramSXhNM6enfBeDy66tnLnFs7BTQRbLw2xARAA2jnRSZFdkcAwygf8BoyG
|
||||
9HurVqFb0t5SRZHEjFIl6wmdvlk13KszvyzRJ+8IEL3QQtdwTKZAMYT9Hamclvwi
|
||||
iF92/12HwsTK1Ijn/ayAsWmHFhXvqlEaKtm/39Mj6M4b6wPkl5vy/TYoxj3CDGl8
|
||||
gWQHo/RmYOcDl61Twswt4uonUm4fO9V8x19mhxbap6CDsh6Eh64SxXRkyXaY1UPr
|
||||
d4V/TslyBsLz5L5sgIVVTvnNitSAnGhy77CwUiv3DkvoK6lc7/JvH1zf50/v3ueq
|
||||
uhTABeMuhdD5Vz7Zq6GYOSkDh/gPCfgBeL0W/vpWSVLyQC0dkC94yxN9R5SHKcae
|
||||
++IFFhSa3CNPiBLhZ/6dl3K1MV4rJ0CY++RbYNHdrmQFA95HpiSfqcOGBZU5YfV+
|
||||
ErlsVqZFqBMP7edZtgT9kKW8NPQdLdm4aClzBATnkI0wgAozq2FBacFosuNEUVCW
|
||||
ap6vaJ1L0cJeIC7kzOmp3T/W/klECfxHenEIoH5XlsIugHMAtdnWzAZv8LnLfCo7
|
||||
FsuUZXD7PhNvavNJUdQ2EaKC/DSy0++6Il1wKvt26RPaMM0JtEdCO3AMoXVtfqLp
|
||||
0Er4FBUpHV6OtaVhlnqOhHh6O/AlmX8z90Okc/u+UBtwhgcXFyM3oA9JKEAIthFB
|
||||
i9871frBAbXS8Z9YJESLpQ0AEQEAAcLDsgQYAQgAJgIbAhYhBHyeaBUllGiIYtYq
|
||||
9i2a6AbsFZLiBQJe8qJ3BQkHhfvGAkDBdCAEGQEIAB0WIQTMZLHbZ6u+7KsktkVf
|
||||
w0Yyl1P0sAUCWy8NsQAKCRBfw0Yyl1P0sMVTD/9tr7HkTQie+SPOrL/6BJr1/cAh
|
||||
U5Xv58IkMsuBmPO6uqmMar5gvvbebaafprB7MjK3b2pwTeaHvnSkeRDqMzpEWiy3
|
||||
sBN1S1wedXnEOmGYB8CTyDzgV3DmGHbnvCmQv9agtiEgaGqR1xaZCkUQmjhTIVnp
|
||||
ATyx14kZgxcLYhKYybI1w7YrZPJcGEt/ENUZQRNKac2/tu/GqiNnZ0ppCc0l7N9Z
|
||||
OoboqgzBXKGDbYJ97WO8XnGqrHK0CDUVao2ji+xd6bi9aLXb0sNeRGeOKVqaHYg2
|
||||
NA/KdnPTQj8JnmSaZmpvFJJiLXiB/zjNWouYPNNRQidGhjHYlHgNz/mCkRBHhOhi
|
||||
Pwz2ui15GSl8dUecNMkJaon+9NAmA2L7N0J5PA1ZB4ywrgc1ZSjxdRxTGGVrM0H+
|
||||
2R4ILA/gEYWRPLwEpOekX4Vlc2MEajSA+eGlBVF/Qb5B8+u4Aegwsz1Iy+yYxJ/q
|
||||
xSS2xwDVvI1utifUfF/AXgM5FvW1+3KmpaMTpr/+KHtUIdkM/DT62J9j+aCTcyXw
|
||||
AFlli2FsbvZBHEoir/EqJdFjxhXXnZmb85w2/eJTapQQ5lxAzeurRrhurl+Ai+cN
|
||||
SpJC++jAusIJ86mA7iZPyEic2G93ivcyolhGJnkeUBlTJui6Spk48NcHlNl+H3kw
|
||||
NST+DIIlHK5RxG7n3AkQLZroBuwVkuI8LhAAkhidYnGWLKv09OUz9LEjEu2nmXTr
|
||||
Nz/ww6gWlWfhML//T3Mgp/FYoZRXWcMNYysm2UDHtl9atrMReoSnCeza/n0Dzw+e
|
||||
6AR1wJGS0B9JqFARt4o4/pbOEC1kTWSKxh41YQbJdECU/c0ZnbotuMoG8SlKjCNm
|
||||
NZNVL8XGykXDTiaCIWVMArMjG1RH6Bn5weXrMoQTHTd0Brr7HyHxSCb8RBeNZmdf
|
||||
Ivy0uSuI/frobxm32x7+yCprNnH0ZLP4czQq80sdaId/KmfHRTmhJSyXxjEivrZZ
|
||||
oMUIECIPE9rggBaO24iCfUfr7k4oGxpaccPvnrGoEa2BxR4JERUPR2QPc6QnT3B7
|
||||
hJF2OPP//VITg6RlgeU7wzX0eLJDxvoE72y0fb7qfpjtcYn1T5TkJNrGuzpoPrUt
|
||||
i1c/PdN/RH2+6Quh+wKawD3PhYn8BXqdhgh4m9SRhXL06N2djg7oz7J79+z+sPH1
|
||||
Em1rRPA0ZmtXcxbWFd4S2ufG4X679NlJNAOE7p8HexvXS1FQmRC+beN/rJjNtS+z
|
||||
CS8HfcWchNmwAJ6VfTJRGmaH5DOwR37PerxzqZPXEHcNzuSj0IsXepdEYgqLFFjm
|
||||
lVIWQqeqbFcHl6hW4TpboaSHskzvZwE/qlfT8JK5RvhNhB720JX/Kp7mp5NTtkKV
|
||||
Cfp07Zd/lD9Pjs/Cw7IEGAEIACYCGwIWIQR8nmgVJZRoiGLWKvYtmugG7BWS4gUC
|
||||
XRR5WwUJA8afKgJAwXQgBBkBCAAdFiEEzGSx22ervuyrJLZFX8NGMpdT9LAFAlsv
|
||||
DbEACgkQX8NGMpdT9LDFUw//ba+x5E0Invkjzqy/+gSa9f3AIVOV7+fCJDLLgZjz
|
||||
urqpjGq+YL723m2mn6awezIyt29qcE3mh750pHkQ6jM6RFost7ATdUtcHnV5xDph
|
||||
mAfAk8g84Fdw5hh257wpkL/WoLYhIGhqkdcWmQpFEJo4UyFZ6QE8sdeJGYMXC2IS
|
||||
mMmyNcO2K2TyXBhLfxDVGUETSmnNv7bvxqojZ2dKaQnNJezfWTqG6KoMwVyhg22C
|
||||
fe1jvF5xqqxytAg1FWqNo4vsXem4vWi129LDXkRnjilamh2INjQPynZz00I/CZ5k
|
||||
mmZqbxSSYi14gf84zVqLmDzTUUInRoYx2JR4Dc/5gpEQR4ToYj8M9roteRkpfHVH
|
||||
nDTJCWqJ/vTQJgNi+zdCeTwNWQeMsK4HNWUo8XUcUxhlazNB/tkeCCwP4BGFkTy8
|
||||
BKTnpF+FZXNjBGo0gPnhpQVRf0G+QfPruAHoMLM9SMvsmMSf6sUktscA1byNbrYn
|
||||
1HxfwF4DORb1tftypqWjE6a//ih7VCHZDPw0+tifY/mgk3Ml8ABZZYthbG72QRxK
|
||||
Iq/xKiXRY8YV152Zm/OcNv3iU2qUEOZcQM3rq0a4bq5fgIvnDUqSQvvowLrCCfOp
|
||||
gO4mT8hInNhvd4r3MqJYRiZ5HlAZUyboukqZOPDXB5TZfh95MDUk/gyCJRyuUcRu
|
||||
59wJEC2a6AbsFZLiqc0QAJNsa5yUKbwrukXnbl0VV9Vdu3/PwmmilZZfc2LtGUK8
|
||||
v7ZgXOuNN8+g2fFLZ83SgbG5hKmvEf+dR39D9I0B+mOUKEYNik7oerhmyO2qrJ2y
|
||||
VNxGN8S66b9lTDi4BZHN1b76Tt9NqbebCvodlu+Hb52PPaXsPLisWHaFrpcpff6R
|
||||
fnZCUKDfeD/uyrtV68PqdNFdiXxVj9A96key3IesCD3xL5eXHyl855bh/17GyhIz
|
||||
pPQvOUVBwFla0Zm3fiNRxYFy9hATzbGwd3itMEyLDQamjT08L9xqQYgpdBW2seMF
|
||||
HOvivLlaet3dxY9g5WUj62CTpObxq4b/u8mXjE2wx+1QTx0ZHaFjv3FkGGZUQFC8
|
||||
yS1S6tGjdsdBW1v+YAyQhHR8SJ/d7UleczfbcL3zrWQPMmhmlQupz+LcHhFpPSOJ
|
||||
Denj+nB+e9zI+d7v3L8NfXhGXqBy1PuirK8Fux03pt7oYo5w7T0P26EDR6w7uk20
|
||||
Rr5b7p6BGuPo8TQ4OTdNtBAXalhXc6C2cUIuJMK23Gr8Uz+MymiIzF+IZILPQIsH
|
||||
mvwH4QbUB7igBTtq2HfFC7kr6z+RQBgfx449TbpW1RSjQ5kUxSIO4srkFIaHfI9c
|
||||
tcM4WIhK2l8lT0/H1GZ14gsSzMlIyQu/oQzkw97fZrSgV2vH2yeiYueVTHFItfme
|
||||
wsOyBBgBCAAmFiEEfJ5oFSWUaIhi1ir2LZroBuwVkuIFAlsvDbECGwIFCQHhM4AC
|
||||
QAkQLZroBuwVkuLBdCAEGQEIAB0WIQTMZLHbZ6u+7KsktkVfw0Yyl1P0sAUCWy8N
|
||||
sQAKCRBfw0Yyl1P0sMVTD/9tr7HkTQie+SPOrL/6BJr1/cAhU5Xv58IkMsuBmPO6
|
||||
uqmMar5gvvbebaafprB7MjK3b2pwTeaHvnSkeRDqMzpEWiy3sBN1S1wedXnEOmGY
|
||||
B8CTyDzgV3DmGHbnvCmQv9agtiEgaGqR1xaZCkUQmjhTIVnpATyx14kZgxcLYhKY
|
||||
ybI1w7YrZPJcGEt/ENUZQRNKac2/tu/GqiNnZ0ppCc0l7N9ZOoboqgzBXKGDbYJ9
|
||||
7WO8XnGqrHK0CDUVao2ji+xd6bi9aLXb0sNeRGeOKVqaHYg2NA/KdnPTQj8JnmSa
|
||||
ZmpvFJJiLXiB/zjNWouYPNNRQidGhjHYlHgNz/mCkRBHhOhiPwz2ui15GSl8dUec
|
||||
NMkJaon+9NAmA2L7N0J5PA1ZB4ywrgc1ZSjxdRxTGGVrM0H+2R4ILA/gEYWRPLwE
|
||||
pOekX4Vlc2MEajSA+eGlBVF/Qb5B8+u4Aegwsz1Iy+yYxJ/qxSS2xwDVvI1utifU
|
||||
fF/AXgM5FvW1+3KmpaMTpr/+KHtUIdkM/DT62J9j+aCTcyXwAFlli2FsbvZBHEoi
|
||||
r/EqJdFjxhXXnZmb85w2/eJTapQQ5lxAzeurRrhurl+Ai+cNSpJC++jAusIJ86mA
|
||||
7iZPyEic2G93ivcyolhGJnkeUBlTJui6Spk48NcHlNl+H3kwNST+DIIlHK5RxG7n
|
||||
3ObXD/9LLcRZs7ZoJmdFdvsN99UE7JMAyXolx3BJrlASmeo7X64TCXA7jx+IX+3S
|
||||
mhEPobcUelbTbb42xRpJgP+Z+rll55LyK/dKsic2nhiPo1FvmFTehtP/NvOGeuP3
|
||||
LRHs8KlyR6Jb4JLin8afhHjiKq8c28kVjVMfrX1SxLlhz4gQOsLoirXEUWe6Qyz+
|
||||
pUjDQFUJlxeie/ga/58hzaRU1QbDLPVXbjOQBc2qGL17PuykOYXweoPmqo42y2HQ
|
||||
CcQ+4zcLWBX2IUJNrOTSDMiYeR83Bw8z1XIr4mKmPG4ifF1GFml0yZjwZccx/po6
|
||||
LtowadMt5GIzxuEIawAG7pREbKwzXpI41vOVz2w3H9Q8a70eo3PXECuQ1hDM4/uN
|
||||
vwmL2/8Xq7PONE0DahD6QFSNX+zWs3Y80CJwQJH/qJp/wGeyAfgm5tPXci4yxGkF
|
||||
QEHnpKx/93oBKe4upPmGV6gcNvBNHNxUKQH0izjZUkTPHULN1aBfYomjsMlPqeD8
|
||||
VKhQYreKXJ51IM4H7EWR6OB2yDxH3aozIo0PjYZ/lLGfb+LP4wuT4eRTm1/7Svy5
|
||||
d+ZkXzhUPI9b4FjwXEjaFTq6hBv/niVjn+kw+vL/g4v6DZ7qDAqFvXdrc4gd8A8d
|
||||
tA7klbdai0zV9RaL9coX8nDDhKW2YJweW7V4YlinKRC/oSsStg==
|
||||
=TBFA
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
7
gitea/init.sls
Normal file
7
gitea/init.sls
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .package
|
||||
- .config
|
||||
- .service
|
||||
315
gitea/libmapstack.jinja
Normal file
315
gitea/libmapstack.jinja
Normal file
@@ -0,0 +1,315 @@
|
||||
{#- -*- coding: utf-8 -*- #}
|
||||
{#- vim: ft=jinja #}
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split("/")[0] %}
|
||||
{%- from tplroot ~ "/libmatchers.jinja" import parse_matchers, query_map with context %}
|
||||
|
||||
{%- set _default_config_dirs = [
|
||||
"parameters/",
|
||||
tplroot ~ "/parameters"
|
||||
] %}
|
||||
|
||||
{%- macro mapstack(
|
||||
matchers,
|
||||
defaults=None,
|
||||
dirs=_default_config_dirs,
|
||||
log_prefix="libmapstack: "
|
||||
) %}
|
||||
{#-
|
||||
Load configuration in the order of `matchers` and merge
|
||||
successively the values with `defaults`.
|
||||
|
||||
The `matchers` are processed using `libmatchers.jinja` to select
|
||||
the configuration sources from where the values are loaded.
|
||||
|
||||
Parameters:
|
||||
|
||||
- `matchers`: list of matchers in the form
|
||||
`[<TYPE>[:<OPTION>[:<DELIMITER>]]@]<QUERY>`
|
||||
|
||||
- `defaults`: dictionary of default values to start the merging,
|
||||
they are considered built-ins. It must conform to the same
|
||||
layout as the YAML files: a mandatory `values` key and two
|
||||
optional `strategy` and `merge_lists` keys.
|
||||
|
||||
- `dirs`: list of directory where to look-up the configuration
|
||||
file matching the matchers, by default a global `salt://parameters/`
|
||||
and a per formula `salt://<tplroot>/parameters`
|
||||
|
||||
- `log_prefix`: prefix used in the log outputs, by default it is
|
||||
`libmapstack: `
|
||||
|
||||
Example: On a Debian system with `roles=["nginx/server", "telegraf"]`
|
||||
|
||||
{%- set settings = mapstack(
|
||||
matchers=[
|
||||
"Y:G@os_family",
|
||||
"I@" ~ tplroot,
|
||||
"Y:C@roles",
|
||||
],
|
||||
dirs=["defaults", tplroot ~ "/parameters"],
|
||||
)
|
||||
| load_yaml %}
|
||||
|
||||
This will merge the values:
|
||||
|
||||
- starting with the default empty dictionary `{}` (no
|
||||
`defaults` parameter)
|
||||
|
||||
- from the YAML files
|
||||
|
||||
- `salt://defaults/os_family/Debian.yaml`
|
||||
|
||||
- `salt://{{ tplroot }}/parameters/os_family/Debian.yaml`
|
||||
|
||||
- from the pillar `salt["pillar.get"](tplroot)`
|
||||
|
||||
- from the `nginx/server` YAML files:
|
||||
|
||||
- `salt://defaults/roles/nginx/server.yaml`
|
||||
|
||||
- `salt://{{ tplroot }}/parameters/roles/nginx/server.yaml`
|
||||
|
||||
- from the `telegraf` YAML files:
|
||||
|
||||
- `salt://defaults/roles/telegraf.yaml`
|
||||
|
||||
- `salt://{{ tplroot }}/parameters/roles/telegraf.yaml`
|
||||
|
||||
Each YAML file and the `defaults` parameters must conform to the
|
||||
following layout:
|
||||
|
||||
- a mandatory `values` key to store the configuration values
|
||||
|
||||
- two optional keys to configure the use of `salt.slsutil.merge`
|
||||
|
||||
- an optional `strategy` key to configure the merging
|
||||
strategy, for example `strategy: 'recurse'`, the default is
|
||||
`smart`
|
||||
|
||||
- an optional `merge_lists` key to configure if lists should
|
||||
be merged or overridden for the `recurse` and `overwrite`
|
||||
strategies, for example `merge_lists: 'true'`
|
||||
#}
|
||||
{%- set stack = defaults | default({"values": {} }, boolean=True) %}
|
||||
|
||||
{#- Build configuration file names based on matchers #}
|
||||
{%- set config_get_strategy = salt["config.get"](tplroot ~ ":strategy", None) %}
|
||||
{%- set matchers = parse_matchers(
|
||||
matchers,
|
||||
config_get_strategy=config_get_strategy,
|
||||
log_prefix=log_prefix
|
||||
)
|
||||
| load_yaml %}
|
||||
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "built-in configuration:\n"
|
||||
~ {"values": defaults | traverse("values")}
|
||||
| yaml(False)
|
||||
) %}
|
||||
|
||||
{%- for param_dir in dirs %}
|
||||
{%- for matcher in matchers %}
|
||||
{#- `slsutil.merge` options from #}
|
||||
{#- 1. the `value` #}
|
||||
{#- 2. the `defaults` #}
|
||||
{#- 3. the built-in #}
|
||||
{%- set strategy = matcher.value
|
||||
| traverse(
|
||||
"strategy",
|
||||
defaults
|
||||
| traverse(
|
||||
"strategy",
|
||||
"smart"
|
||||
)
|
||||
) %}
|
||||
{%- set merge_lists = matcher.value
|
||||
| traverse(
|
||||
"merge_lists",
|
||||
defaults
|
||||
| traverse(
|
||||
"merge_lists",
|
||||
False
|
||||
)
|
||||
)
|
||||
| to_bool %}
|
||||
|
||||
{%- if matcher.type in query_map.keys() %}
|
||||
{#- No value is an empty list, must be a dict for `stack.update` #}
|
||||
{%- set normalized_value = matcher.value | default({}, boolean=True) %}
|
||||
|
||||
{#- Merge in `mapdata.<query>` instead of directly in `mapdata` #}
|
||||
{%- set is_sub_key = matcher.option | default(False) == "SUB" %}
|
||||
{%- if is_sub_key %}
|
||||
{#- Merge values with `mapdata.<key>`, `<key>` and `<key>:lookup` are merged together #}
|
||||
{%- set value = { matcher.query | regex_replace(":lookup$", ""): normalized_value } %}
|
||||
{%- else %}
|
||||
{%- set value = normalized_value %}
|
||||
{%- endif %}
|
||||
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "merge "
|
||||
~ "sub key " * is_sub_key
|
||||
~ "'"
|
||||
~ matcher.query
|
||||
~ "' retrieved with '"
|
||||
~ matcher.query_method
|
||||
~ "', merge: strategy='"
|
||||
~ strategy
|
||||
~ "', lists='"
|
||||
~ merge_lists
|
||||
~ "':\n"
|
||||
~ value
|
||||
| yaml(False)
|
||||
) %}
|
||||
|
||||
{%- do stack.update(
|
||||
{
|
||||
"values": salt["slsutil.merge"](
|
||||
stack["values"],
|
||||
value,
|
||||
strategy=strategy,
|
||||
merge_lists=merge_lists,
|
||||
)
|
||||
}
|
||||
) %}
|
||||
|
||||
{%- else %}
|
||||
{#- Load YAML file matching the grain/pillar/... #}
|
||||
{#- Fallback to use the source name as a direct filename #}
|
||||
|
||||
{%- if matcher.value is sequence and matcher.value | length == 0 %}
|
||||
{#- Mangle `matcher.value` to use it as literal path #}
|
||||
{%- set query_parts = matcher.query.split("/") %}
|
||||
{%- set yaml_dirname = query_parts[0:-1] | join("/") %}
|
||||
{%- set yaml_names = query_parts[-1] %}
|
||||
{%- else %}
|
||||
{%- set yaml_dirname = matcher.query %}
|
||||
{%- set yaml_names = matcher.value %}
|
||||
{%- endif %}
|
||||
|
||||
{#- Some configuration return list #}
|
||||
{%- if yaml_names is string %}
|
||||
{%- set yaml_names = [yaml_names] %}
|
||||
{%- elif yaml_names is sequence %}
|
||||
{#- Convert to strings if it's a sequence of numbers #}
|
||||
{%- set yaml_names = yaml_names | map("string") | list %}
|
||||
{%- else %}
|
||||
{%- set yaml_names = [yaml_names | string] %}
|
||||
{%- endif %}
|
||||
|
||||
{#- Try to load a `.yaml.jinja` file for each `.yaml` file #}
|
||||
{%- set all_yaml_names = [] %}
|
||||
{%- for name in yaml_names %}
|
||||
{%- set extension = name.rpartition(".")[2] %}
|
||||
{%- if extension not in ["yaml", "jinja"] %}
|
||||
{%- do all_yaml_names.extend([name ~ ".yaml", name ~ ".yaml.jinja"]) %}
|
||||
{%- elif extension == "yaml" %}
|
||||
{%- do all_yaml_names.extend([name, name ~ ".jinja"]) %}
|
||||
{%- else %}
|
||||
{%- do all_yaml_names.append(name) %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
{#- `yaml_dirname` can be an empty string with literal path like `myconf.yaml` #}
|
||||
{%- set yaml_dir = [
|
||||
param_dir,
|
||||
yaml_dirname
|
||||
]
|
||||
| select
|
||||
| join("/") %}
|
||||
|
||||
{%- for yaml_name in all_yaml_names %}
|
||||
{%- set yaml_filename = [
|
||||
yaml_dir.rstrip("/"),
|
||||
yaml_name
|
||||
]
|
||||
| select
|
||||
| join("/") %}
|
||||
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "load configuration values from "
|
||||
~ yaml_filename
|
||||
) %}
|
||||
{%- load_yaml as yaml_values %}
|
||||
{%- include yaml_filename ignore missing %}
|
||||
{%- endload %}
|
||||
|
||||
{%- if yaml_values %}
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "loaded configuration values from "
|
||||
~ yaml_filename
|
||||
~ ":\n"
|
||||
~ yaml_values
|
||||
| yaml(False)
|
||||
) %}
|
||||
|
||||
{#- `slsutil.merge` options from #}
|
||||
{#- 1. the `value` #}
|
||||
{#- 2. the `defaults` #}
|
||||
{#- 3. the built-in #}
|
||||
{%- set strategy = yaml_values
|
||||
| traverse(
|
||||
"strategy",
|
||||
defaults
|
||||
| traverse(
|
||||
"strategy",
|
||||
"smart"
|
||||
)
|
||||
) %}
|
||||
{%- set merge_lists = yaml_values
|
||||
| traverse(
|
||||
"merge_lists",
|
||||
defaults
|
||||
| traverse(
|
||||
"merge_lists",
|
||||
False
|
||||
)
|
||||
)
|
||||
| to_bool %}
|
||||
{%- do stack.update(
|
||||
{
|
||||
"values": salt["slsutil.merge"](
|
||||
stack["values"],
|
||||
yaml_values
|
||||
| traverse("values", {}),
|
||||
strategy=strategy,
|
||||
merge_lists=merge_lists,
|
||||
)
|
||||
}
|
||||
) %}
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "merged configuration values from "
|
||||
~ yaml_filename
|
||||
~ ", merge: strategy='"
|
||||
~ strategy
|
||||
~ "', merge_lists='"
|
||||
~ merge_lists
|
||||
~ "':\n"
|
||||
~ {"values": stack["values"]}
|
||||
| yaml(False)
|
||||
) %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "final configuration values:\n"
|
||||
~ {"values": stack["values"]}
|
||||
| yaml(False)
|
||||
) %}
|
||||
|
||||
{#- Output stack as YAML, caller should use with something like #}
|
||||
{#- `{%- set config = mapstack(matchers=["foo"]) | load_yaml %}` #}
|
||||
{{ stack | yaml }}
|
||||
|
||||
{%- endmacro %}
|
||||
222
gitea/libmatchers.jinja
Normal file
222
gitea/libmatchers.jinja
Normal file
@@ -0,0 +1,222 @@
|
||||
{#- -*- coding: utf-8 -*- #}
|
||||
{#- vim: ft=jinja #}
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split("/")[0] %}
|
||||
{%- from tplroot ~ "/libsaltcli.jinja" import cli with context %}
|
||||
|
||||
{%- set query_map = {
|
||||
"C": "config.get",
|
||||
"G": "grains.get",
|
||||
"I": "pillar.get",
|
||||
} %}
|
||||
|
||||
{#- When no part before `@` is provided: #}
|
||||
{#- - define a YAML file path, noted `Y` #}
|
||||
{#- - use `salt["config.get"]`, noted `C` #}
|
||||
{#- - use colon `:` delimiter for querying #}
|
||||
{%- set _defaults = {
|
||||
"type": "Y",
|
||||
"query_type": "C",
|
||||
"query_delimiter": ":"
|
||||
} %}
|
||||
|
||||
{%- macro parse_matchers(
|
||||
matchers,
|
||||
config_get_strategy=None,
|
||||
log_prefix="libmatchers: "
|
||||
) %}
|
||||
{#- matcher format is `[<TYPE>[:<OPTION>[:DELIMITER]]@]<KEY>` #}
|
||||
{#- each matcher has a type: #}
|
||||
{#- - `Y` to build a YAML file name (the default when no type is set) #}
|
||||
{#- - `C` to lookup values with `config.get` #}
|
||||
{#- - `G` to lookup values with `grains.get` #}
|
||||
{#- - `I` to lookup values with `pillar.get` #}
|
||||
{#- The `YAML` type option can define query type to build the file name: #}
|
||||
{#- - `C` for query with `config.get` (the default when to query type is set) #}
|
||||
{#- - `G` for query with `grains.get` #}
|
||||
{#- - `I` for query with `pillar.get` #}
|
||||
{#- With `DELIMITER`, you can choose a different delimiter when doing queries #}
|
||||
{%- set parsed_matchers = [] %}
|
||||
{%- for matcher in matchers %}
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "process matcher: '"
|
||||
~ matcher
|
||||
~ "'"
|
||||
) %}
|
||||
|
||||
{%- set parsed = {} %}
|
||||
{%- set matcher_parts = matcher.split('@') %}
|
||||
{%- if matcher_parts | length == 1 %}
|
||||
{#- By default we load YAML files for config looked up by `config.get` #}
|
||||
{%- do parsed.update(
|
||||
{
|
||||
"type": _defaults["type"],
|
||||
"option": None,
|
||||
"query_method": query_map[_defaults["query_type"]],
|
||||
"query_delimiter": _defaults["query_delimiter"],
|
||||
"query": matcher
|
||||
}
|
||||
) %}
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "use built-in defaults for matcher:\n"
|
||||
~ parsed
|
||||
| yaml(False)
|
||||
| indent(4, True)
|
||||
) %}
|
||||
{%- else %}
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "parse matcher: '"
|
||||
~ matcher
|
||||
~ "'"
|
||||
) %}
|
||||
{%- set metadatas = matcher_parts[0].split(":") %}
|
||||
{%- do parsed.update(
|
||||
{
|
||||
"query": matcher_parts[1]
|
||||
}
|
||||
) %}
|
||||
{%- if metadatas | length == 1 %}
|
||||
{%- do parsed.update(
|
||||
{
|
||||
"type": metadatas[0],
|
||||
"option": "C",
|
||||
"query_delimiter": ":"
|
||||
}
|
||||
) %}
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "parse as 1 metadata matcher:\n"
|
||||
~ parsed
|
||||
| yaml(False)
|
||||
| indent(4, True)
|
||||
) %}
|
||||
{%- elif metadatas | length == 2 %}
|
||||
{%- do parsed.update(
|
||||
{
|
||||
"type": metadatas[0],
|
||||
"option": metadatas[1],
|
||||
"query_delimiter": ":"
|
||||
}
|
||||
) %}
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "parse as 2 metadata matcher:\n"
|
||||
~ parsed
|
||||
| yaml(False)
|
||||
| indent(4, True)
|
||||
) %}
|
||||
{%- elif metadatas | length == 3 %}
|
||||
{%- do parsed.update(
|
||||
{
|
||||
"type": metadatas[0],
|
||||
"option": metadatas[1],
|
||||
"query_delimiter": metadatas[2] | default(":", boolean=True)
|
||||
}
|
||||
) %}
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "parse as 3 metadata matcher:\n"
|
||||
~ parsed
|
||||
| yaml(False)
|
||||
| indent(4, True)
|
||||
) %}
|
||||
{%- elif metadatas | length == 4 %}
|
||||
{#- The delimiter is `:` #}
|
||||
{%- do parsed.update(
|
||||
{
|
||||
"type": metadatas[0],
|
||||
"option": metadatas[1],
|
||||
"query_delimiter": ":"
|
||||
}
|
||||
) %}
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "parse as 4 metadata matcher:\n"
|
||||
~ parsed
|
||||
| yaml(False)
|
||||
| indent(4, True)
|
||||
) %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
||||
{#- The `<OPTION>` has different meaning based on type #}
|
||||
{%- if query_map.get(parsed.type, False) %}
|
||||
{%- do parsed.update(
|
||||
{
|
||||
"query_method": query_map[parsed.type]
|
||||
}
|
||||
) %}
|
||||
{%- else %}
|
||||
{%- do parsed.update(
|
||||
{
|
||||
"query_method": query_map[
|
||||
parsed.option
|
||||
| default("C", boolean=True)
|
||||
]
|
||||
}
|
||||
) %}
|
||||
{%- endif %}
|
||||
|
||||
{#- Add `merge:` option to `salt["config.get"]` if configured #}
|
||||
{%- if cli not in ["ssh", "unknown"] and parsed.query_method == "config.get" and config_get_strategy %}
|
||||
{%- set query_opts = {
|
||||
"merge": config_get_strategy,
|
||||
"delimiter": parsed.query_delimiter,
|
||||
} %}
|
||||
{%- set query_opts_msg = (
|
||||
", delimiter='"
|
||||
~ parsed.query_delimiter
|
||||
~ "', merge: strategy='"
|
||||
~ config_get_strategy
|
||||
~ "'"
|
||||
) %}
|
||||
{%- else %}
|
||||
{%- if cli in ["ssh", "unknown"] %}
|
||||
{%- do salt["log.warning"](
|
||||
log_prefix
|
||||
~ "the 'delimiter' and 'merge' options of 'config.get' are skipped when the salt command type is '"
|
||||
~ cli
|
||||
~ "'"
|
||||
) %}
|
||||
{%- endif %}
|
||||
{%- set query_opts = {} %}
|
||||
{%- set query_opts_msg = "" %}
|
||||
{%- endif %}
|
||||
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "lookup '"
|
||||
~ parsed.query
|
||||
~ "' with '"
|
||||
~ parsed.query_method
|
||||
~ "'"
|
||||
~ query_opts_msg
|
||||
) %}
|
||||
{%- set values = salt[parsed.query_method](
|
||||
parsed.query,
|
||||
default=[],
|
||||
**query_opts
|
||||
) %}
|
||||
{%- do parsed.update(
|
||||
{
|
||||
"value": values
|
||||
}
|
||||
) %}
|
||||
|
||||
{%- do parsed_matchers.append(parsed) %}
|
||||
|
||||
{%- endfor %}
|
||||
{%- do salt["log.debug"](
|
||||
log_prefix
|
||||
~ "parsed matchers:\n"
|
||||
~ parsed_matchers
|
||||
| yaml(False)
|
||||
| indent(4, True)
|
||||
) %}
|
||||
|
||||
{{ parsed_matchers | yaml }}
|
||||
{%- endmacro %}
|
||||
18
gitea/libsaltcli.jinja
Normal file
18
gitea/libsaltcli.jinja
Normal file
@@ -0,0 +1,18 @@
|
||||
{#- -*- coding: utf-8 -*- #}
|
||||
{#- vim: ft=jinja #}
|
||||
|
||||
{#- Get the relevant values from the `opts` dict #}
|
||||
{%- set opts_cli = opts.get('__cli', '') %}
|
||||
{%- set opts_masteropts_cli = opts | traverse('__master_opts__:__cli', '') %}
|
||||
|
||||
{#- Determine the type of salt command being run #}
|
||||
{%- if opts_cli == 'salt-minion' %}
|
||||
{%- set cli = 'minion' %}
|
||||
{%- elif opts_cli == 'salt-call' %}
|
||||
{%- set cli = 'ssh' if opts_masteropts_cli in ('salt-ssh', 'salt-master') else 'local' %}
|
||||
{%- elif opts_cli %}
|
||||
{%- set cli = 'api' %}
|
||||
{%- else %}
|
||||
{%- set cli = 'unknown' %}
|
||||
{%- endif %}
|
||||
{%- do salt['log.debug']('[libsaltcli] the salt command type has been identified to be: ' ~ cli) %}
|
||||
115
gitea/libtofs.jinja
Normal file
115
gitea/libtofs.jinja
Normal file
@@ -0,0 +1,115 @@
|
||||
{%- macro files_switch(
|
||||
source_files,
|
||||
lookup=None,
|
||||
default_files_switch=["id", "os_family"],
|
||||
indent_width=6,
|
||||
use_subpath=False
|
||||
) %}
|
||||
{#-
|
||||
Returns a valid value for the "source" parameter of a "file.managed"
|
||||
state function. This makes easier the usage of the Template Override and
|
||||
Files Switch (TOFS) pattern.
|
||||
Params:
|
||||
* source_files: ordered list of files to look for
|
||||
* lookup: key under "<tplroot>:tofs:source_files" to prepend to the
|
||||
list of source files
|
||||
* default_files_switch: if there's no config (e.g. pillar)
|
||||
"<tplroot>:tofs:files_switch" this is the ordered list of grains to
|
||||
use as selector switch of the directories under
|
||||
"<path_prefix>/files"
|
||||
* indent_width: indentation of the result value to conform to YAML
|
||||
* use_subpath: defaults to `False` but if set, lookup the source file
|
||||
recursively from the current state directory up to `tplroot`
|
||||
Example (based on a `tplroot` of `xxx`):
|
||||
If we have a state:
|
||||
Deploy configuration:
|
||||
file.managed:
|
||||
- name: /etc/yyy/zzz.conf
|
||||
- source: {{ files_switch(
|
||||
["/etc/yyy/zzz.conf", "/etc/yyy/zzz.conf.jinja"],
|
||||
lookup="Deploy configuration",
|
||||
) }}
|
||||
- template: jinja
|
||||
In a minion with id=theminion and os_family=RedHat, it's going to be
|
||||
rendered as:
|
||||
Deploy configuration:
|
||||
file.managed:
|
||||
- name: /etc/yyy/zzz.conf
|
||||
- source:
|
||||
- salt://xxx/files/theminion/etc/yyy/zzz.conf
|
||||
- salt://xxx/files/theminion/etc/yyy/zzz.conf.jinja
|
||||
- salt://xxx/files/RedHat/etc/yyy/zzz.conf
|
||||
- salt://xxx/files/RedHat/etc/yyy/zzz.conf.jinja
|
||||
- salt://xxx/files/default/etc/yyy/zzz.conf
|
||||
- salt://xxx/files/default/etc/yyy/zzz.conf.jinja
|
||||
- template: jinja
|
||||
#}
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split("/")[0] %}
|
||||
{%- set path_prefix = salt["config.get"](tplroot ~ ":tofs:path_prefix", tplroot) %}
|
||||
{%- set files_dir = salt["config.get"](tplroot ~ ":tofs:dirs:files", "files") %}
|
||||
{%- set files_switch_list = salt["config.get"](
|
||||
tplroot ~ ":tofs:files_switch", default_files_switch
|
||||
) %}
|
||||
{#- Lookup source_files (v2), files (v1), or fallback to an empty list #}
|
||||
{%- set src_files = salt["config.get"](
|
||||
tplroot ~ ":tofs:source_files:" ~ lookup,
|
||||
salt["config.get"](tplroot ~ ":tofs:files:" ~ lookup, []),
|
||||
) %}
|
||||
{#- Append the default source_files #}
|
||||
{%- set src_files = src_files + source_files %}
|
||||
{#- Only add to [""] when supporting older TOFS implementations #}
|
||||
{%- set path_prefix_exts = [""] %}
|
||||
{%- if use_subpath and tplroot != tpldir %}
|
||||
{#- Walk directory tree to find {{ files_dir }} #}
|
||||
{%- set subpath_parts = tpldir.lstrip(tplroot).lstrip("/").split("/") %}
|
||||
{%- for path in subpath_parts %}
|
||||
{%- set subpath = subpath_parts[0 : loop.index] | join("/") %}
|
||||
{%- do path_prefix_exts.append("/" ~ subpath) %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- for path_prefix_ext in path_prefix_exts | reverse %}
|
||||
{%- set path_prefix_inc_ext = path_prefix ~ path_prefix_ext %}
|
||||
{#- For older TOFS implementation, use `files_switch` from the config #}
|
||||
{#- Use the default, new method otherwise #}
|
||||
{%- set fsl = salt["config.get"](
|
||||
tplroot ~ path_prefix_ext | replace("/", ":") ~ ":files_switch",
|
||||
files_switch_list,
|
||||
) %}
|
||||
{#- Append an empty value to evaluate as `default` in the loop below #}
|
||||
{%- if "" not in fsl %}
|
||||
{%- set fsl = fsl + [""] %}
|
||||
{%- endif %}
|
||||
{%- for fs in fsl %}
|
||||
{%- for src_file in src_files %}
|
||||
{%- if fs %}
|
||||
{%- set fs_dirs = salt["config.get"](fs, fs) %}
|
||||
{%- else %}
|
||||
{%- set fs_dirs = salt["config.get"](
|
||||
tplroot ~ ":tofs:dirs:default", "default"
|
||||
) %}
|
||||
{%- endif %}
|
||||
{#- Force the `config.get` lookup result as a list where necessary #}
|
||||
{#- since we need to also handle grains that are lists #}
|
||||
{%- if fs_dirs is string %}
|
||||
{%- set fs_dirs = [fs_dirs] %}
|
||||
{%- endif %}
|
||||
{%- for fs_dir in fs_dirs %}
|
||||
{#- strip empty elements by using a select #}
|
||||
{%- set url = (
|
||||
[
|
||||
"- salt:/",
|
||||
path_prefix_inc_ext.strip("/"),
|
||||
files_dir.strip("/"),
|
||||
fs_dir.strip("/"),
|
||||
src_file.strip("/"),
|
||||
]
|
||||
| select
|
||||
| join("/")
|
||||
) %}
|
||||
{{ url | indent(indent_width, true) }}
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
{%- endmacro %}
|
||||
66
gitea/map.jinja
Normal file
66
gitea/map.jinja
Normal file
@@ -0,0 +1,66 @@
|
||||
{#- -*- coding: utf-8 -*- #}
|
||||
{#- vim: ft=jinja #}
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split("/")[0] %}
|
||||
{%- from tplroot ~ "/libmapstack.jinja" import mapstack with context %}
|
||||
|
||||
{#- Where to lookup parameters source files #}
|
||||
{%- set formula_param_dir = tplroot ~ "/parameters" %}
|
||||
|
||||
{#- List of sources to lookup for parameters #}
|
||||
{#- Fallback to previously used grains plus minion `id` #}
|
||||
{%- set map_sources = [
|
||||
"Y:G@osarch",
|
||||
"Y:G@os_family",
|
||||
"Y:G@os",
|
||||
"Y:G@osfinger",
|
||||
"C@" ~ tplroot ~ ":lookup",
|
||||
"C@" ~ tplroot,
|
||||
"Y:G@id",
|
||||
] %}
|
||||
|
||||
{%- set _map_settings = mapstack(
|
||||
matchers=["map_jinja.yaml"],
|
||||
defaults={
|
||||
"values": {"sources": map_sources}
|
||||
},
|
||||
log_prefix="map.jinja configuration: ",
|
||||
)
|
||||
| load_yaml %}
|
||||
|
||||
{%- set map_sources = _map_settings | traverse("values:sources") %}
|
||||
{%- do salt["log.debug"](
|
||||
"map.jinja: load parameters from sources:\n"
|
||||
~ map_sources
|
||||
| yaml(False)
|
||||
) %}
|
||||
|
||||
{#- Load formula parameters values #}
|
||||
{%- set _formula_matchers = ["defaults.yaml"] + map_sources %}
|
||||
|
||||
{%- set _formula_settings = mapstack(
|
||||
matchers=_formula_matchers,
|
||||
dirs=[formula_param_dir],
|
||||
defaults={
|
||||
"values": {},
|
||||
"merge_strategy": salt["config.get"](tplroot ~ ":strategy", None),
|
||||
"merge_lists": salt["config.get"](tplroot ~ ":merge_lists", False),
|
||||
},
|
||||
log_prefix="map.jinja: ",
|
||||
)
|
||||
| load_yaml %}
|
||||
|
||||
{#- Make sure to track `map.jinja` configuration with `_mapdata` #}
|
||||
{%- do _formula_settings["values"].update(
|
||||
{
|
||||
"map_jinja": _map_settings["values"]
|
||||
}
|
||||
) %}
|
||||
|
||||
{%- do salt["log.debug"]("map.jinja: save parameters in variable 'mapdata'") %}
|
||||
{%- set mapdata = _formula_settings["values"] %}
|
||||
|
||||
{#- Per formula post-processing of `mapdata` if it exists #}
|
||||
{%- do salt["log.debug"]("map.jinja: post-processing of 'mapdata'") %}
|
||||
{%- include tplroot ~ "/post-map.jinja" ignore missing %}
|
||||
33
gitea/package/clean.sls
Normal file
33
gitea/package/clean.sls
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- set sls_config_clean = tplroot ~ '.config.clean' %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as gitea with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_config_clean }}
|
||||
|
||||
# This does not delete the working/data dirs to prevent accidental loss.
|
||||
Gitea package files are absent:
|
||||
file.absent:
|
||||
- names:
|
||||
- {{ gitea.lookup.service.unit.format(name=gitea.lookup.service.name) }}
|
||||
- {{ gitea.lookup.paths.bin | path_join('gitea') }}
|
||||
{%- for p in ['conf', 'custom', 'log'] %}
|
||||
- {{ gitea.lookup.paths[p] }}
|
||||
{%- endfor %}
|
||||
# to make sure this can be installed again (onchanges req in package.installed)
|
||||
- /tmp/gitea-{{ gitea.version }}
|
||||
- require:
|
||||
- sls: {{ sls_config_clean }}
|
||||
|
||||
Gitea user/group are absent:
|
||||
user.absent:
|
||||
- name: {{ gitea.lookup.user }}
|
||||
- require:
|
||||
- sls: {{ sls_config_clean }}
|
||||
group.absent:
|
||||
- name: {{ gitea.lookup.group }}
|
||||
- require:
|
||||
- sls: {{ sls_config_clean }}
|
||||
5
gitea/package/init.sls
Normal file
5
gitea/package/init.sls
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .install
|
||||
148
gitea/package/install.sls
Normal file
148
gitea/package/install.sls
Normal file
@@ -0,0 +1,148 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as gitea with context %}
|
||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||
|
||||
Gitea user/group is present:
|
||||
user.present:
|
||||
- name: {{ gitea.lookup.user }}
|
||||
- home: {{ gitea.lookup.paths.home }}
|
||||
- createhome: true # does not work on Windows/MacOS
|
||||
- shell: {{ gitea.lookup.shell }}
|
||||
- empty_password: true
|
||||
- fullname: Git Version Control
|
||||
- system: true
|
||||
- usergroup: {{ gitea.lookup.group == gitea.lookup.user }}
|
||||
{%- if gitea.lookup.group != gitea.lookup.user %}
|
||||
- gid: {{ gitea.lookup.group }}
|
||||
- require:
|
||||
- group: {{ gitea.lookup.group }}
|
||||
group.present:
|
||||
- name: {{ gitea.lookup.group }}
|
||||
- system: true
|
||||
{%- endif %}
|
||||
|
||||
Requirements for managing Gitea are fulfilled:
|
||||
pkg.installed:
|
||||
- pkgs: {{ gitea.lookup.requirements | json }}
|
||||
# needed to avoid exception when running gpg.get_key in unless below
|
||||
cmd.run:
|
||||
- name: gpg --list-keys
|
||||
- unless:
|
||||
- test -d "${GNUPG_HOME:-$HOME/.gnupg}"
|
||||
# the above does not work somehow
|
||||
- test -d /root/.gnupg
|
||||
|
||||
Gitea is available:
|
||||
file.managed:
|
||||
- names:
|
||||
- /tmp/gitea-{{ gitea.version }}:
|
||||
- source: {{ gitea.lookup.pkg.source.format(version=gitea.version, arch=gitea.lookup.arch) }}
|
||||
- source_hash: {{ gitea.lookup.pkg.source_hash.format(version=gitea.version, arch=gitea.lookup.arch) }}
|
||||
- /tmp/gitea-{{ gitea.version }}.asc:
|
||||
- source: {{ gitea.lookup.pkg.sig.format(version=gitea.version, arch=gitea.lookup.arch) }}
|
||||
- skip_verify: true
|
||||
- user: {{ gitea.lookup.user }}
|
||||
- group: {{ gitea.lookup.group }}
|
||||
|
||||
Gitea GPG key is present (received from keyserver):
|
||||
gpg.present:
|
||||
- name: {{ gitea.lookup.gpg.key }}
|
||||
- keyserver: {{ gitea.lookup.gpg.keyserver }}
|
||||
|
||||
Gitea GPG key is present (fallback):
|
||||
file.managed:
|
||||
- name: /tmp/gitea-key.asc
|
||||
- source: salt://gitea/files/default/key.asc
|
||||
- onfail:
|
||||
- Gitea GPG key is present (received from keyserver)
|
||||
module.run:
|
||||
- gpg.import_key:
|
||||
- filename: /tmp/gitea-key.asc
|
||||
- onfail:
|
||||
- Gitea GPG key is present (received from keyserver)
|
||||
- require:
|
||||
- file: /tmp/gitea-key.asc
|
||||
|
||||
Gitea is verified:
|
||||
module.run:
|
||||
- gpg.verify:
|
||||
- filename: /tmp/gitea-{{ gitea.version }}
|
||||
- signature: /tmp/gitea-{{ gitea.version }}.asc
|
||||
- require:
|
||||
- Gitea is available
|
||||
- require_any:
|
||||
- Gitea GPG key is present (received from keyserver)
|
||||
- Gitea GPG key is present (fallback)
|
||||
|
||||
Gitea binary is absent if verification failed:
|
||||
file.absent:
|
||||
- name: /tmp/gitea-{{ gitea.version }}
|
||||
- onfail:
|
||||
- Gitea is verified
|
||||
|
||||
Gitea directories are setup:
|
||||
file.directory:
|
||||
- names:
|
||||
{%- for p in ['conf', 'work', 'custom', 'data', 'log', 'repos'] %}
|
||||
- {{ gitea.lookup.paths[p] }}
|
||||
{%- endfor %}
|
||||
- makedirs: true
|
||||
- user: {{ gitea.lookup.user }}
|
||||
- group: {{ gitea.lookup.group }}
|
||||
# This prevents the web-installer from functioning, would need 0770 on /etc/gitea.
|
||||
- mode: '0750'
|
||||
|
||||
Gitea binary is installed:
|
||||
file.copy:
|
||||
- name: {{ gitea.lookup.paths.bin | path_join('gitea') }}
|
||||
- source: /tmp/gitea-{{ gitea.version }}
|
||||
# in case the version changed, overwrite previous binary
|
||||
- force: true
|
||||
- makedirs: true
|
||||
- user: {{ gitea.lookup.user }}
|
||||
- group: {{ gitea.lookup.group }}
|
||||
- mode: '0755'
|
||||
# only run if a new version was downloaded
|
||||
- onchanges:
|
||||
- Gitea is available
|
||||
- require:
|
||||
- Gitea is verified
|
||||
|
||||
Gitea service unit is available:
|
||||
file.managed:
|
||||
- name: {{ gitea.lookup.service.unit.format(name=gitea.lookup.service.name) }}
|
||||
- source: {{ files_switch(
|
||||
['gitea.service.j2'],
|
||||
lookup='Gitea service unit is available',
|
||||
) }}
|
||||
- template: jinja
|
||||
- mode: '0644'
|
||||
- user: root
|
||||
- group: {{ gitea.lookup.rootgroup }}
|
||||
- makedirs: true
|
||||
- context: {{ {'gitea': gitea} | json }}
|
||||
- require:
|
||||
- Gitea binary is installed
|
||||
{%- if 'systemctl' | which %}
|
||||
# this executes systemctl daemon-reload
|
||||
module.run:
|
||||
- service.systemctl_reload: []
|
||||
- onchanges:
|
||||
- file: {{ gitea.lookup.service.unit.format(name=gitea.lookup.service.name) }}
|
||||
{%- endif %}
|
||||
|
||||
Gitea setup is finished:
|
||||
test.show_notification:
|
||||
- text: >-
|
||||
Yay, Gitea setup is finished.
|
||||
The web installer will not work, so make sure you have specified
|
||||
at least the database configuration. The configuration will be installed
|
||||
after this message.
|
||||
- require:
|
||||
- Gitea user/group is present
|
||||
- Requirements for managing Gitea are fulfilled
|
||||
- Gitea directories are setup
|
||||
- Gitea binary is installed
|
||||
70
gitea/parameters/defaults.yaml
Normal file
70
gitea/parameters/defaults.yaml
Normal file
@@ -0,0 +1,70 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set default values.
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
rootgroup: root
|
||||
service:
|
||||
name: gitea
|
||||
unit: /etc/systemd/system/{name}.service
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256 # yamllint disable-line rule:line-length
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
# Just here for testing
|
||||
added_in_defaults: defaults_value
|
||||
winner: defaults
|
||||
...
|
||||
15
gitea/parameters/map_jinja.yaml
Normal file
15
gitea/parameters/map_jinja.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set mapstack sources.
|
||||
---
|
||||
values:
|
||||
sources:
|
||||
- "Y:G@osarch"
|
||||
- "Y:G@os_family"
|
||||
- "Y:G@os"
|
||||
- "Y:G@osfinger"
|
||||
- "C@tool_global"
|
||||
- "C@{{ tplroot }}"
|
||||
- "Y:G@id"
|
||||
...
|
||||
0
gitea/parameters/os/.gitkeep
Normal file
0
gitea/parameters/os/.gitkeep
Normal file
17
gitea/parameters/os_family/Arch.yaml
Normal file
17
gitea/parameters/os_family/Arch.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('os_family') == Arch.
|
||||
#
|
||||
# You just need to add the key:values for this `os_family` that differ
|
||||
# from `defaults.yaml` + `<osarch>.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `os_family` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
pkg_manager: pacman
|
||||
...
|
||||
21
gitea/parameters/os_family/Debian.yaml
Normal file
21
gitea/parameters/os_family/Debian.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('os_family') == Debian.
|
||||
#
|
||||
# You just need to add the key:values for this `os_family` that differ
|
||||
# from `defaults.yaml` + `<osarch>.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `os_family` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
pkg_manager: apt
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python3-gnupg
|
||||
...
|
||||
18
gitea/parameters/os_family/FreeBSD.yaml
Normal file
18
gitea/parameters/os_family/FreeBSD.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('os_family') == FreeBSD.
|
||||
#
|
||||
# You just need to add the key:values for this `os_family` that differ
|
||||
# from `defaults.yaml` + `<osarch>.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `os_family` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
pkg_manager: pkg
|
||||
rootgroup: wheel
|
||||
...
|
||||
17
gitea/parameters/os_family/Gentoo.yaml
Normal file
17
gitea/parameters/os_family/Gentoo.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('os_family') == Gentoo.
|
||||
#
|
||||
# You just need to add the key:values for this `os_family` that differ
|
||||
# from `defaults.yaml` + `<osarch>.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `os_family` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
pkg_manager: portage
|
||||
...
|
||||
18
gitea/parameters/os_family/MacOS.yaml
Normal file
18
gitea/parameters/os_family/MacOS.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('os_family') == MacOS.
|
||||
#
|
||||
# You just need to add the key:values for this `os_family` that differ
|
||||
# from `defaults.yaml` + `<osarch>.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `os_family` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
pkg_manager: brew
|
||||
rootgroup: wheel
|
||||
...
|
||||
18
gitea/parameters/os_family/OpenBSD.yaml
Normal file
18
gitea/parameters/os_family/OpenBSD.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('os_family') == OpenBSD.
|
||||
#
|
||||
# You just need to add the key:values for this `os_family` that differ
|
||||
# from `defaults.yaml` + `<osarch>.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `os_family` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
pkg_manager: pkg
|
||||
rootgroup: wheel
|
||||
...
|
||||
17
gitea/parameters/os_family/RedHat.yaml
Normal file
17
gitea/parameters/os_family/RedHat.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('os_family') == RedHat.
|
||||
#
|
||||
# You just need to add the key:values for this `os_family` that differ
|
||||
# from `defaults.yaml` + `<osarch>.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `os_family` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
pkg_manager: yum
|
||||
...
|
||||
17
gitea/parameters/os_family/Suse.yaml
Normal file
17
gitea/parameters/os_family/Suse.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('os_family') == Suse.
|
||||
#
|
||||
# You just need to add the key:values for this `os_family` that differ
|
||||
# from `defaults.yaml` + `<osarch>.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `os_family` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
pkg_manager: zypper
|
||||
...
|
||||
17
gitea/parameters/osarch/386.yaml
Normal file
17
gitea/parameters/osarch/386.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('osarch') == 386.
|
||||
#
|
||||
# You just need to add the key:values for this `osarch` that differ
|
||||
# from `defaults.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `osarch` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
arch: '386'
|
||||
...
|
||||
17
gitea/parameters/osarch/amd64.yaml
Normal file
17
gitea/parameters/osarch/amd64.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('osarch') == amd64.
|
||||
#
|
||||
# You just need to add the key:values for this `osarch` that differ
|
||||
# from `defaults.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `osarch` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
arch: amd64
|
||||
...
|
||||
17
gitea/parameters/osarch/arm64.yaml
Normal file
17
gitea/parameters/osarch/arm64.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('osarch') == arm64.
|
||||
#
|
||||
# You just need to add the key:values for this `osarch` that differ
|
||||
# from `defaults.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `osarch` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
arch: arm64
|
||||
...
|
||||
17
gitea/parameters/osarch/armv6l.yaml
Normal file
17
gitea/parameters/osarch/armv6l.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('osarch') == armv6l.
|
||||
#
|
||||
# You just need to add the key:values for this `osarch` that differ
|
||||
# from `defaults.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `osarch` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
arch: armv6l
|
||||
...
|
||||
17
gitea/parameters/osarch/armv7l.yaml
Normal file
17
gitea/parameters/osarch/armv7l.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('osarch') == armv7l.
|
||||
#
|
||||
# You just need to add the key:values for this `osarch` that differ
|
||||
# from `defaults.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `osarch` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
arch: armv7l
|
||||
...
|
||||
17
gitea/parameters/osarch/ppc64le.yaml
Normal file
17
gitea/parameters/osarch/ppc64le.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('osarch') == ppc64le.
|
||||
#
|
||||
# You just need to add the key:values for this `osarch` that differ
|
||||
# from `defaults.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `osarch` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
arch: ppc64le
|
||||
...
|
||||
17
gitea/parameters/osarch/s390x.yaml
Normal file
17
gitea/parameters/osarch/s390x.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('osarch') == s390x.
|
||||
#
|
||||
# You just need to add the key:values for this `osarch` that differ
|
||||
# from `defaults.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `osarch` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
arch: s390x
|
||||
...
|
||||
17
gitea/parameters/osarch/x86_64.yaml
Normal file
17
gitea/parameters/osarch/x86_64.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('osarch') == x86_64.
|
||||
#
|
||||
# You just need to add the key:values for this `osarch` that differ
|
||||
# from `defaults.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `osarch` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
lookup:
|
||||
arch: amd64
|
||||
...
|
||||
0
gitea/parameters/osfinger/.gitkeep
Normal file
0
gitea/parameters/osfinger/.gitkeep
Normal file
65
gitea/post-map.jinja
Normal file
65
gitea/post-map.jinja
Normal file
@@ -0,0 +1,65 @@
|
||||
{#- -*- coding: utf-8 -*- #}
|
||||
{#- vim: ft=jinja #}
|
||||
|
||||
{#- If latest was specified, query the official download server for the latest version. -#}
|
||||
|
||||
{%- if 'latest' == mapdata.version -%}
|
||||
{%- set latest = salt['http.query'](
|
||||
mapdata.lookup.pkg.latest,
|
||||
decode=True, decode_type='json'
|
||||
)['dict']['latest']['version']
|
||||
-%}
|
||||
{%- do mapdata.update({'version': latest}) -%}
|
||||
{%- endif -%}
|
||||
|
||||
|
||||
{#-
|
||||
If paths are different than default, they need to be specified in the config.
|
||||
CUSTOM_PATH and WORKDIR are environment variables.
|
||||
I'm not sure about `log` tbh. Per the official docs, the default is empty.
|
||||
This might cause duplicate entries if the user did not specify in all-lowercase.
|
||||
Also, it will not overwrite custom configuration, which might make the installation fail.
|
||||
-#}
|
||||
|
||||
{%- for path in [
|
||||
('app_data_path', 'server', mapdata.lookup.paths.data, mapdata.lookup.paths.work | path_join('data')),
|
||||
('root_path', 'log', mapdata.lookup.paths.log, mapdata.lookup.paths.work | path_join('log')),
|
||||
('root', 'repository', mapdata.lookup.paths.repos, mapdata.lookup.paths.data | path_join('gitea-repositories')),
|
||||
] -%}
|
||||
{%- set var, topic, current, default = path -%}
|
||||
{%- if current != default -%}
|
||||
{%- do mapdata | update_dict_key_value('config:' ~ topic, {var: current}) -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
|
||||
{#-
|
||||
If the secrets were not provided, get them from a grain/generate and save them there.
|
||||
This avoids
|
||||
a) calling the gitea binary in the app.ini template (`gitea generate secret SECRET_KEY`)
|
||||
b) and special-casing to avoid regenerating those secrets every run.
|
||||
|
||||
The INTERNAL_TOKEN has a special format, but it can be configured to be read from a separate file.
|
||||
-#}
|
||||
|
||||
{%- if not mapdata.secrets.secret_key -%}
|
||||
{%- set secret_key = salt['grains.get_or_set_hash'](
|
||||
'gitea_secret_key',
|
||||
length=64,
|
||||
chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
|
||||
)
|
||||
-%}
|
||||
{%- do mapdata.secrets.update({'secret_key': secret_key}) -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- for jwt in ['jwt_secret', 'lfs_jwt_secret'] -%}
|
||||
{%- if not mapdata.secrets[jwt] -%}
|
||||
{%- set secret = salt['grains.get_or_set_hash'](
|
||||
'gitea_' ~ jwt ,
|
||||
length=43,
|
||||
chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-',
|
||||
)
|
||||
-%}
|
||||
{%- do mapdata.secrets.update({jwt: secret}) -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
10
gitea/service/clean.sls
Normal file
10
gitea/service/clean.sls
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as gitea with context %}
|
||||
|
||||
gitea-service-clean-service-dead:
|
||||
service.dead:
|
||||
- name: {{ gitea.lookup.service.name }}
|
||||
- enable: False
|
||||
5
gitea/service/init.sls
Normal file
5
gitea/service/init.sls
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .running
|
||||
16
gitea/service/running.sls
Normal file
16
gitea/service/running.sls
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- set sls_config_file = tplroot ~ '.config.file' %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as gitea with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_config_file }}
|
||||
|
||||
gitea-service-running-service-running:
|
||||
service.running:
|
||||
- name: {{ gitea.lookup.service.name }}
|
||||
- enable: True
|
||||
- watch:
|
||||
- sls: {{ sls_config_file }}
|
||||
305
kitchen.yml
Normal file
305
kitchen.yml
Normal file
@@ -0,0 +1,305 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
# For help on this file's format, see https://kitchen.ci/
|
||||
driver:
|
||||
name: docker
|
||||
use_sudo: false
|
||||
privileged: true
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
|
||||
provisioner:
|
||||
name: salt_solo
|
||||
log_level: debug
|
||||
salt_install: none
|
||||
require_chef: false
|
||||
formula: gitea
|
||||
salt_copy_filter:
|
||||
- .kitchen
|
||||
- .git
|
||||
pillars_from_directories:
|
||||
- test/salt/pillar
|
||||
|
||||
platforms:
|
||||
## SALT `tiamat`
|
||||
- name: debian-11-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:debian-11
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: debian-10-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:debian-10
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: debian-9-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:debian-9
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-2004-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:ubuntu-20.04
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-1804-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:ubuntu-18.04
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: centos-stream8-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:centos-stream8
|
||||
- name: centos-7-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:centos-7
|
||||
- name: amazonlinux-2-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:amazonlinux-2
|
||||
- name: oraclelinux-8-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:oraclelinux-8
|
||||
- name: oraclelinux-7-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:oraclelinux-7
|
||||
- name: almalinux-8-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:almalinux-8
|
||||
- name: rockylinux-8-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:rockylinux-8
|
||||
|
||||
## SALT `master`
|
||||
- name: debian-11-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:debian-11
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: debian-10-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:debian-10
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: debian-9-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:debian-9
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-2004-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:ubuntu-20.04
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-1804-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:ubuntu-18.04
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: centos-stream8-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:centos-stream8
|
||||
- name: centos-7-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:centos-7
|
||||
- name: fedora-36-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:fedora-36
|
||||
- name: fedora-35-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:fedora-35
|
||||
- name: fedora-34-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:fedora-34
|
||||
- name: opensuse-leap-153-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:opensuse-leap-15.3
|
||||
# Workaround to avoid intermittent failures on `opensuse-leap-15.3`:
|
||||
# => SCP did not finish successfully (255): (Net::SCP::Error)
|
||||
transport:
|
||||
max_ssh_sessions: 1
|
||||
- name: opensuse-tmbl-latest-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:opensuse-tumbleweed-latest
|
||||
# Workaround to avoid intermittent failures on `opensuse-tumbleweed`:
|
||||
# => SCP did not finish successfully (255): (Net::SCP::Error)
|
||||
transport:
|
||||
max_ssh_sessions: 1
|
||||
- name: amazonlinux-2-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:amazonlinux-2
|
||||
- name: oraclelinux-8-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:oraclelinux-8
|
||||
- name: oraclelinux-7-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:oraclelinux-7
|
||||
- name: arch-base-latest-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:arch-base-latest
|
||||
- name: gentoo-stage3-latest-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:gentoo-stage3-latest
|
||||
run_command: /sbin/init
|
||||
- name: gentoo-stage3-systemd-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:gentoo-stage3-systemd
|
||||
- name: almalinux-8-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:almalinux-8
|
||||
- name: rockylinux-8-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:rockylinux-8
|
||||
|
||||
## SALT `3004.1`
|
||||
- name: debian-11-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:debian-11
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: debian-10-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:debian-10
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: debian-9-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:debian-9
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-2004-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:ubuntu-20.04
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-1804-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:ubuntu-18.04
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: centos-stream8-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:centos-stream8
|
||||
- name: centos-7-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:centos-7
|
||||
- name: fedora-36-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:fedora-36
|
||||
- name: fedora-35-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:fedora-35
|
||||
- name: fedora-34-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:fedora-34
|
||||
- name: amazonlinux-2-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:amazonlinux-2
|
||||
- name: oraclelinux-8-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:oraclelinux-8
|
||||
- name: oraclelinux-7-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:oraclelinux-7
|
||||
- name: arch-base-latest-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:arch-base-latest
|
||||
- name: gentoo-stage3-latest-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:gentoo-stage3-latest
|
||||
run_command: /sbin/init
|
||||
- name: gentoo-stage3-systemd-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:gentoo-stage3-systemd
|
||||
- name: almalinux-8-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:almalinux-8
|
||||
- name: rockylinux-8-3004-1-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.1-py3:rockylinux-8
|
||||
|
||||
## SALT `3004.0`
|
||||
- name: opensuse-leap-153-3004-0-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.0-py3:opensuse-leap-15.3
|
||||
# Workaround to avoid intermittent failures on `opensuse-leap-15.3`:
|
||||
# => SCP did not finish successfully (255): (Net::SCP::Error)
|
||||
transport:
|
||||
max_ssh_sessions: 1
|
||||
- name: opensuse-tmbl-latest-3004-0-py3
|
||||
driver:
|
||||
image: saltimages/salt-3004.0-py3:opensuse-tumbleweed-latest
|
||||
# Workaround to avoid intermittent failures on `opensuse-tumbleweed`:
|
||||
# => SCP did not finish successfully (255): (Net::SCP::Error)
|
||||
transport:
|
||||
max_ssh_sessions: 1
|
||||
|
||||
## SALT `3003.4`
|
||||
- name: debian-10-3003-4-py3
|
||||
driver:
|
||||
image: saltimages/salt-3003.4-py3:debian-10
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: debian-9-3003-4-py3
|
||||
driver:
|
||||
image: saltimages/salt-3003.4-py3:debian-9
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-2004-3003-4-py3
|
||||
driver:
|
||||
image: saltimages/salt-3003.4-py3:ubuntu-20.04
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-1804-3003-4-py3
|
||||
driver:
|
||||
image: saltimages/salt-3003.4-py3:ubuntu-18.04
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: centos-stream8-3003-4-py3
|
||||
driver:
|
||||
image: saltimages/salt-3003.4-py3:centos-stream8
|
||||
- name: centos-7-3003-4-py3
|
||||
driver:
|
||||
image: saltimages/salt-3003.4-py3:centos-7
|
||||
- name: amazonlinux-2-3003-4-py3
|
||||
driver:
|
||||
image: saltimages/salt-3003.4-py3:amazonlinux-2
|
||||
- name: oraclelinux-8-3003-4-py3
|
||||
driver:
|
||||
image: saltimages/salt-3003.4-py3:oraclelinux-8
|
||||
- name: oraclelinux-7-3003-4-py3
|
||||
driver:
|
||||
image: saltimages/salt-3003.4-py3:oraclelinux-7
|
||||
- name: almalinux-8-3003-4-py3
|
||||
driver:
|
||||
image: saltimages/salt-3003.4-py3:almalinux-8
|
||||
|
||||
## SALT `3002.8`
|
||||
- name: debian-10-3002-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.8-py3:debian-10
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: debian-9-3002-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.8-py3:debian-9
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-2004-3002-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.8-py3:ubuntu-20.04
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-1804-3002-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.8-py3:ubuntu-18.04
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: centos-7-3002-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.8-py3:centos-7
|
||||
- name: amazonlinux-2-3002-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.8-py3:amazonlinux-2
|
||||
- name: oraclelinux-8-3002-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.8-py3:oraclelinux-8
|
||||
- name: oraclelinux-7-3002-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.8-py3:oraclelinux-7
|
||||
|
||||
verifier:
|
||||
# https://www.inspec.io/
|
||||
name: inspec
|
||||
sudo: true
|
||||
reporter:
|
||||
# cli, documentation, html, progress, json, json-min, json-rspec, junit
|
||||
- cli
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
provisioner:
|
||||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- gitea._mapdata
|
||||
- gitea
|
||||
verifier:
|
||||
inspec_tests:
|
||||
- path: test/integration/default
|
||||
122
pillar.example
Normal file
122
pillar.example
Normal file
@@ -0,0 +1,122 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
# yamllint disable rule:comments-indentation
|
||||
---
|
||||
gitea:
|
||||
# Request a specific version or leave 'latest', which will
|
||||
# resolve when running the state.
|
||||
# Updates are possible by changing the version. Latest
|
||||
# will do that automatically on subsequent runs.
|
||||
version: latest
|
||||
|
||||
# Since this formula skips the web installer,
|
||||
# the database configuration is required. This is just
|
||||
# an example. All specified values will be dumped into the
|
||||
# global configuration file.
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
|
||||
# (Some of) those secrets would be generated by the web installer.
|
||||
# Specify them here explicitly or let Salt handle their generation.
|
||||
# In the latter case, they will be saved in a grain value on the minion.
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
|
||||
# Service configuration allows to request mount paths or
|
||||
# other service units. This is especially important if you
|
||||
# run a local database server. Example: If you run mariadb
|
||||
# on localhost, specify wants: ['mariadb'] (or however the
|
||||
# unit is called, without `.service` suffix).
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
|
||||
# This is the custom configuration. Values in `default` are dumped
|
||||
# without an associated scope. For possible configuration values,
|
||||
# see the official docs or the example file.
|
||||
# It is recommended to keep all the keys lowercase to avoid
|
||||
# issues with some autoconfiguration done by this formula.
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
|
||||
# This is where a lot of the default parameters are looked up.
|
||||
# You should not need to change these values, except for changing
|
||||
# the default paths.
|
||||
lookup:
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256 # yamllint disable-line rule:line-length
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
|
||||
tofs:
|
||||
# The files_switch key serves as a selector for alternative
|
||||
# directories under the formula files directory. See TOFS pattern
|
||||
# doc for more info.
|
||||
# Note: Any value not evaluated by `config.get` will be used literally.
|
||||
# This can be used to set custom paths, as many levels deep as required.
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
|
||||
# All aspects of path/file resolution are customisable using the options below.
|
||||
# This is unnecessary in most cases; there are sensible defaults.
|
||||
# Default path: salt://< path_prefix >/< dirs.files >/< dirs.default >
|
||||
# I.e.: salt://gitea/files/default
|
||||
# path_prefix: template_alt
|
||||
# dirs:
|
||||
# files: files_alt
|
||||
# default: default_alt
|
||||
# The entries under `source_files` are prepended to the default source files
|
||||
# given for the state
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- 'app_alt.ini'
|
||||
- 'app_alt.ini.jinja'
|
||||
30
pre-commit_semantic-release.sh
Executable file
30
pre-commit_semantic-release.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
###############################################################################
|
||||
# (A) Update `FORMULA` with `${nextRelease.version}`
|
||||
###############################################################################
|
||||
sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA
|
||||
|
||||
|
||||
###############################################################################
|
||||
# (B) Use `m2r2` to convert automatically produced `.md` docs to `.rst`
|
||||
###############################################################################
|
||||
|
||||
# Install `m2r2`
|
||||
pip3 install m2r2
|
||||
|
||||
# Copy and then convert the `.md` docs
|
||||
cp ./*.md docs/
|
||||
cd docs/ || exit
|
||||
m2r2 --overwrite ./*.md
|
||||
|
||||
# Change excess `H1` headings to `H2` in converted `CHANGELOG.rst`
|
||||
sed -i -e '/^=.*$/s/=/-/g' CHANGELOG.rst
|
||||
sed -i -e '1,4s/-/=/g' CHANGELOG.rst
|
||||
|
||||
# Use for debugging output, when required
|
||||
# cat AUTHORS.rst
|
||||
# cat CHANGELOG.rst
|
||||
|
||||
# Return back to the main directory
|
||||
cd ..
|
||||
20
pyproject.toml
Normal file
20
pyproject.toml
Normal file
@@ -0,0 +1,20 @@
|
||||
[tool.poetry]
|
||||
name = "gitea_formula"
|
||||
version = "1.0.0"
|
||||
description = "Saltstack states to manage Gitea"
|
||||
authors = ["lkubb"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.6.2"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
Sphinx = "^4"
|
||||
# this is the official saltstack theme
|
||||
# sphinx-material-saltstack = "^1.0.5"
|
||||
sphinx-rtd-theme = "^1.0.0"
|
||||
# fulltoc has an issue with recent Sphinx versions ('easily' fixable in the source code though)
|
||||
# sphinxcontrib-fulltoc = "^1.2.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
18
release-rules.js
Normal file
18
release-rules.js
Normal file
@@ -0,0 +1,18 @@
|
||||
// No release is triggered for the types commented out below.
|
||||
// Commits using these types will be incorporated into the next release.
|
||||
//
|
||||
// NOTE: Any changes here must be reflected in `CONTRIBUTING.md`.
|
||||
module.exports = [
|
||||
{breaking: true, release: 'major'},
|
||||
// {type: 'build', release: 'patch'},
|
||||
// {type: 'chore', release: 'patch'},
|
||||
// {type: 'ci', release: 'patch'},
|
||||
{type: 'docs', release: 'patch'},
|
||||
{type: 'feat', release: 'minor'},
|
||||
{type: 'fix', release: 'patch'},
|
||||
{type: 'perf', release: 'patch'},
|
||||
{type: 'refactor', release: 'patch'},
|
||||
{type: 'revert', release: 'patch'},
|
||||
{type: 'style', release: 'patch'},
|
||||
{type: 'test', release: 'patch'},
|
||||
];
|
||||
107
release.config.js
Normal file
107
release.config.js
Normal file
@@ -0,0 +1,107 @@
|
||||
module.exports = {
|
||||
branch: 'master',
|
||||
repositoryUrl: 'https://github.com/lkubb/salt-gitea-formula',
|
||||
plugins: [
|
||||
['@semantic-release/commit-analyzer', {
|
||||
preset: 'angular',
|
||||
releaseRules: './release-rules.js',
|
||||
}],
|
||||
'@semantic-release/release-notes-generator',
|
||||
['@semantic-release/changelog', {
|
||||
changelogFile: 'CHANGELOG.md',
|
||||
changelogTitle: '# Changelog',
|
||||
}],
|
||||
['@semantic-release/exec', {
|
||||
prepareCmd: 'sh ./pre-commit_semantic-release.sh ${nextRelease.version}',
|
||||
}],
|
||||
['@semantic-release/git', {
|
||||
assets: ['*.md', 'docs/*.rst', 'FORMULA'],
|
||||
}],
|
||||
'@semantic-release/github',
|
||||
],
|
||||
generateNotes: {
|
||||
preset: 'angular',
|
||||
writerOpts: {
|
||||
// Required due to upstream bug preventing all types being displayed.
|
||||
// Bug: https://github.com/conventional-changelog/conventional-changelog/issues/317
|
||||
// Fix: https://github.com/conventional-changelog/conventional-changelog/pull/410
|
||||
transform: (commit, context) => {
|
||||
const issues = []
|
||||
|
||||
commit.notes.forEach(note => {
|
||||
note.title = `BREAKING CHANGES`
|
||||
})
|
||||
|
||||
// NOTE: Any changes here must be reflected in `CONTRIBUTING.md`.
|
||||
if (commit.type === `feat`) {
|
||||
commit.type = `Features`
|
||||
} else if (commit.type === `fix`) {
|
||||
commit.type = `Bug Fixes`
|
||||
} else if (commit.type === `perf`) {
|
||||
commit.type = `Performance Improvements`
|
||||
} else if (commit.type === `revert`) {
|
||||
commit.type = `Reverts`
|
||||
} else if (commit.type === `docs`) {
|
||||
commit.type = `Documentation`
|
||||
} else if (commit.type === `style`) {
|
||||
commit.type = `Styles`
|
||||
} else if (commit.type === `refactor`) {
|
||||
commit.type = `Code Refactoring`
|
||||
} else if (commit.type === `test`) {
|
||||
commit.type = `Tests`
|
||||
} else if (commit.type === `build`) {
|
||||
commit.type = `Build System`
|
||||
// } else if (commit.type === `chore`) {
|
||||
// commit.type = `Maintenance`
|
||||
} else if (commit.type === `ci`) {
|
||||
commit.type = `Continuous Integration`
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
if (commit.scope === `*`) {
|
||||
commit.scope = ``
|
||||
}
|
||||
|
||||
if (typeof commit.hash === `string`) {
|
||||
commit.shortHash = commit.hash.substring(0, 7)
|
||||
}
|
||||
|
||||
if (typeof commit.subject === `string`) {
|
||||
let url = context.repository
|
||||
? `${context.host}/${context.owner}/${context.repository}`
|
||||
: context.repoUrl
|
||||
if (url) {
|
||||
url = `${url}/issues/`
|
||||
// Issue URLs.
|
||||
commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => {
|
||||
issues.push(issue)
|
||||
return `[#${issue}](${url}${issue})`
|
||||
})
|
||||
}
|
||||
if (context.host) {
|
||||
// User URLs.
|
||||
commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
|
||||
if (username.includes('/')) {
|
||||
return `@${username}`
|
||||
}
|
||||
|
||||
return `[@${username}](${context.host}/${username})`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// remove references that already appear in the subject
|
||||
commit.references = commit.references.filter(reference => {
|
||||
if (issues.indexOf(reference.issue) === -1) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
return commit
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
50
test/integration/default/README.md
Normal file
50
test/integration/default/README.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# InSpec Profile: `default`
|
||||
|
||||
This shows the implementation of the `default` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md).
|
||||
|
||||
## Verify a profile
|
||||
|
||||
InSpec ships with built-in features to verify a profile structure.
|
||||
|
||||
```bash
|
||||
$ inspec check default
|
||||
Summary
|
||||
-------
|
||||
Location: default
|
||||
Profile: profile
|
||||
Controls: 4
|
||||
Timestamp: 2019-06-24T23:09:01+00:00
|
||||
Valid: true
|
||||
|
||||
Errors
|
||||
------
|
||||
|
||||
Warnings
|
||||
--------
|
||||
```
|
||||
|
||||
## Execute a profile
|
||||
|
||||
To run all **supported** controls on a local machine use `inspec exec /path/to/profile`.
|
||||
|
||||
```bash
|
||||
$ inspec exec default
|
||||
..
|
||||
|
||||
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
|
||||
8 examples, 0 failures
|
||||
```
|
||||
|
||||
## Execute a specific control from a profile
|
||||
|
||||
To run one control from the profile use `inspec exec /path/to/profile --controls name`.
|
||||
|
||||
```bash
|
||||
$ inspec exec default --controls package
|
||||
.
|
||||
|
||||
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
|
||||
1 examples, 0 failures
|
||||
```
|
||||
|
||||
See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb).
|
||||
47
test/integration/default/controls/_mapdata.rb
Normal file
47
test/integration/default/controls/_mapdata.rb
Normal file
@@ -0,0 +1,47 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'yaml'
|
||||
|
||||
control 'gitea._mapdata' do
|
||||
title '`map.jinja` should match the reference file'
|
||||
|
||||
### Method
|
||||
# The steps below for each file appear convoluted but they are both required
|
||||
# and similar in nature:
|
||||
# 1. The earliest method was to simply compare the files textually but this often
|
||||
# led to false positives due to inconsistencies (e.g. spacing, ordering)
|
||||
# 2. The next method was to load the files back into YAML structures and then
|
||||
# compare but InSpec provided block diffs this way, unusable by end users
|
||||
# 3. The final step was to dump the YAML structures back into a string to use
|
||||
# for the comparison; this both worked and provided human-friendly diffs
|
||||
|
||||
### Comparison file for the specific platform
|
||||
### Static, adjusted as part of code contributions, as map data is changed
|
||||
# Strip the `platform[:finger]` version number down to the "OS major release"
|
||||
platform_finger = system.platform[:finger].split('.').first.to_s
|
||||
# Use that to set the path to the file (relative to the InSpec suite directory)
|
||||
mapdata_file_path = "_mapdata/#{platform_finger}.yaml"
|
||||
# Load the mapdata from profile, into a YAML structure
|
||||
# https://docs.chef.io/inspec/profiles/#profile-files
|
||||
mapdata_file_yaml = YAML.load(inspec.profile.file(mapdata_file_path))
|
||||
# Dump the YAML back into a string for comparison
|
||||
mapdata_file_dump = YAML.dump(mapdata_file_yaml)
|
||||
|
||||
### Output file produced by running the `_mapdata` state
|
||||
### Dynamic, generated during Kitchen's `converge` phase
|
||||
# Derive the location of the dumped mapdata (differs for Windows)
|
||||
output_dir = platform[:family] == 'windows' ? '/temp' : '/tmp'
|
||||
# Use that to set the path to the file (absolute path, i.e. within the container)
|
||||
output_file_path = "#{output_dir}/salt_mapdata_dump.yaml"
|
||||
# Load the output into a YAML structure using InSpec's `yaml` resource
|
||||
# https://github.com/inspec/inspec/blob/49b7d10/lib/inspec/resources/yaml.rb#L29
|
||||
output_file_yaml = yaml(output_file_path).params
|
||||
# Dump the YAML back into a string for comparison
|
||||
output_file_dump = YAML.dump(output_file_yaml)
|
||||
|
||||
describe 'File content' do
|
||||
it 'should match profile map data exactly' do
|
||||
expect(output_file_dump).to eq(mapdata_file_dump)
|
||||
end
|
||||
end
|
||||
end
|
||||
40
test/integration/default/controls/config.rb
Normal file
40
test/integration/default/controls/config.rb
Normal file
@@ -0,0 +1,40 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
control 'gitea.config.file' do
|
||||
title 'Verify the configuration file'
|
||||
|
||||
describe file('/var/opt/gitea/custom/conf/app.ini') do
|
||||
it { should be_file }
|
||||
it { should be_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
its('mode') { should cmp '0644' }
|
||||
its('content') do
|
||||
should include(
|
||||
'This is another example file from SaltStack template-formula.'
|
||||
)
|
||||
end
|
||||
its('content') { should include '"added_in_pillar": "pillar_value"' }
|
||||
its('content') { should include '"added_in_defaults": "defaults_value"' }
|
||||
its('content') { should include '"added_in_lookup": "lookup_value"' }
|
||||
its('content') { should include '"config": "/etc/template-formula.conf"' }
|
||||
its('content') { should include '"lookup": {"added_in_lookup": "lookup_value",' }
|
||||
its('content') { should include '"pkg": {"name": "' }
|
||||
its('content') { should include '"service": {"name": "' }
|
||||
its('content') do
|
||||
# rubocop:disable Lint/RedundantCopDisableDirective
|
||||
# rubocop:disable Layout/LineLength
|
||||
should include(
|
||||
'"tofs": {"files_switch": ["any/path/can/be/used/here", "id", '\
|
||||
'"roles", "osfinger", "os", "os_family"], "source_files": '\
|
||||
'{"gitea-config-file-file-managed": ["example.tmpl.jinja"], '\
|
||||
'"gitea--config-file-file-managed": '\
|
||||
'["-example.tmpl.jinja"]}'
|
||||
)
|
||||
# rubocop:enable Layout/LineLength
|
||||
# rubocop:enable Lint/RedundantCopDisableDirective
|
||||
end
|
||||
its('content') { should include '"arch": "amd64"' }
|
||||
its('content') { should include '"winner": "pillar"}' }
|
||||
its('content') { should include 'winner of the merge: pillar' }
|
||||
end
|
||||
end
|
||||
11
test/integration/default/controls/packages.rb
Normal file
11
test/integration/default/controls/packages.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
control 'gitea.package.install' do
|
||||
title 'The required package should be installed'
|
||||
|
||||
package_name = 'gitea'
|
||||
|
||||
describe package(package_name) do
|
||||
it { should be_installed }
|
||||
end
|
||||
end
|
||||
13
test/integration/default/controls/services.rb
Normal file
13
test/integration/default/controls/services.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
control 'gitea.service.running' do
|
||||
title 'The service should be installed, enabled and running'
|
||||
|
||||
service_name = ''
|
||||
|
||||
describe service(service_name) do
|
||||
it { should be_installed }
|
||||
it { should be_enabled }
|
||||
it { should be_running }
|
||||
end
|
||||
end
|
||||
89
test/integration/default/files/_mapdata/almalinux-8.yaml
Normal file
89
test/integration/default/files/_mapdata/almalinux-8.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# AlmaLinux-8
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/amazonlinux-1.yaml
Normal file
89
test/integration/default/files/_mapdata/amazonlinux-1.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Amazon Linux AMI-2018
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/amazonlinux-2.yaml
Normal file
89
test/integration/default/files/_mapdata/amazonlinux-2.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Amazon Linux-2
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Arch
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/centos-6.yaml
Normal file
89
test/integration/default/files/_mapdata/centos-6.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# CentOS-6
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/centos-7.yaml
Normal file
89
test/integration/default/files/_mapdata/centos-7.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# CentOS Linux-7
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/centos-8.yaml
Normal file
89
test/integration/default/files/_mapdata/centos-8.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# CentOS Linux-8
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/debian-10.yaml
Normal file
89
test/integration/default/files/_mapdata/debian-10.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Debian-10
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/debian-11.yaml
Normal file
89
test/integration/default/files/_mapdata/debian-11.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Debian-11
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/debian-9.yaml
Normal file
89
test/integration/default/files/_mapdata/debian-9.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Debian-9
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/fedora-31.yaml
Normal file
89
test/integration/default/files/_mapdata/fedora-31.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Fedora-31
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/fedora-32.yaml
Normal file
89
test/integration/default/files/_mapdata/fedora-32.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Fedora-32
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/fedora-33.yaml
Normal file
89
test/integration/default/files/_mapdata/fedora-33.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Fedora-33
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/fedora-34.yaml
Normal file
89
test/integration/default/files/_mapdata/fedora-34.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Fedora-34
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/fedora-35.yaml
Normal file
89
test/integration/default/files/_mapdata/fedora-35.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Fedora-35
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/fedora-36.yaml
Normal file
89
test/integration/default/files/_mapdata/fedora-36.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Fedora-36
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/gentoo-2-sysd.yaml
Normal file
89
test/integration/default/files/_mapdata/gentoo-2-sysd.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Gentoo-2
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
89
test/integration/default/files/_mapdata/gentoo-2-sysv.yaml
Normal file
89
test/integration/default/files/_mapdata/gentoo-2-sysv.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Gentoo-2
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
lookup:
|
||||
arch: amd64
|
||||
rootgroup: root
|
||||
config: '/var/opt/gitea/custom/conf/app.ini'
|
||||
service:
|
||||
name: gitea
|
||||
gpg:
|
||||
key: 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
keyserver: keys.openpgp.org
|
||||
group: git
|
||||
paths:
|
||||
bin: /opt/gitea
|
||||
conf: /etc/opt/gitea
|
||||
custom: /var/opt/gitea/custom
|
||||
data: /var/opt/gitea/data
|
||||
home: /var/opt/gitea/home
|
||||
internal_token_uri: file:///etc/opt/gitea/internal_token
|
||||
log: /var/opt/gitea/log
|
||||
repos: /var/opt/gitea/data/gitea-repositories
|
||||
work: /var/opt/gitea
|
||||
pkg:
|
||||
latest: https://dl.gitea.io/gitea/version.json
|
||||
sig: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.asc
|
||||
source: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}
|
||||
source_hash: https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-{arch}.sha256
|
||||
requirements:
|
||||
- git
|
||||
- gpg
|
||||
- python-gnupg
|
||||
shell: /bin/bash
|
||||
user: git
|
||||
config:
|
||||
default:
|
||||
app_name: Gitea
|
||||
run_mode: prod
|
||||
run_user: git
|
||||
log:
|
||||
level: Info
|
||||
mode: console
|
||||
stacktrace_level: None
|
||||
repository.signing:
|
||||
signing_key: default
|
||||
server:
|
||||
domain: localhost
|
||||
http_addr: 0.0.0.0
|
||||
http_port: 3000
|
||||
protocol: http
|
||||
database:
|
||||
db_type: sqlite3
|
||||
name: gitea
|
||||
password: hunter1
|
||||
user: root
|
||||
secrets:
|
||||
internal_token: ''
|
||||
jwt_secret: ''
|
||||
lfs_jwt_secret: ''
|
||||
secret_key: ''
|
||||
service:
|
||||
requires_mount: []
|
||||
wants: []
|
||||
version: latest
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@gitea
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
gitea-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
winner: pillar
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user