feat: initial commit
This commit is contained in:
commit
86f4ebdd7b
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
|
133
.gitignore
vendored
Normal file
133
.gitignore
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
# 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
|
||||
|
||||
# `suricata-formula` -- Platform binaries
|
||||
*.rpm
|
||||
*.deb
|
259
.gitlab-ci.yml
Normal file
259
.gitlab-ci.yml
Normal file
@ -0,0 +1,259 @@
|
||||
# -*- 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@saltstack-formulas/template-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:1_2.5.1'
|
||||
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/saltstack-formulas/template-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:
|
||||
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}"'
|
||||
# <REMOVEME
|
||||
|
||||
###############################################################################
|
||||
# Define `test_conversion` template
|
||||
###############################################################################
|
||||
.test_conversion:
|
||||
stage: *stage_test
|
||||
image: *image_dindrubybionic
|
||||
services: *services_docker_dind
|
||||
variables: *variables_bundler
|
||||
cache: *cache_bundler
|
||||
before_script:
|
||||
- 'export CONVERTED=test-the-use_this_template-button'
|
||||
- 'git clone . tmp/"${CONVERTED}"-formula'
|
||||
- 'cd tmp/"${CONVERTED}"-formula'
|
||||
# Install `pre-commit` hooks
|
||||
- 'bin/install-hooks'
|
||||
# Run the conversion script with debug output
|
||||
- 'DEBUG=true bin/convert-formula.sh "${CONVERTED}"'
|
||||
- '[ $(git rev-list HEAD --count) -eq 2 ]'
|
||||
# Quick visual check that correct files have been updated
|
||||
- 'git show --pretty="" --name-status'
|
||||
# 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:
|
||||
- 'bin/kitchen verify default-debian-10-tiamat-py3'
|
||||
# REMOVEME>
|
||||
|
||||
###############################################################################
|
||||
# `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`
|
||||
# <REMOVEME
|
||||
# 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
|
||||
test-formula-conversion: {extends: '.test_conversion'}
|
||||
# REMOVEME>
|
||||
# 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-ubuntu-1604-tiamat-py3: {extends: '.test_instance'}
|
||||
# default-centos-8-tiamat-py3: {extends: '.test_instance'}
|
||||
# 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-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-ubuntu-1604-master-py3: {extends: '.test_instance'}
|
||||
default-centos-8-master-py3: {extends: '.test_instance'}
|
||||
default-centos-7-master-py3: {extends: '.test_instance'}
|
||||
default-fedora-33-master-py3: {extends: '.test_instance'}
|
||||
default-fedora-32-master-py3: {extends: '.test_instance'}
|
||||
default-opensuse-leap-152-master-py3: {extends: '.test_instance'}
|
||||
default-opensuse-tmbl-latest-master-py3: {extends: '.test_instance'}
|
||||
default-amazonlinux-2-master-py3: {extends: '.test_instance'}
|
||||
default-oraclelinux-8-master-py3: {extends: '.test_instance'}
|
||||
default-oraclelinux-7-master-py3: {extends: '.test_instance'}
|
||||
gentoo-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
|
||||
gentoo-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
|
||||
# default-debian-10-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-debian-9-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-2004-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1804-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1604-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-centos-8-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-centos-7-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-fedora-33-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-fedora-32-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-amazonlinux-2-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-8-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-7-3002-5-py3: {extends: '.test_instance'}
|
||||
default-arch-base-latest-3002-5-py3: {extends: '.test_instance'}
|
||||
# gentoo-gentoo-stage3-latest-3002-5-py3: {extends: '.test_instance'}
|
||||
# gentoo-gentoo-stage3-systemd-3002-5-py3: {extends: '.test_instance'}
|
||||
# default-opensuse-leap-152-3002-2-py3: {extends: '.test_instance'}
|
||||
# default-opensuse-tmbl-latest-3002-2-py3: {extends: '.test_instance'}
|
||||
# default-debian-10-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-debian-9-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-2004-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1804-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1604-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-centos-8-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-centos-7-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-fedora-33-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-fedora-32-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-opensuse-leap-152-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-opensuse-tmbl-latest-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-amazonlinux-2-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-8-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-7-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-arch-base-latest-3001-6-py3: {extends: '.test_instance'}
|
||||
# gentoo-gentoo-stage3-latest-3001-6-py3: {extends: '.test_instance'}
|
||||
# gentoo-gentoo-stage3-systemd-3001-6-py3: {extends: '.test_instance'}
|
||||
# default-debian-10-3000-8-py3: {extends: '.test_instance'}
|
||||
# default-debian-9-3000-8-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1804-3000-8-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1604-3000-8-py3: {extends: '.test_instance'}
|
||||
# default-centos-8-3000-8-py3: {extends: '.test_instance'}
|
||||
# default-centos-7-3000-8-py3: {extends: '.test_instance'}
|
||||
# default-opensuse-leap-152-3000-8-py3: {extends: '.test_instance'}
|
||||
# default-amazonlinux-2-3000-8-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-8-3000-8-py3: {extends: '.test_instance'}
|
||||
# default-oraclelinux-7-3000-8-py3: {extends: '.test_instance'}
|
||||
# gentoo-gentoo-stage3-latest-3000-8-py3: {extends: '.test_instance'}
|
||||
# gentoo-gentoo-stage3-systemd-3000-8-py3: {extends: '.test_instance'}
|
||||
# default-ubuntu-1804-3000-8-py2: {extends: '.test_instance'}
|
||||
# default-ubuntu-1604-3000-8-py2: {extends: '.test_instance'}
|
||||
# default-arch-base-latest-3000-8-py2: {extends: '.test_instance'}
|
||||
|
||||
###############################################################################
|
||||
# `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'
|
55
.pre-commit-config.yaml
Normal file
55
.pre-commit-config.yaml
Normal file
@ -0,0 +1,55 @@
|
||||
# -*- 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.9.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.7.1.1
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
name: Check shell scripts with shellcheck
|
||||
files: ^.*\.(sh|bash|ksh)$
|
||||
types: []
|
||||
- repo: https://github.com/adrienverge/yamllint
|
||||
rev: v1.23.0
|
||||
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.3.0
|
||||
hooks:
|
||||
- id: salt-lint
|
||||
name: Check Salt files using salt-lint
|
||||
files: ^.*\.(sls|jinja|j2|tmpl|tst)$
|
||||
- repo: https://github.com/myint/rstcheck
|
||||
rev: 3f929574
|
||||
hooks:
|
||||
- id: rstcheck
|
||||
name: Check reST files using rstcheck
|
||||
exclude: 'docs/CHANGELOG.rst'
|
||||
args: [--report=warning]
|
3
.rstcheck.cfg
Normal file
3
.rstcheck.cfg
Normal file
@ -0,0 +1,3 @@
|
||||
[rstcheck]
|
||||
report=error
|
||||
ignore_language=rst
|
19
.rubocop.yml
Normal file
19
.rubocop.yml
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- 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
|
||||
|
||||
# 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
|
230
.travis.yml
Normal file
230
.travis.yml
Normal file
@ -0,0 +1,230 @@
|
||||
# -*- 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-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-ubuntu-1604-tiamat-py3
|
||||
# - env: INSTANCE=default-centos-8-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-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-ubuntu-1604-master-py3
|
||||
- env: INSTANCE=default-centos-8-master-py3
|
||||
- env: INSTANCE=default-centos-7-master-py3
|
||||
- env: INSTANCE=default-fedora-33-master-py3
|
||||
- env: INSTANCE=default-fedora-32-master-py3
|
||||
- env: INSTANCE=default-opensuse-leap-152-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=gentoo-gentoo-stage3-latest-master-py3
|
||||
- env: INSTANCE=gentoo-gentoo-stage3-systemd-master-py3
|
||||
# - env: INSTANCE=default-debian-10-3002-5-py3
|
||||
# - env: INSTANCE=default-debian-9-3002-5-py3
|
||||
# - env: INSTANCE=default-ubuntu-2004-3002-5-py3
|
||||
# - env: INSTANCE=default-ubuntu-1804-3002-5-py3
|
||||
# - env: INSTANCE=default-ubuntu-1604-3002-5-py3
|
||||
# - env: INSTANCE=default-centos-8-3002-5-py3
|
||||
# - env: INSTANCE=default-centos-7-3002-5-py3
|
||||
# - env: INSTANCE=default-fedora-33-3002-5-py3
|
||||
# - env: INSTANCE=default-fedora-32-3002-5-py3
|
||||
# - env: INSTANCE=default-amazonlinux-2-3002-5-py3
|
||||
# - env: INSTANCE=default-oraclelinux-8-3002-5-py3
|
||||
# - env: INSTANCE=default-oraclelinux-7-3002-5-py3
|
||||
- env: INSTANCE=default-arch-base-latest-3002-5-py3
|
||||
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3002-5-py3
|
||||
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3002-5-py3
|
||||
# - env: INSTANCE=default-opensuse-leap-152-3002-2-py3
|
||||
# - env: INSTANCE=default-opensuse-tmbl-latest-3002-2-py3
|
||||
# - env: INSTANCE=default-debian-10-3001-6-py3
|
||||
# - env: INSTANCE=default-debian-9-3001-6-py3
|
||||
# - env: INSTANCE=default-ubuntu-2004-3001-6-py3
|
||||
# - env: INSTANCE=default-ubuntu-1804-3001-6-py3
|
||||
# - env: INSTANCE=default-ubuntu-1604-3001-6-py3
|
||||
# - env: INSTANCE=default-centos-8-3001-6-py3
|
||||
# - env: INSTANCE=default-centos-7-3001-6-py3
|
||||
# - env: INSTANCE=default-fedora-33-3001-6-py3
|
||||
# - env: INSTANCE=default-fedora-32-3001-6-py3
|
||||
# - env: INSTANCE=default-opensuse-leap-152-3001-6-py3
|
||||
# - env: INSTANCE=default-opensuse-tmbl-latest-3001-6-py3
|
||||
# - env: INSTANCE=default-amazonlinux-2-3001-6-py3
|
||||
# - env: INSTANCE=default-oraclelinux-8-3001-6-py3
|
||||
# - env: INSTANCE=default-oraclelinux-7-3001-6-py3
|
||||
# - env: INSTANCE=default-arch-base-latest-3001-6-py3
|
||||
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3001-6-py3
|
||||
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3001-6-py3
|
||||
# - env: INSTANCE=default-debian-10-3000-8-py3
|
||||
# - env: INSTANCE=default-debian-9-3000-8-py3
|
||||
# - env: INSTANCE=default-ubuntu-1804-3000-8-py3
|
||||
# - env: INSTANCE=default-ubuntu-1604-3000-8-py3
|
||||
# - env: INSTANCE=default-centos-8-3000-8-py3
|
||||
# - env: INSTANCE=default-centos-7-3000-8-py3
|
||||
# - env: INSTANCE=default-opensuse-leap-152-3000-8-py3
|
||||
# - env: INSTANCE=default-amazonlinux-2-3000-8-py3
|
||||
# - env: INSTANCE=default-oraclelinux-8-3000-8-py3
|
||||
# - env: INSTANCE=default-oraclelinux-7-3000-8-py3
|
||||
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3000-8-py3
|
||||
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3000-8-py3
|
||||
# - env: INSTANCE=default-ubuntu-1804-3000-8-py2
|
||||
# - env: INSTANCE=default-ubuntu-1604-3000-8-py2
|
||||
# - env: INSTANCE=default-arch-base-latest-3000-8-py2
|
||||
# <REMOVEME
|
||||
|
||||
# Test the conversion of `template-formula` into another formula
|
||||
# ready for development
|
||||
- env: 'Conversion'
|
||||
name: 'Test: bin/convert-formula.sh'
|
||||
script:
|
||||
- export CONVERTED=test-the-use_this_template-button
|
||||
- git clone . tmp/"$CONVERTED"-formula
|
||||
- cd tmp/"$CONVERTED"-formula
|
||||
- pyenv global 3.8
|
||||
- pip install pre-commit==2.7.1
|
||||
- bin/install-hooks
|
||||
- DEBUG=true bin/convert-formula.sh "$CONVERTED"
|
||||
- '[ $(git rev-list HEAD --count) -eq 2 ]'
|
||||
# Quick visual check that correct files have been updated
|
||||
- git show --pretty="" --name-status
|
||||
- bin/kitchen verify default-debian-10-tiamat-py3
|
||||
# REMOVEME>
|
||||
|
||||
## 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'
|
||||
# <REMOVEME
|
||||
|
||||
# Notification options: `always`, `never` or `change`
|
||||
notifications:
|
||||
webhooks:
|
||||
if: 'repo = saltstack-formulas/template-formula'
|
||||
urls:
|
||||
- https://saltstack-formulas.zulipchat.com/api/v1/external/travis?api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P&stream=CI&topic=saltstack-formulas%2Ftemplate-formula&ignore_pull_requests=true
|
||||
on_success: always # default: always
|
||||
on_failure: always # default: always
|
||||
on_start: always # default: never
|
||||
on_cancel: always # default: always
|
||||
on_error: always # default: always
|
||||
# REMOVEME>
|
40
.yamllint
Normal file
40
.yamllint
Normal file
@ -0,0 +1,40 @@
|
||||
# -*- 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 `.cache/`, introduced during the GitLab CI run
|
||||
# 2. All YAML files under directory `.git/`
|
||||
# 3. All YAML files under directory `node_modules/`, introduced during the Travis run
|
||||
# 4. Any SLS files under directory `test/`, which are actually state files
|
||||
# 5. Any YAML files under directory `.kitchen/`, introduced during local testing
|
||||
ignore: |
|
||||
.cache/
|
||||
.git/
|
||||
node_modules/
|
||||
test/**/states/**/*.sls
|
||||
.kitchen/
|
||||
|
||||
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
|
34
AUTHORS.md
Normal file
34
AUTHORS.md
Normal file
@ -0,0 +1,34 @@
|
||||
# Authors
|
||||
|
||||
This list is sorted by the number of commits per contributor in _descending_ order.
|
||||
|
||||
Avatar|Contributor|Contributions
|
||||
:-:|---|:-:
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/10231489?v=4' width='36' height='36' alt='@myii'>|[@myii](https://github.com/myii)|316
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1233212?v=4' width='36' height='36' alt='@baby-gnu'>|[@baby-gnu](https://github.com/baby-gnu)|37
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/4195158?v=4' width='36' height='36' alt='@dafyddj'>|[@dafyddj](https://github.com/dafyddj)|31
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1800660?v=4' width='36' height='36' alt='@aboe76'>|[@aboe76](https://github.com/aboe76)|27
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/242396?v=4' width='36' height='36' alt='@javierbertoli'>|[@javierbertoli](https://github.com/javierbertoli)|18
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/13322818?v=4' width='36' height='36' alt='@noelmcloughlin'>|[@noelmcloughlin](https://github.com/noelmcloughlin)|15
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/3433835?v=4' width='36' height='36' alt='@n-rodriguez'>|[@n-rodriguez](https://github.com/n-rodriguez)|8
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/52996?v=4' width='36' height='36' alt='@daks'>|[@daks](https://github.com/daks)|8
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1396878?v=4' width='36' height='36' alt='@gravyboat'>|[@gravyboat](https://github.com/gravyboat)|6
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1920805?v=4' width='36' height='36' alt='@alxwr'>|[@alxwr](https://github.com/alxwr)|5
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/4542588?v=4' width='36' height='36' alt='@evvers'>|[@evvers](https://github.com/evvers)|4
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/3374962?v=4' width='36' height='36' alt='@nmadhok'>|[@nmadhok](https://github.com/nmadhok)|3
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/16338056?v=4' width='36' height='36' alt='@vutny'>|[@vutny](https://github.com/vutny)|2
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/29522418?v=4' width='36' height='36' alt='@k-hamza'>|[@k-hamza](https://github.com/k-hamza)|2
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/528061?v=4' width='36' height='36' alt='@puneetk'>|[@puneetk](https://github.com/puneetk)|2
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/3536289?v=4' width='36' height='36' alt='@andygabby'>|[@andygabby](https://github.com/andygabby)|1
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1269218?v=4' width='36' height='36' alt='@Jokipii'>|[@Jokipii](https://github.com/Jokipii)|1
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/5306980?v=4' width='36' height='36' alt='@johnkeates'>|[@johnkeates](https://github.com/johnkeates)|1
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/611471?v=4' width='36' height='36' alt='@duk3luk3'>|[@duk3luk3](https://github.com/duk3luk3)|1
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/3075069?v=4' width='36' height='36' alt='@marco-m'>|[@marco-m](https://github.com/marco-m)|1
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/91293?v=4' width='36' height='36' alt='@whiteinge'>|[@whiteinge](https://github.com/whiteinge)|1
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/22272?v=4' width='36' height='36' alt='@sroegner'>|[@sroegner](https://github.com/sroegner)|1
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/117961?v=4' width='36' height='36' alt='@babilen5'>|[@babilen5](https://github.com/babilen5)|1
|
||||
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/2205993?v=4' width='36' height='36' alt='@GMAzrael'>|[@GMAzrael](https://github.com/GMAzrael)|1
|
||||
|
||||
---
|
||||
|
||||
Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2021-03-09.
|
1349
CHANGELOG.md
Normal file
1349
CHANGELOG.md
Normal file
File diff suppressed because it is too large
Load Diff
47
CODEOWNERS
Normal file
47
CODEOWNERS
Normal file
@ -0,0 +1,47 @@
|
||||
# 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)
|
||||
* @saltstack-formulas/wg
|
||||
|
||||
# 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
|
||||
/*/libsaltcli.jinja @saltstack-formulas/ssf
|
||||
/*/libtofs.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
|
||||
/.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
|
||||
/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: TEMPLATE
|
||||
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: 5.0.1
|
||||
release: 1
|
||||
minimum_version: 2019.2
|
||||
summary: TEMPLATE formula
|
||||
description: Formula to use as a template for other formulas
|
||||
top_level_dir: TEMPLATE
|
14
Gemfile
Normal file
14
Gemfile
Normal file
@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
# Use the latest version of `inspec` prior to `4.23.4`, which introduces a
|
||||
# regression where the diff isn't displayed when comparing using `eq`.
|
||||
gem 'inspec', '~> 4.22.22'
|
||||
# Install the `kitchen-docker` gem using `git` because the latest version
|
||||
# currently available (`2.10.0`) doesn't include a recent fix for Gentoo.
|
||||
# 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.2.1'
|
||||
gem 'kitchen-salt', '>= 0.6.3'
|
530
Gemfile.lock
Normal file
530
Gemfile.lock
Normal file
@ -0,0 +1,530 @@
|
||||
GIT
|
||||
remote: https://gitlab.com/saltstack-formulas/infrastructure/kitchen-docker
|
||||
revision: 042e6921940a28d2502258b6a5ff3be17dd2fd37
|
||||
branch: ssf
|
||||
specs:
|
||||
kitchen-docker (2.10.0)
|
||||
test-kitchen (>= 1.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (5.2.4.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
aws-eventstream (1.1.0)
|
||||
aws-partitions (1.386.0)
|
||||
aws-sdk-apigateway (1.55.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-apigatewayv2 (1.29.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-athena (1.33.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-autoscaling (1.22.0)
|
||||
aws-sdk-core (~> 3, >= 3.52.1)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-budgets (1.36.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudformation (1.44.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudfront (1.46.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudhsm (1.27.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudhsmv2 (1.30.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudtrail (1.29.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudwatch (1.45.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-cloudwatchlogs (1.38.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-codecommit (1.40.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-codedeploy (1.37.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-codepipeline (1.37.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-configservice (1.53.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-core (3.109.1)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
aws-partitions (~> 1, >= 1.239.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
jmespath (~> 1.0)
|
||||
aws-sdk-costandusagereportservice (1.28.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-dynamodb (1.55.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ec2 (1.202.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ecr (1.39.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ecs (1.70.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-efs (1.36.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-eks (1.45.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-elasticache (1.44.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-elasticbeanstalk (1.39.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-elasticloadbalancing (1.29.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-elasticloadbalancingv2 (1.53.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-elasticsearchservice (1.43.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-firehose (1.35.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-guardduty (1.42.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-iam (1.46.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-kafka (1.29.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-kinesis (1.30.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-kms (1.39.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-lambda (1.51.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-organizations (1.17.0)
|
||||
aws-sdk-core (~> 3, >= 3.39.0)
|
||||
aws-sigv4 (~> 1.0)
|
||||
aws-sdk-rds (1.104.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-redshift (1.50.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-route53 (1.44.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-route53domains (1.28.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-route53resolver (1.21.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-s3 (1.83.1)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-securityhub (1.35.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ses (1.36.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-sms (1.27.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-sns (1.34.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-sqs (1.34.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-ssm (1.95.0)
|
||||
aws-sdk-core (~> 3, >= 3.109.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sigv4 (1.2.2)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
azure_graph_rbac (0.17.2)
|
||||
ms_rest_azure (~> 0.12.0)
|
||||
azure_mgmt_key_vault (0.17.6)
|
||||
ms_rest_azure (~> 0.12.0)
|
||||
azure_mgmt_resources (0.18.0)
|
||||
ms_rest_azure (~> 0.12.0)
|
||||
azure_mgmt_security (0.18.2)
|
||||
ms_rest_azure (~> 0.12.0)
|
||||
azure_mgmt_storage (0.22.0)
|
||||
ms_rest_azure (~> 0.12.0)
|
||||
bcrypt_pbkdf (1.0.1)
|
||||
builder (3.2.4)
|
||||
chef-config (16.6.14)
|
||||
addressable
|
||||
chef-utils (= 16.6.14)
|
||||
fuzzyurl
|
||||
mixlib-config (>= 2.2.12, < 4.0)
|
||||
mixlib-shellout (>= 2.0, < 4.0)
|
||||
tomlrb (~> 1.2)
|
||||
chef-telemetry (1.0.14)
|
||||
chef-config
|
||||
concurrent-ruby (~> 1.0)
|
||||
ffi-yajl (~> 2.2)
|
||||
chef-utils (16.6.14)
|
||||
coderay (1.1.3)
|
||||
concurrent-ruby (1.1.7)
|
||||
declarative (0.0.20)
|
||||
declarative-option (0.1.0)
|
||||
diff-lcs (1.4.4)
|
||||
docker-api (2.0.0)
|
||||
excon (>= 0.47.0)
|
||||
multi_json
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
ecma-re-validator (0.2.1)
|
||||
regexp_parser (~> 1.2)
|
||||
ed25519 (1.2.4)
|
||||
erubi (1.9.0)
|
||||
excon (0.78.0)
|
||||
faraday (0.17.3)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-cookie_jar (0.0.7)
|
||||
faraday (>= 0.8.0)
|
||||
http-cookie (~> 1.0.0)
|
||||
faraday_middleware (0.12.2)
|
||||
faraday (>= 0.7.4, < 1.0)
|
||||
ffi (1.13.1)
|
||||
ffi-yajl (2.3.4)
|
||||
libyajl2 (~> 1.2)
|
||||
fuzzyurl (0.9.0)
|
||||
google-api-client (0.44.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)
|
||||
signet (~> 0.12)
|
||||
googleauth (0.13.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.0)
|
||||
ffi (>= 1.0.1)
|
||||
gyoku (1.3.1)
|
||||
builder (>= 2.1.2)
|
||||
hana (1.3.6)
|
||||
hashie (3.6.0)
|
||||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
i18n (1.8.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
inifile (3.0.0)
|
||||
inspec (4.22.22)
|
||||
faraday_middleware (~> 0.12.2)
|
||||
inspec-core (= 4.22.22)
|
||||
train (~> 3.0)
|
||||
train-aws (~> 0.1)
|
||||
train-habitat (~> 0.1)
|
||||
train-winrm (~> 0.2)
|
||||
inspec-core (4.22.22)
|
||||
addressable (~> 2.4)
|
||||
chef-telemetry (~> 1.0)
|
||||
faraday (>= 0.9.0)
|
||||
hashie (~> 3.4)
|
||||
json_schemer (>= 0.2.1, < 0.2.12)
|
||||
license-acceptance (>= 0.2.13, < 2.0)
|
||||
method_source (>= 0.8, < 2.0)
|
||||
mixlib-log (~> 3.0)
|
||||
multipart-post (~> 2.0)
|
||||
parallel (~> 1.9)
|
||||
parslet (~> 1.5)
|
||||
pry (~> 0.13)
|
||||
rspec (~> 3.9)
|
||||
rspec-its (~> 1.2)
|
||||
rubyzip (~> 1.2, >= 1.2.2)
|
||||
semverse (~> 3.0)
|
||||
sslshake (~> 1.2)
|
||||
thor (>= 0.20, < 2.0)
|
||||
tomlrb (~> 1.2.0)
|
||||
train-core (~> 3.0)
|
||||
tty-prompt (~> 0.17)
|
||||
tty-table (~> 0.10)
|
||||
jmespath (1.4.0)
|
||||
json (2.3.1)
|
||||
json_schemer (0.2.11)
|
||||
ecma-re-validator (~> 0.2)
|
||||
hana (~> 1.3)
|
||||
regexp_parser (~> 1.5)
|
||||
uri_template (~> 0.7)
|
||||
jwt (2.2.2)
|
||||
kitchen-inspec (2.2.1)
|
||||
hashie (~> 3.4)
|
||||
inspec (>= 2.2.64, < 5.0)
|
||||
test-kitchen (>= 2.7, < 3)
|
||||
kitchen-salt (0.6.3)
|
||||
hashie (>= 3.5)
|
||||
test-kitchen (>= 1.4)
|
||||
libyajl2 (1.2.0)
|
||||
license-acceptance (1.0.19)
|
||||
pastel (~> 0.7)
|
||||
tomlrb (~> 1.2)
|
||||
tty-box (~> 0.3)
|
||||
tty-prompt (~> 0.18)
|
||||
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.0.2)
|
||||
minitest (5.14.2)
|
||||
mixlib-config (3.0.9)
|
||||
tomlrb
|
||||
mixlib-install (3.12.3)
|
||||
mixlib-shellout
|
||||
mixlib-versioning
|
||||
thor
|
||||
mixlib-log (3.0.9)
|
||||
mixlib-shellout (3.1.6)
|
||||
chef-utils
|
||||
mixlib-versioning (1.2.12)
|
||||
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)
|
||||
os (1.1.1)
|
||||
parallel (1.19.2)
|
||||
parslet (1.8.2)
|
||||
pastel (0.8.0)
|
||||
tty-color (~> 0.5)
|
||||
pry (0.13.1)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
public_suffix (4.0.6)
|
||||
regexp_parser (1.8.2)
|
||||
representable (3.0.4)
|
||||
declarative (< 0.1.0)
|
||||
declarative-option (< 0.2.0)
|
||||
uber (< 0.2.0)
|
||||
retriable (3.1.2)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-core (3.9.3)
|
||||
rspec-support (~> 3.9.3)
|
||||
rspec-expectations (3.9.3)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-its (1.3.0)
|
||||
rspec-core (>= 3.0.0)
|
||||
rspec-expectations (>= 3.0.0)
|
||||
rspec-mocks (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.4)
|
||||
rubyntlm (0.6.2)
|
||||
rubyzip (1.3.0)
|
||||
semverse (3.0.0)
|
||||
signet (0.14.0)
|
||||
addressable (~> 2.3)
|
||||
faraday (>= 0.17.3, < 2.0)
|
||||
jwt (>= 1.5, < 3.0)
|
||||
multi_json (~> 1.10)
|
||||
sslshake (1.3.1)
|
||||
strings (0.2.0)
|
||||
strings-ansi (~> 0.2)
|
||||
unicode-display_width (~> 1.5)
|
||||
unicode_utils (~> 1.4)
|
||||
strings-ansi (0.2.0)
|
||||
test-kitchen (2.7.2)
|
||||
bcrypt_pbkdf (~> 1.0)
|
||||
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.0.1)
|
||||
thread_safe (0.3.6)
|
||||
timeliness (0.3.10)
|
||||
tomlrb (1.2.9)
|
||||
train (3.3.27)
|
||||
activesupport (>= 5.2.4.3, < 6.0.0)
|
||||
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.44.1)
|
||||
googleauth (>= 0.6.6, < 0.13.1)
|
||||
inifile (~> 3.0)
|
||||
train-core (= 3.3.27)
|
||||
train-winrm (~> 0.2)
|
||||
train-aws (0.1.18)
|
||||
aws-sdk-apigateway (~> 1.0)
|
||||
aws-sdk-apigatewayv2 (~> 1.0)
|
||||
aws-sdk-athena (~> 1.0)
|
||||
aws-sdk-autoscaling (~> 1.22.0)
|
||||
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-cloudwatchlogs (~> 1.13)
|
||||
aws-sdk-codecommit (~> 1.0)
|
||||
aws-sdk-codedeploy (~> 1.0)
|
||||
aws-sdk-codepipeline (~> 1.0)
|
||||
aws-sdk-configservice (~> 1.21)
|
||||
aws-sdk-core (~> 3.0)
|
||||
aws-sdk-costandusagereportservice (~> 1.6)
|
||||
aws-sdk-dynamodb (~> 1.31)
|
||||
aws-sdk-ec2 (~> 1.70)
|
||||
aws-sdk-ecr (~> 1.18)
|
||||
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-firehose (~> 1.0)
|
||||
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-organizations (~> 1.17.0)
|
||||
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-securityhub (~> 1.0)
|
||||
aws-sdk-ses (~> 1.0)
|
||||
aws-sdk-sms (~> 1.0)
|
||||
aws-sdk-sns (~> 1.9)
|
||||
aws-sdk-sqs (~> 1.10)
|
||||
aws-sdk-ssm (~> 1.0)
|
||||
train-core (3.3.27)
|
||||
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.13)
|
||||
train-winrm (0.2.11)
|
||||
winrm (~> 2.0)
|
||||
winrm-elevated (~> 1.2.2)
|
||||
winrm-fs (~> 1.0)
|
||||
tty-box (0.6.0)
|
||||
pastel (~> 0.8)
|
||||
strings (~> 0.2.0)
|
||||
tty-cursor (~> 0.7)
|
||||
tty-color (0.5.2)
|
||||
tty-cursor (0.7.1)
|
||||
tty-prompt (0.22.0)
|
||||
pastel (~> 0.8)
|
||||
tty-reader (~> 0.8)
|
||||
tty-reader (0.8.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 (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
uber (0.1.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.7)
|
||||
unicode-display_width (1.7.0)
|
||||
unicode_utils (1.4.0)
|
||||
uri_template (0.7.0)
|
||||
winrm (2.3.5)
|
||||
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.1)
|
||||
winrm-elevated (1.2.2)
|
||||
erubi (~> 1.8)
|
||||
winrm (~> 2.0)
|
||||
winrm-fs (~> 1.0)
|
||||
winrm-fs (1.3.3)
|
||||
erubi (~> 1.8)
|
||||
logging (>= 1.6.1, < 3.0)
|
||||
rubyzip (~> 1.1)
|
||||
winrm (~> 2.0)
|
||||
wisper (2.0.1)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
inspec (~> 4.22.22)
|
||||
kitchen-docker!
|
||||
kitchen-inspec (>= 2.2.1)
|
||||
kitchen-salt (>= 0.6.3)
|
||||
|
||||
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.
|
13
TEMPLATE/_mapdata/_mapdata.jinja
Normal file
13
TEMPLATE/_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
|
||||
}}
|
22
TEMPLATE/_mapdata/init.sls
Normal file
22
TEMPLATE/_mapdata/init.sls
Normal file
@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
---
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- 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 }}
|
8
TEMPLATE/clean.sls
Normal file
8
TEMPLATE/clean.sls
Normal file
@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .subcomponent.clean
|
||||
- .service.clean
|
||||
- .config.clean
|
||||
- .package.clean
|
16
TEMPLATE/config/clean.sls
Normal file
16
TEMPLATE/config/clean.sls
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as TEMPLATE with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_service_clean }}
|
||||
|
||||
TEMPLATE-config-clean-file-absent:
|
||||
file.absent:
|
||||
- name: {{ TEMPLATE.config }}
|
||||
- require:
|
||||
- sls: {{ sls_service_clean }}
|
28
TEMPLATE/config/file.sls
Normal file
28
TEMPLATE/config/file.sls
Normal file
@ -0,0 +1,28 @@
|
||||
# -*- 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 TEMPLATE with context %}
|
||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_package_install }}
|
||||
|
||||
TEMPLATE-config-file-file-managed:
|
||||
file.managed:
|
||||
- name: {{ TEMPLATE.config }}
|
||||
- source: {{ files_switch(['example.tmpl'],
|
||||
lookup='TEMPLATE-config-file-file-managed'
|
||||
)
|
||||
}}
|
||||
- mode: 644
|
||||
- user: root
|
||||
- group: {{ TEMPLATE.rootgroup }}
|
||||
- makedirs: True
|
||||
- template: jinja
|
||||
- require:
|
||||
- sls: {{ sls_package_install }}
|
||||
- context:
|
||||
TEMPLATE: {{ TEMPLATE | json }}
|
5
TEMPLATE/config/init.sls
Normal file
5
TEMPLATE/config/init.sls
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .file
|
6
TEMPLATE/files/default/example.tmpl
Normal file
6
TEMPLATE/files/default/example.tmpl
Normal file
@ -0,0 +1,6 @@
|
||||
########################################################################
|
||||
# File managed by Salt at <{{ source }}>.
|
||||
# Your changes will be overwritten.
|
||||
########################################################################
|
||||
|
||||
This is an example file from SaltStack template-formula.
|
11
TEMPLATE/files/default/example.tmpl.jinja
Normal file
11
TEMPLATE/files/default/example.tmpl.jinja
Normal file
@ -0,0 +1,11 @@
|
||||
########################################################################
|
||||
# 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
|
||||
{{ TEMPLATE | json }}
|
||||
|
||||
winner of the merge: {{ TEMPLATE['winner'] }}
|
8
TEMPLATE/init.sls
Normal file
8
TEMPLATE/init.sls
Normal file
@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .package
|
||||
- .config
|
||||
- .service
|
||||
- .subcomponent
|
310
TEMPLATE/libmapstack.jinja
Normal file
310
TEMPLATE/libmapstack.jinja
Normal file
@ -0,0 +1,310 @@
|
||||
{#- -*- 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 %}
|
||||
|
||||
{%- 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 | 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] %}
|
||||
{%- 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
TEMPLATE/libmatchers.jinja
Normal file
222
TEMPLATE/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 %}
|
||||
|
||||
{%- set query_map = {
|
||||
"C": "config.get",
|
||||
"G": "grains.get",
|
||||
"I": "pillar.get",
|
||||
} %}
|
||||
|
||||
{#- When no part before `@` is provided: #}
|
||||
{#- - define a filename path, noted `F` #}
|
||||
{#- - use `salt["config.get"]`, noted `C` #}
|
||||
{#- - use colon `:` delimiter for querying #}
|
||||
{%- set _defaults = {
|
||||
"type": "F",
|
||||
"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: #}
|
||||
{#- - `F` to build a 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 `FILE` 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 in ["minion", "local"] 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 not in ["minion", "local"] %}
|
||||
{%- do salt["log.error"](
|
||||
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 %}
|
16
TEMPLATE/libsaltcli.jinja
Normal file
16
TEMPLATE/libsaltcli.jinja
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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' %}
|
||||
{%- else %}
|
||||
{%- set cli = 'unknown' %}
|
||||
{%- endif %}
|
||||
{%- do salt['log.debug']('[libsaltcli] the salt command type has been identified to be: ' ~ cli) %}
|
115
TEMPLATE/libtofs.jinja
Normal file
115
TEMPLATE/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
TEMPLATE/map.jinja
Normal file
66
TEMPLATE/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 %}
|
||||
|
||||
{#- 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 %}
|
16
TEMPLATE/package/clean.sls
Normal file
16
TEMPLATE/package/clean.sls
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- set sls_config_clean = tplroot ~ '.config.clean' %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as TEMPLATE with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_config_clean }}
|
||||
|
||||
TEMPLATE-package-clean-pkg-removed:
|
||||
pkg.removed:
|
||||
- name: {{ TEMPLATE.pkg.name }}
|
||||
- require:
|
||||
- sls: {{ sls_config_clean }}
|
5
TEMPLATE/package/init.sls
Normal file
5
TEMPLATE/package/init.sls
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .install
|
10
TEMPLATE/package/install.sls
Normal file
10
TEMPLATE/package/install.sls
Normal file
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as TEMPLATE with context %}
|
||||
|
||||
TEMPLATE-package-install-pkg-installed:
|
||||
pkg.installed:
|
||||
- name: {{ TEMPLATE.pkg.name }}
|
18
TEMPLATE/parameters/defaults.yaml
Normal file
18
TEMPLATE/parameters/defaults.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set default values.
|
||||
---
|
||||
values:
|
||||
pkg:
|
||||
name: TEMPLATE
|
||||
rootgroup: root
|
||||
config: '/etc/TEMPLATE'
|
||||
service:
|
||||
name: TEMPLATE
|
||||
subcomponent:
|
||||
config: '/etc/TEMPLATE-subcomponent-formula.conf'
|
||||
# Just here for testing
|
||||
added_in_defaults: defaults_value
|
||||
winner: defaults
|
||||
...
|
19
TEMPLATE/parameters/os/Fedora.yaml
Normal file
19
TEMPLATE/parameters/os/Fedora.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('os') == Fedora.
|
||||
#
|
||||
# You just need to add the key:values for this `os` that differ
|
||||
# from `defaults.yaml` + `<osarch>.yaml` + `<os_family>.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `os` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
pkg:
|
||||
name: TEMPLATE-fedora
|
||||
service:
|
||||
name: service-fedora
|
||||
...
|
20
TEMPLATE/parameters/os/MacOS.yaml.jinja
Normal file
20
TEMPLATE/parameters/os/MacOS.yaml.jinja
Normal file
@ -0,0 +1,20 @@
|
||||
{#- -*- coding: utf-8 -*- #}
|
||||
{#- vim: ft=jinja #}
|
||||
{#-
|
||||
Set values specific to:
|
||||
salt['config.get']('os') == MacOS.
|
||||
|
||||
You just need to add the key:values for this `os` that differ
|
||||
from `defaults.yaml` + `<osarch>.yaml` + `<os_family>.yaml`.
|
||||
|
||||
This jinja2 file must return a valid `map.jinja` YAML.
|
||||
|
||||
If you do not need to provide calculated values via the `os`
|
||||
config, you can remove this file or provide at least an empty
|
||||
dict, e.g.
|
||||
values: {}
|
||||
#}
|
||||
---
|
||||
values:
|
||||
rootgroup: {{ salt['cmd.run']("stat -f '%Sg' /dev/console") }}
|
||||
...
|
18
TEMPLATE/parameters/os/Ubuntu.yaml
Normal file
18
TEMPLATE/parameters/os/Ubuntu.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('os') == Ubuntu.
|
||||
#
|
||||
# You just need to add the key:values for this `os` that differ
|
||||
# from `defaults.yaml` + `<osarch>.yaml` + `<os_family>.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `os` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
pkg:
|
||||
name: TEMPLATE-ubuntu
|
||||
config: /etc/TEMPLATE.d/custom-ubuntu.conf
|
||||
...
|
19
TEMPLATE/parameters/os_family/Arch.yaml
Normal file
19
TEMPLATE/parameters/os_family/Arch.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- 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:
|
||||
pkg:
|
||||
name: TEMPLATE-arch
|
||||
service:
|
||||
name: service-arch
|
||||
...
|
18
TEMPLATE/parameters/os_family/Debian.yaml
Normal file
18
TEMPLATE/parameters/os_family/Debian.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- 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:
|
||||
pkg:
|
||||
name: TEMPLATE-debian
|
||||
config: /etc/TEMPLATE.d/custom.conf
|
||||
...
|
16
TEMPLATE/parameters/os_family/FreeBSD.yaml
Normal file
16
TEMPLATE/parameters/os_family/FreeBSD.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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:
|
||||
rootgroup: wheel
|
||||
...
|
17
TEMPLATE/parameters/os_family/Gentoo.yaml
Normal file
17
TEMPLATE/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:
|
||||
pkg:
|
||||
name: TEMPLATE-gentoo
|
||||
...
|
16
TEMPLATE/parameters/os_family/OpenBSD.yaml
Normal file
16
TEMPLATE/parameters/os_family/OpenBSD.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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:
|
||||
rootgroup: wheel
|
||||
...
|
18
TEMPLATE/parameters/os_family/RedHat.yaml
Normal file
18
TEMPLATE/parameters/os_family/RedHat.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- 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:
|
||||
pkg:
|
||||
name: TEMPLATE-redhat
|
||||
config: /etc/TEMPLATE.conf
|
||||
...
|
17
TEMPLATE/parameters/os_family/Suse.yaml
Normal file
17
TEMPLATE/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:
|
||||
pkg:
|
||||
name: TEMPLATE-suse
|
||||
...
|
16
TEMPLATE/parameters/osarch/386.yaml
Normal file
16
TEMPLATE/parameters/osarch/386.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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:
|
||||
arch: 386
|
||||
...
|
16
TEMPLATE/parameters/osarch/amd64.yaml
Normal file
16
TEMPLATE/parameters/osarch/amd64.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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:
|
||||
arch: amd64
|
||||
...
|
16
TEMPLATE/parameters/osarch/arm64.yaml
Normal file
16
TEMPLATE/parameters/osarch/arm64.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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:
|
||||
arch: arm64
|
||||
...
|
16
TEMPLATE/parameters/osarch/armv6l.yaml
Normal file
16
TEMPLATE/parameters/osarch/armv6l.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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:
|
||||
arch: armv6l
|
||||
...
|
16
TEMPLATE/parameters/osarch/armv7l.yaml
Normal file
16
TEMPLATE/parameters/osarch/armv7l.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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:
|
||||
arch: armv7l
|
||||
...
|
16
TEMPLATE/parameters/osarch/ppc64le.yaml
Normal file
16
TEMPLATE/parameters/osarch/ppc64le.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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:
|
||||
arch: ppc64le
|
||||
...
|
16
TEMPLATE/parameters/osarch/s390x.yaml
Normal file
16
TEMPLATE/parameters/osarch/s390x.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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:
|
||||
arch: s390x
|
||||
...
|
16
TEMPLATE/parameters/osarch/x86_64.yaml
Normal file
16
TEMPLATE/parameters/osarch/x86_64.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- 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:
|
||||
arch: amd64
|
||||
...
|
18
TEMPLATE/parameters/osfinger/CentOS-6.yaml
Normal file
18
TEMPLATE/parameters/osfinger/CentOS-6.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('osfinger') == CentOS-6.
|
||||
#
|
||||
# You just need to add the key:values for this `osfinger` that differ
|
||||
# from `defaults.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `osfinger` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
pkg:
|
||||
name: TEMPLATE-centos-6
|
||||
config: /etc/TEMPLATE.d/custom-centos-6.conf
|
||||
...
|
16
TEMPLATE/parameters/osfinger/Ubuntu-18.04.yaml
Normal file
16
TEMPLATE/parameters/osfinger/Ubuntu-18.04.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
#
|
||||
# Set values specific to:
|
||||
# salt['config.get']('osfinger') == Ubuntu-18.04.
|
||||
#
|
||||
# You just need to add the key:values for this `osfinger` that differ
|
||||
# from `defaults.yaml`.
|
||||
#
|
||||
# If you do not need to provide defaults via the `osfinger` config,
|
||||
# you can remove this file or provide at least an empty dict, e.g.
|
||||
# values: {}
|
||||
---
|
||||
values:
|
||||
config: /etc/TEMPLATE.d/custom-ubuntu-18.04.conf
|
||||
...
|
11
TEMPLATE/service/clean.sls
Normal file
11
TEMPLATE/service/clean.sls
Normal file
@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as TEMPLATE with context %}
|
||||
|
||||
TEMPLATE-service-clean-service-dead:
|
||||
service.dead:
|
||||
- name: {{ TEMPLATE.service.name }}
|
||||
- enable: False
|
5
TEMPLATE/service/init.sls
Normal file
5
TEMPLATE/service/init.sls
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .running
|
17
TEMPLATE/service/running.sls
Normal file
17
TEMPLATE/service/running.sls
Normal file
@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- set sls_config_file = tplroot ~ '.config.file' %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as TEMPLATE with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_config_file }}
|
||||
|
||||
TEMPLATE-service-running-service-running:
|
||||
service.running:
|
||||
- name: {{ TEMPLATE.service.name }}
|
||||
- enable: True
|
||||
- watch:
|
||||
- sls: {{ sls_config_file }}
|
5
TEMPLATE/subcomponent/clean.sls
Normal file
5
TEMPLATE/subcomponent/clean.sls
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .config.clean
|
16
TEMPLATE/subcomponent/config/clean.sls
Normal file
16
TEMPLATE/subcomponent/config/clean.sls
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as TEMPLATE with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_service_clean }}
|
||||
|
||||
TEMPLATE-subcomponent-config-clean-file-absent:
|
||||
file.absent:
|
||||
- name: {{ TEMPLATE.subcomponent.config }}
|
||||
- watch_in:
|
||||
- sls: {{ sls_service_clean }}
|
27
TEMPLATE/subcomponent/config/file.sls
Normal file
27
TEMPLATE/subcomponent/config/file.sls
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- set sls_config_file = tplroot ~ '.config.file' %}
|
||||
{%- from tplroot ~ "/map.jinja" import mapdata as TEMPLATE with context %}
|
||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_config_file }}
|
||||
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
file.managed:
|
||||
- name: {{ TEMPLATE.subcomponent.config }}
|
||||
- source: {{ files_switch(['subcomponent-example.tmpl'],
|
||||
lookup='TEMPLATE-subcomponent-config-file-file-managed',
|
||||
use_subpath=True
|
||||
)
|
||||
}}
|
||||
- mode: 644
|
||||
- user: root
|
||||
- group: {{ TEMPLATE.rootgroup }}
|
||||
- makedirs: True
|
||||
- template: jinja
|
||||
- require_in:
|
||||
- sls: {{ sls_config_file }}
|
@ -0,0 +1,6 @@
|
||||
########################################################################
|
||||
# File managed by Salt at <{{ source }}>.
|
||||
# Your changes will be overwritten.
|
||||
########################################################################
|
||||
|
||||
This is a subcomponent example file from SaltStack template-formula.
|
@ -0,0 +1,6 @@
|
||||
########################################################################
|
||||
# File managed by Salt at <{{ source }}>.
|
||||
# Your changes will be overwritten.
|
||||
########################################################################
|
||||
|
||||
This is another subcomponent example file from SaltStack template-formula.
|
5
TEMPLATE/subcomponent/config/init.sls
Normal file
5
TEMPLATE/subcomponent/config/init.sls
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .file
|
5
TEMPLATE/subcomponent/init.sls
Normal file
5
TEMPLATE/subcomponent/init.sls
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
|
||||
include:
|
||||
- .config
|
114
bin/convert-formula.sh
Executable file
114
bin/convert-formula.sh
Executable file
@ -0,0 +1,114 @@
|
||||
#!/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
|
||||
|
||||
usage() {
|
||||
echo "usage: $(basename "$0") <new-formula-name>" 1>&2
|
||||
echo 1>&2
|
||||
echo "Convert template-formula to <new-formula-name>-formula." 1>&2
|
||||
echo "<new-formula-name> should be a string of lowercase characters, numbers or '-',\
|
||||
'_' only." 1>&2
|
||||
echo "<new-formula-name> should not be any of 'bin' 'docs' 'test'." 1>&2
|
||||
}
|
||||
|
||||
sedi() {
|
||||
# Run different sed -i arguments based on GNU vs BSD sed
|
||||
# See https://stackoverflow.com/a/38595160
|
||||
if sed --version >/dev/null 2>&1 ; then
|
||||
sed -i"" "$@"
|
||||
else
|
||||
sed -i "" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
args() {
|
||||
if [ $# -ne 1 ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
NEW_NAME=$1
|
||||
NEW_NAME_PYSAFE=$(echo "$NEW_NAME" | sed 's/-/__/g')
|
||||
if echo "$NEW_NAME" | grep -E --quiet --invert-match '^[a-z0-9_-]+$'; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if echo bin docs test | grep --quiet --word-regexp "$NEW_NAME"; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
convert_formula() {
|
||||
# Empty history and make commit message `semantic-release`-compliant
|
||||
# Works for forks of `template-formula` as well as GitHub "Use this template"
|
||||
# See https://stackoverflow.com/a/15572071/5009408
|
||||
git reset \
|
||||
"$(echo 'feat: initial commit' \
|
||||
| git commit-tree 'HEAD^{tree}')"
|
||||
git rm --quiet bin/convert-formula.sh AUTHORS.md CHANGELOG.md \
|
||||
docs/_static/css/custom.css docs/AUTHORS.rst docs/CHANGELOG.rst \
|
||||
docs/conf.py docs/CONTRIBUTING_DOCS.rst docs/index.rst
|
||||
tag_out=$(git tag --list | xargs git tag --delete)
|
||||
if [ "${DEBUG:-false}" = "true" ]; then
|
||||
echo "$tag_out"
|
||||
fi
|
||||
|
||||
git mv TEMPLATE "$NEW_NAME"
|
||||
|
||||
# Replace TEMPLATE within sls and jinja files with py-safe formula name
|
||||
# due to python limitations on identifier names (no hyphen)
|
||||
# including when specifying jinja context variables
|
||||
git ls-files -- '*.sls' '*.jinja' \
|
||||
| while read -r filename; do
|
||||
sedi "s/\({[{%#].*\)TEMPLATE/\1${NEW_NAME_PYSAFE}/" "$filename"
|
||||
sedi "s/\([[:space:]]\{1,\}\)TEMPLATE:/\1${NEW_NAME_PYSAFE}:/" "$filename"
|
||||
done
|
||||
|
||||
# Temporarily, until the v5 `map.jinja` is implemented for this formula, this
|
||||
# specific py-safe replacement is also required (`map.jinja` import variable)
|
||||
sedi "s/TEMPLATE/${NEW_NAME_PYSAFE}/g" "${NEW_NAME}/_mapdata/init.sls"
|
||||
# However, this section will probably be needed even for the v5 `map.jinja`
|
||||
# All of the YAML comparison files need the py-safe `map.jinja` import variable
|
||||
git ls-files -- 'test/integration/*.yaml' \
|
||||
| while read -r filename; do
|
||||
sedi "/^\( \)TEMPLATE\(:\)$/s//\1${NEW_NAME_PYSAFE}\2/" "$filename"
|
||||
done
|
||||
|
||||
# Replace all other instances of TEMPLATE with the regular new formula name
|
||||
grep --recursive --files-with-matches --exclude-dir=.git TEMPLATE . \
|
||||
| while read -r filename; do
|
||||
sedi "s/TEMPLATE/${NEW_NAME}/g" "$filename"
|
||||
done
|
||||
|
||||
# Miscellaneous other replacements
|
||||
sedi 's/^\(version:\).*/\1 1.0.0/' FORMULA
|
||||
sedi 's/^\(*[[:space:]]\{1,\}\)@saltstack-formulas\/wg/\1@NONE/' CODEOWNERS
|
||||
|
||||
# Deleting lines between two patterns
|
||||
git ls-files -- '.gitlab-ci.yml' '.travis.yml' '.rubocop.yml' '*/map.jinja' \
|
||||
| while read -r filename; do
|
||||
sedi '/<REMOVEME/,/REMOVEME>/d' "$filename"
|
||||
done
|
||||
# shellcheck disable=SC1004 # This backslash+linefeed is literal (sed: replace text)
|
||||
sedi '/<REMOVEME/,/REMOVEME>/c \
|
||||
None
|
||||
' docs/README.rst
|
||||
|
||||
# Produce a commitlint-safe commit message (line length)
|
||||
if [ "${#NEW_NAME}" -gt 25 ]; then
|
||||
NEW_NAME_SHORT=$(echo "$NEW_NAME" | cut -c 1-23)'..'
|
||||
else
|
||||
NEW_NAME_SHORT="$NEW_NAME"
|
||||
fi
|
||||
# shellcheck disable=SC2016 # Expressions don't expand in single quotes
|
||||
git commit --quiet --all \
|
||||
--message 'feat: convert `template-formula` to `'"$NEW_NAME_SHORT"'-formula`' \
|
||||
--message 'BREAKING CHANGE: changed all state names and ids'
|
||||
}
|
||||
|
||||
args "$@"
|
||||
convert_formula
|
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')
|
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],
|
||||
},
|
||||
};
|
92
docs/AUTHORS.rst
Normal file
92
docs/AUTHORS.rst
Normal file
@ -0,0 +1,92 @@
|
||||
.. role:: raw-html-m2r(raw)
|
||||
:format: html
|
||||
|
||||
|
||||
Authors
|
||||
=======
|
||||
|
||||
This list is sorted by the number of commits per contributor in *descending* order.
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Avatar
|
||||
- Contributor
|
||||
- Contributions
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/10231489?v=4' width='36' height='36' alt='@myii'>`
|
||||
- `@myii <https://github.com/myii>`_
|
||||
- 316
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1233212?v=4' width='36' height='36' alt='@baby-gnu'>`
|
||||
- `@baby-gnu <https://github.com/baby-gnu>`_
|
||||
- 37
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/4195158?v=4' width='36' height='36' alt='@dafyddj'>`
|
||||
- `@dafyddj <https://github.com/dafyddj>`_
|
||||
- 31
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1800660?v=4' width='36' height='36' alt='@aboe76'>`
|
||||
- `@aboe76 <https://github.com/aboe76>`_
|
||||
- 27
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/242396?v=4' width='36' height='36' alt='@javierbertoli'>`
|
||||
- `@javierbertoli <https://github.com/javierbertoli>`_
|
||||
- 18
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/13322818?v=4' width='36' height='36' alt='@noelmcloughlin'>`
|
||||
- `@noelmcloughlin <https://github.com/noelmcloughlin>`_
|
||||
- 15
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/3433835?v=4' width='36' height='36' alt='@n-rodriguez'>`
|
||||
- `@n-rodriguez <https://github.com/n-rodriguez>`_
|
||||
- 8
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/52996?v=4' width='36' height='36' alt='@daks'>`
|
||||
- `@daks <https://github.com/daks>`_
|
||||
- 8
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1396878?v=4' width='36' height='36' alt='@gravyboat'>`
|
||||
- `@gravyboat <https://github.com/gravyboat>`_
|
||||
- 6
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1920805?v=4' width='36' height='36' alt='@alxwr'>`
|
||||
- `@alxwr <https://github.com/alxwr>`_
|
||||
- 5
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/4542588?v=4' width='36' height='36' alt='@evvers'>`
|
||||
- `@evvers <https://github.com/evvers>`_
|
||||
- 4
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/3374962?v=4' width='36' height='36' alt='@nmadhok'>`
|
||||
- `@nmadhok <https://github.com/nmadhok>`_
|
||||
- 3
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/16338056?v=4' width='36' height='36' alt='@vutny'>`
|
||||
- `@vutny <https://github.com/vutny>`_
|
||||
- 2
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/29522418?v=4' width='36' height='36' alt='@k-hamza'>`
|
||||
- `@k-hamza <https://github.com/k-hamza>`_
|
||||
- 2
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/528061?v=4' width='36' height='36' alt='@puneetk'>`
|
||||
- `@puneetk <https://github.com/puneetk>`_
|
||||
- 2
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/3536289?v=4' width='36' height='36' alt='@andygabby'>`
|
||||
- `@andygabby <https://github.com/andygabby>`_
|
||||
- 1
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1269218?v=4' width='36' height='36' alt='@Jokipii'>`
|
||||
- `@Jokipii <https://github.com/Jokipii>`_
|
||||
- 1
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/5306980?v=4' width='36' height='36' alt='@johnkeates'>`
|
||||
- `@johnkeates <https://github.com/johnkeates>`_
|
||||
- 1
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/611471?v=4' width='36' height='36' alt='@duk3luk3'>`
|
||||
- `@duk3luk3 <https://github.com/duk3luk3>`_
|
||||
- 1
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/3075069?v=4' width='36' height='36' alt='@marco-m'>`
|
||||
- `@marco-m <https://github.com/marco-m>`_
|
||||
- 1
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/91293?v=4' width='36' height='36' alt='@whiteinge'>`
|
||||
- `@whiteinge <https://github.com/whiteinge>`_
|
||||
- 1
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/22272?v=4' width='36' height='36' alt='@sroegner'>`
|
||||
- `@sroegner <https://github.com/sroegner>`_
|
||||
- 1
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/117961?v=4' width='36' height='36' alt='@babilen5'>`
|
||||
- `@babilen5 <https://github.com/babilen5>`_
|
||||
- 1
|
||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/2205993?v=4' width='36' height='36' alt='@GMAzrael'>`
|
||||
- `@GMAzrael <https://github.com/GMAzrael>`_
|
||||
- 1
|
||||
|
||||
|
||||
----
|
||||
|
||||
Auto-generated by a `forked version <https://github.com/myii/maintainer>`_ of `gaocegege/maintainer <https://github.com/gaocegege/maintainer>`_ on 2021-03-09.
|
1697
docs/CHANGELOG.rst
Normal file
1697
docs/CHANGELOG.rst
Normal file
File diff suppressed because it is too large
Load Diff
95
docs/CONTRIBUTING_DOCS.rst
Normal file
95
docs/CONTRIBUTING_DOCS.rst
Normal file
@ -0,0 +1,95 @@
|
||||
.. _contributing_docs:
|
||||
|
||||
Contributing documentation
|
||||
==========================
|
||||
|
||||
|docs|
|
||||
|
||||
.. |docs| image:: https://readthedocs.org/projects/docs/badge/?version=latest
|
||||
:alt: Documentation Status
|
||||
:scale: 100%
|
||||
:target: https://TEMPLATE-formula.readthedocs.io/en/latest/?badge=latest
|
||||
|
||||
Toolchain
|
||||
^^^^^^^^^
|
||||
|
||||
The documentation for this formula is written in
|
||||
`reStructuredText <https://en.wikipedia.org/wiki/ReStructuredText>`_
|
||||
(also known as RST, ReST, or reST).
|
||||
It is built by
|
||||
`Sphinx <https://en.wikipedia.org/wiki/Sphinx_(documentation_generator)>`_
|
||||
and hosted on
|
||||
`Read the Docs <https://en.wikipedia.org/wiki/Read_the_Docs>`_.
|
||||
|
||||
Adding a new page
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Adding a new page involves two steps:
|
||||
|
||||
#. Use the
|
||||
:ref:`provided page template <saltstack_formulas_rst_page_template>`
|
||||
to create a new page.
|
||||
#. Add the page name under the ``toctree`` list in ``index.rst``.
|
||||
|
||||
a. Do not just append it to the list.
|
||||
#. Select the best place where it fits within the overall documentation.
|
||||
|
||||
.. _saltstack_formulas_rst_page_template:
|
||||
|
||||
SaltStack-Formulas' RST page template
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Use the following template when creating a new page.
|
||||
This ensures consistency across the documentation for this formula.
|
||||
The heading symbols have been selected in accordance to the output rendered by the
|
||||
`Markdown to reStructuredText converter <https://github.com/miyakogi/m2r#restrictions>`_
|
||||
we are using for some of the pages of this documentation.
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
.. _template:
|
||||
|
||||
[Page title]
|
||||
============
|
||||
|
||||
[Introductory paragraph]
|
||||
|
||||
.. contents:: **Table of Contents**
|
||||
|
||||
[Heading 2]
|
||||
-----------
|
||||
|
||||
[Heading 3]
|
||||
^^^^^^^^^^^
|
||||
|
||||
[Heading 4]
|
||||
~~~~~~~~~~~
|
||||
|
||||
[Heading 5]
|
||||
"""""""""""
|
||||
|
||||
[Heading 6]
|
||||
###########
|
||||
|
||||
#. The first line is an anchor that can be used to link back to (the top of)
|
||||
this file.
|
||||
|
||||
a. Change this to be the lowercase version of the file name.
|
||||
#. Do not include the ``.rst`` file extension.
|
||||
#. Use hyphens (``-``) instead of spaces or non-letter characters.
|
||||
|
||||
#. Change the ``[Page title]`` accordingly, matching the same number of equals
|
||||
signs (``=``) underneath.
|
||||
#. Change the ``[Introductory paragraph]`` to be a short summary of the page
|
||||
content.
|
||||
Use no more than three paragraphs for this.
|
||||
#. Leave the ``..contents:: **Table of Contents**`` line as it is.
|
||||
#. Use the remaining headings as required to break up the page content.
|
||||
|
||||
a. You will rarely need to use beyond ``[Heading 4]``.
|
||||
#. Again, no single heading should have more than about three paragraphs of
|
||||
content before the next heading or sub-heading is used.
|
||||
|
||||
Obviously, it is not necessary to follow the steps in the order above.
|
||||
For example, it is usually easier to write the ``[Introductory paragraph]``
|
||||
at the end.
|
225
docs/README.rst
Normal file
225
docs/README.rst
Normal file
@ -0,0 +1,225 @@
|
||||
.. _readme:
|
||||
|
||||
TEMPLATE-formula
|
||||
================
|
||||
|
||||
|img_travis| |img_sr| |img_pc|
|
||||
|
||||
.. |img_travis| image:: https://travis-ci.com/saltstack-formulas/TEMPLATE-formula.svg?branch=master
|
||||
:alt: Travis CI Build Status
|
||||
:scale: 100%
|
||||
:target: https://travis-ci.com/saltstack-formulas/TEMPLATE-formula
|
||||
.. |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
|
||||
|
||||
A SaltStack formula that is empty. It has dummy content to help with a quick
|
||||
start on a new formula and it serves as a style guide.
|
||||
|
||||
.. 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
|
||||
|
||||
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
|
||||
|
||||
Special notes
|
||||
-------------
|
||||
|
||||
.. <REMOVEME
|
||||
|
||||
Using this template
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The easiest way to use this template formula as a base for a new formula is to use GitHub's **Use this template** button to create a new repository. For consistency with the rest of the formula ecosystem, name your formula repository following the pattern ``<formula theme>-formula``, where ``<formula theme>`` consists of lower-case alphabetic characters, numbers, '-' or '_'.
|
||||
|
||||
In the rest of this example we'll use ``example`` as the ``<formula theme>``.
|
||||
|
||||
Follow these steps to complete the conversion from ``template-formula`` to ``example-formula``. ::
|
||||
|
||||
$ git clone git@github.com:YOUR-USERNAME/example-formula.git
|
||||
$ cd example-formula/
|
||||
$ bin/convert-formula.sh example
|
||||
$ git push --force
|
||||
|
||||
Alternatively, it's possible to clone ``template-formula`` into a new repository and perform the conversion there. For example::
|
||||
|
||||
$ git clone https://github.com/saltstack-formulas/template-formula example-formula
|
||||
$ cd example-formula/
|
||||
$ bin/convert-formula.sh example
|
||||
|
||||
To take advantage of `semantic-release <https://github.com/semantic-release/semantic-release>`_ for automated changelog generation and release tagging, you will need a GitHub `Personal Access Token <https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line>`_ with at least the **public_repo** scope.
|
||||
|
||||
In the Travis repository settings for your new repository, create an `environment variable <https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-settings>`_ named ``GH_TOKEN`` with the personal access token as value, restricted to the ``master`` branch for security.
|
||||
|
||||
Note that this repository uses a `CODEOWNERS <https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners>`_ file to assign ownership to various parts of the formula. The conversion process removes overall ownership, but you should consider assigning ownership to yourself or your organisation when contributing your new formula to the ``saltstack-formulas`` organisation.
|
||||
|
||||
.. REMOVEME>
|
||||
|
||||
Available states
|
||||
----------------
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
``TEMPLATE``
|
||||
^^^^^^^^^^^^
|
||||
|
||||
*Meta-state (This is a state that includes other states)*.
|
||||
|
||||
This installs the TEMPLATE package,
|
||||
manages the TEMPLATE configuration file and then
|
||||
starts the associated TEMPLATE service.
|
||||
|
||||
``TEMPLATE.package``
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will install the TEMPLATE package only.
|
||||
|
||||
``TEMPLATE.config``
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will configure the TEMPLATE service and has a dependency on ``TEMPLATE.install``
|
||||
via include list.
|
||||
|
||||
``TEMPLATE.service``
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will start the TEMPLATE service and has a dependency on ``TEMPLATE.config``
|
||||
via include list.
|
||||
|
||||
``TEMPLATE.clean``
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
*Meta-state (This is a state that includes other states)*.
|
||||
|
||||
this state will undo everything performed in the ``TEMPLATE`` meta-state in reverse order, i.e.
|
||||
stops the service,
|
||||
removes the configuration file and
|
||||
then uninstalls the package.
|
||||
|
||||
``TEMPLATE.service.clean``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will stop the TEMPLATE service and disable it at boot time.
|
||||
|
||||
``TEMPLATE.config.clean``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will remove the configuration of the TEMPLATE service and has a
|
||||
dependency on ``TEMPLATE.service.clean`` via include list.
|
||||
|
||||
``TEMPLATE.package.clean``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will remove the TEMPLATE package and has a depency on
|
||||
``TEMPLATE.config.clean`` via include list.
|
||||
|
||||
``TEMPLATE.subcomponent``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
*Meta-state (This is a state that includes other states)*.
|
||||
|
||||
This state installs a subcomponent configuration file before
|
||||
configuring and starting the TEMPLATE service.
|
||||
|
||||
``TEMPLATE.subcomponent.config``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will configure the TEMPLATE subcomponent and has a
|
||||
dependency on ``TEMPLATE.config`` via include list.
|
||||
|
||||
``TEMPLATE.subcomponent.config.clean``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This state will remove the configuration of the TEMPLATE subcomponent
|
||||
and reload the TEMPLATE service by a dependency on
|
||||
``TEMPLATE.service.running`` via include list and ``watch_in``
|
||||
requisite.
|
||||
|
||||
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 ``TEMPLATE`` 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
|
20
docs/_static/css/custom.css
vendored
Normal file
20
docs/_static/css/custom.css
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Override styles for in-use Sphinx theme
|
||||
*/
|
||||
|
||||
/* The next two `.wy`-based rules are specifically needed for the dealing with */
|
||||
/* the `sphinx_rtd_theme` bug where long lines do not wrap in tables */
|
||||
|
||||
/* override table width restrictions */
|
||||
.wy-table-responsive table th
|
||||
, .wy-table-responsive table td
|
||||
{
|
||||
/* !important prevents the common CSS stylesheets from
|
||||
overriding this as on RTD they are loaded after this stylesheet */
|
||||
white-space: normal !important;
|
||||
}
|
||||
|
||||
.wy-table-responsive
|
||||
{
|
||||
overflow: visible !important;
|
||||
}
|
173
docs/conf.py
Normal file
173
docs/conf.py
Normal file
@ -0,0 +1,173 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Configuration file for the Sphinx documentation builder.
|
||||
|
||||
This file does only contain a selection of the most common options. For a
|
||||
full list see the documentation:
|
||||
|
||||
* http://www.sphinx-doc.org/en/stable/config
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import division, print_function, unicode_literals
|
||||
|
||||
# from datetime import datetime
|
||||
|
||||
from recommonmark.parser import CommonMarkParser
|
||||
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
__author__ = 'Imran Iqbal' # noqa: E221
|
||||
__copyright__ = 'Copyright (C) 2019, MYII' # noqa: E221
|
||||
__license__ = 'Apache-2.0' # noqa: E221
|
||||
__version__ = 'latest' # noqa: E221
|
||||
__maintainer__ = 'Imran Iqbal' # noqa: E221
|
||||
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'template-formula'
|
||||
copyright = __copyright__.replace('Copyright (C) ', '') # noqa: A001
|
||||
author = __author__
|
||||
version = __version__
|
||||
release = __version__
|
||||
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#
|
||||
# needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = []
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['templates', '_templates', '.templates']
|
||||
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
#
|
||||
source_suffix = ['.rst', '.md']
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
|
||||
# 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']
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
|
||||
# -- Options for the reStructuredText parser ---------------------------------
|
||||
|
||||
file_insertion_enabled = False
|
||||
|
||||
|
||||
# -- 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'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#
|
||||
# html_theme_options = {}
|
||||
|
||||
# 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']
|
||||
|
||||
# Custom sidebar templates, must be a dictionary that maps document names
|
||||
# to template names.
|
||||
#
|
||||
# The default sidebars (for documents that don't match any pattern) are
|
||||
# defined by theme itself. Builtin themes are using these templates by
|
||||
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
|
||||
# 'searchbox.html']``.
|
||||
#
|
||||
# html_sidebars = {}
|
||||
|
||||
|
||||
# -- Options for HTMLHelp output ---------------------------------------------
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'template-formula'
|
||||
|
||||
|
||||
# -- Options for Markdown output ---------------------------------------------
|
||||
|
||||
source_parsers = {
|
||||
'.md': CommonMarkParser,
|
||||
}
|
||||
|
||||
|
||||
# -- Options for LaTeX output ------------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#
|
||||
# 'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#
|
||||
# 'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(
|
||||
'index',
|
||||
'template-formula.tex',
|
||||
u'template-formula Documentation',
|
||||
u'',
|
||||
'manual',
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
# -- Functions: `setup`, docstring preprocessing, etc. -----------------------
|
||||
|
||||
def setup(app):
|
||||
"""Prepare the Sphinx application object.
|
||||
|
||||
Used for providing a custom CSS file for override styles.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
app : object
|
||||
The Sphinx application object.
|
||||
|
||||
Returns
|
||||
-------
|
||||
app : object
|
||||
The Sphinx application object.
|
||||
|
||||
"""
|
||||
app.add_stylesheet('css/custom.css')
|
||||
return app
|
20
docs/index.rst
Normal file
20
docs/index.rst
Normal file
@ -0,0 +1,20 @@
|
||||
.. _index:
|
||||
|
||||
.. ``template-formula`` documentation master file.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to template-formula's documentation!
|
||||
============================================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents
|
||||
:numbered:
|
||||
:glob:
|
||||
|
||||
README <README>
|
||||
CONTRIBUTING
|
||||
TOFS_pattern
|
||||
AUTHORS
|
||||
CHANGELOG
|
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 ``TEMPLATE`` 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 ``TEMPLATE`` formula
|
||||
`````````````````````````````````````````````````````
|
||||
|
||||
Now, we can provides the per DNS domain name configuration files for the ``TEMPLATE`` formulas under ``/srv/salt/TEMPLATE/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/TEMPLATE/parameters/dns:domain/
|
||||
ln -s dns:domain /srv/salt/TEMPLATE/parameters/domain
|
||||
|
||||
We create a configuration for the DNS domain ``example.net`` in ``/srv/salt/TEMPLATE/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/TEMPLATE/parameters/dns:domain/example.com.yaml.jinja``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
values:
|
||||
config: /etc/template-formula-{{ grains['os_family'] }}.conf
|
||||
...
|
||||
|
||||
|
||||
Create per role configuration for ``TEMPLATE`` formula
|
||||
``````````````````````````````````````````````````````
|
||||
|
||||
Now, we can provides the per role configuration files for the ``TEMPLATE`` formulas under ``/srv/salt/TEMPLATE/parameters/``.
|
||||
|
||||
We create the directory for roles:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
mkdir -p /srv/salt/TEMPLATE/parameters/roles
|
||||
|
||||
We will define 2 roles:
|
||||
|
||||
- ``TEMPLATE/server``
|
||||
- ``TEMPLATE/client``
|
||||
|
||||
We create a configuration for the role ``TEMPLATE/server`` in ``/srv/salt/TEMPLATE/parameters/roles/TEMPLATE/server.yaml``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
values:
|
||||
config: /etc/template-formula-server.conf
|
||||
...
|
||||
|
||||
We create another configuration for the role ``TEMPLATE/client`` in ``/srv/salt/TEMPLATE/parameters/roles/TEMPLATE/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 TEMPLATE/server
|
||||
|
||||
For the clients:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
salt 'client-*' grains.append roles TEMPLATE/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/TEMPLATE/parameters/dns:domain/ '/srv/salt/TEMPLATE/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:: jinja2
|
||||
|
||||
---
|
||||
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://parameters/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 TEMPLATE with context %}
|
||||
|
||||
test-does-nothing-but-display-TEMPLATE-as-json:
|
||||
test.nop:
|
||||
- name: {{ TEMPLATE | 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/TEMPLATE/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 TEMPLATE with context %}
|
||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||
|
||||
include:
|
||||
- {{ sls_package_install }}
|
||||
|
||||
TEMPLATE-config-file-file-managed:
|
||||
file.managed:
|
||||
- name: {{ TEMPLATE.config }}
|
||||
- source: {{ files_switch(['example.tmpl'],
|
||||
lookup='TEMPLATE-config-file-file-managed'
|
||||
)
|
||||
}}
|
||||
- mode: 644
|
||||
- user: root
|
||||
- group: {{ TEMPLATE.rootgroup }}
|
||||
- makedirs: True
|
||||
- template: jinja
|
||||
- require:
|
||||
- sls: {{ sls_package_install }}
|
||||
- context:
|
||||
TEMPLATE: {{ TEMPLATE | json }}
|
||||
|
||||
This ``sls`` file expose a ``TEMPLATE`` 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
|
||||
{{ TEMPLATE | json }}
|
||||
|
||||
winner of the merge: {{ TEMPLATE['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/TEMPLATE/config/file.sls: https://github.com/saltstack-formulas/template-formula/blob/master/TEMPLATE/config/file.sls
|
||||
.. _bug 58726: https://github.com/saltstack/salt/issues/58726
|
367
kitchen.yml
Normal file
367
kitchen.yml
Normal file
@ -0,0 +1,367 @@
|
||||
# -*- 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: /lib/systemd/systemd
|
||||
|
||||
platforms:
|
||||
## SALT `tiamat`
|
||||
- name: debian-10-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:debian-10
|
||||
- name: debian-9-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:debian-9
|
||||
- name: ubuntu-2004-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:ubuntu-20.04
|
||||
- name: ubuntu-1804-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:ubuntu-18.04
|
||||
- name: ubuntu-1604-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:ubuntu-16.04
|
||||
- name: centos-8-tiamat-py3
|
||||
driver:
|
||||
image: saltimages/salt-tiamat-py3:centos-8
|
||||
- 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
|
||||
|
||||
## SALT `master`
|
||||
- name: debian-10-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:debian-10
|
||||
- name: debian-9-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:debian-9
|
||||
- name: ubuntu-2004-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:ubuntu-20.04
|
||||
- name: ubuntu-1804-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:ubuntu-18.04
|
||||
- name: ubuntu-1604-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:ubuntu-16.04
|
||||
- name: centos-8-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:centos-8
|
||||
- name: centos-7-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:centos-7
|
||||
- name: fedora-33-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:fedora-33
|
||||
- name: fedora-32-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:fedora-32
|
||||
- name: opensuse-leap-152-master-py3
|
||||
driver:
|
||||
image: saltimages/salt-master-py3:opensuse-leap-15.2
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
# Workaround to avoid intermittent failures on `opensuse-leap-15.2`:
|
||||
# => 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
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
# 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: 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
|
||||
|
||||
## SALT `3002.5`
|
||||
- name: debian-10-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:debian-10
|
||||
- name: debian-9-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:debian-9
|
||||
- name: ubuntu-2004-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:ubuntu-20.04
|
||||
- name: ubuntu-1804-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:ubuntu-18.04
|
||||
- name: ubuntu-1604-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:ubuntu-16.04
|
||||
- name: centos-8-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:centos-8
|
||||
- name: centos-7-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:centos-7
|
||||
- name: fedora-33-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:fedora-33
|
||||
- name: fedora-32-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:fedora-32
|
||||
- name: amazonlinux-2-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:amazonlinux-2
|
||||
- name: oraclelinux-8-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:oraclelinux-8
|
||||
- name: oraclelinux-7-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:oraclelinux-7
|
||||
- name: arch-base-latest-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:arch-base-latest
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
- name: gentoo-stage3-latest-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:gentoo-stage3-latest
|
||||
run_command: /sbin/init
|
||||
- name: gentoo-stage3-systemd-3002-5-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.5-py3:gentoo-stage3-systemd
|
||||
|
||||
## SALT `3002.2`
|
||||
- name: opensuse-leap-152-3002-2-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.2-py3:opensuse-leap-15.2
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
# Workaround to avoid intermittent failures on `opensuse-leap-15.2`:
|
||||
# => SCP did not finish successfully (255): (Net::SCP::Error)
|
||||
transport:
|
||||
max_ssh_sessions: 1
|
||||
- name: opensuse-tmbl-latest-3002-2-py3
|
||||
driver:
|
||||
image: saltimages/salt-3002.2-py3:opensuse-tumbleweed-latest
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
# Workaround to avoid intermittent failures on `opensuse-tumbleweed`:
|
||||
# => SCP did not finish successfully (255): (Net::SCP::Error)
|
||||
transport:
|
||||
max_ssh_sessions: 1
|
||||
|
||||
## SALT `3001.6`
|
||||
- name: debian-10-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:debian-10
|
||||
- name: debian-9-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:debian-9
|
||||
- name: ubuntu-2004-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:ubuntu-20.04
|
||||
- name: ubuntu-1804-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:ubuntu-18.04
|
||||
- name: ubuntu-1604-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:ubuntu-16.04
|
||||
- name: centos-8-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:centos-8
|
||||
- name: centos-7-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:centos-7
|
||||
- name: fedora-33-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:fedora-33
|
||||
- name: fedora-32-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:fedora-32
|
||||
- name: opensuse-leap-152-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:opensuse-leap-15.2
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
# Workaround to avoid intermittent failures on `opensuse-leap-15.2`:
|
||||
# => SCP did not finish successfully (255): (Net::SCP::Error)
|
||||
transport:
|
||||
max_ssh_sessions: 1
|
||||
- name: opensuse-tmbl-latest-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:opensuse-tumbleweed-latest
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
# 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-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:amazonlinux-2
|
||||
- name: oraclelinux-8-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:oraclelinux-8
|
||||
- name: oraclelinux-7-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:oraclelinux-7
|
||||
- name: arch-base-latest-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:arch-base-latest
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
- name: gentoo-stage3-latest-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:gentoo-stage3-latest
|
||||
run_command: /sbin/init
|
||||
- name: gentoo-stage3-systemd-3001-6-py3
|
||||
driver:
|
||||
image: saltimages/salt-3001.6-py3:gentoo-stage3-systemd
|
||||
|
||||
## SALT `3000.8`
|
||||
- name: debian-10-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:debian-10
|
||||
- name: debian-9-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:debian-9
|
||||
- name: ubuntu-1804-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:ubuntu-18.04
|
||||
- name: ubuntu-1604-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:ubuntu-16.04
|
||||
- name: centos-8-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:centos-8
|
||||
- name: centos-7-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:centos-7
|
||||
- name: opensuse-leap-152-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:opensuse-leap-15.2
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
# Workaround to avoid intermittent failures on `opensuse-leap-15.2`:
|
||||
# => SCP did not finish successfully (255): (Net::SCP::Error)
|
||||
transport:
|
||||
max_ssh_sessions: 1
|
||||
- name: amazonlinux-2-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:amazonlinux-2
|
||||
- name: oraclelinux-8-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:oraclelinux-8
|
||||
- name: oraclelinux-7-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:oraclelinux-7
|
||||
- name: gentoo-stage3-latest-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:gentoo-stage3-latest
|
||||
run_command: /sbin/init
|
||||
- name: gentoo-stage3-systemd-3000-8-py3
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py3:gentoo-stage3-systemd
|
||||
- name: ubuntu-1804-3000-8-py2
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py2:ubuntu-18.04
|
||||
- name: ubuntu-1604-3000-8-py2
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py2:ubuntu-16.04
|
||||
- name: arch-base-latest-3000-8-py2
|
||||
driver:
|
||||
image: saltimages/salt-3000.8-py2:arch-base-latest
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
|
||||
provisioner:
|
||||
name: salt_solo
|
||||
log_level: debug
|
||||
salt_install: none
|
||||
require_chef: false
|
||||
formula: TEMPLATE
|
||||
salt_copy_filter:
|
||||
- .kitchen
|
||||
- .git
|
||||
|
||||
verifier:
|
||||
# https://www.inspec.io/
|
||||
name: inspec
|
||||
sudo: true
|
||||
# cli, documentation, html, progress, json, json-min, json-rspec, junit
|
||||
reporter:
|
||||
- cli
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
excludes:
|
||||
- gentoo-stage3-latest-master-py3
|
||||
- gentoo-stage3-systemd-master-py3
|
||||
- gentoo-stage3-latest-3002-5-py3
|
||||
- gentoo-stage3-systemd-3002-5-py3
|
||||
- gentoo-stage3-latest-3001-6-py3
|
||||
- gentoo-stage3-systemd-3001-6-py3
|
||||
- gentoo-stage3-latest-3000-8-py3
|
||||
- gentoo-stage3-systemd-3000-8-py3
|
||||
provisioner:
|
||||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- TEMPLATE._mapdata
|
||||
- TEMPLATE
|
||||
pillars:
|
||||
top.sls:
|
||||
base:
|
||||
'*':
|
||||
- TEMPLATE
|
||||
- define_roles
|
||||
pillars_from_files:
|
||||
TEMPLATE.sls: pillar.example
|
||||
define_roles.sls: test/salt/pillar/define_roles.sls
|
||||
verifier:
|
||||
inspec_tests:
|
||||
- path: test/integration/default
|
||||
- name: gentoo
|
||||
includes:
|
||||
- gentoo-stage3-latest-master-py3
|
||||
- gentoo-stage3-systemd-master-py3
|
||||
- gentoo-stage3-latest-3002-5-py3
|
||||
- gentoo-stage3-systemd-3002-5-py3
|
||||
- gentoo-stage3-latest-3001-6-py3
|
||||
- gentoo-stage3-systemd-3001-6-py3
|
||||
- gentoo-stage3-latest-3000-8-py3
|
||||
- gentoo-stage3-systemd-3000-8-py3
|
||||
provisioner:
|
||||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- TEMPLATE._mapdata
|
||||
- TEMPLATE
|
||||
pillars:
|
||||
top.sls:
|
||||
base:
|
||||
'*':
|
||||
- TEMPLATE
|
||||
- gentoo
|
||||
- define_roles
|
||||
pillars_from_files:
|
||||
TEMPLATE.sls: pillar.example
|
||||
gentoo.sls: test/salt/pillar/gentoo.sls
|
||||
define_roles.sls: test/salt/pillar/define_roles.sls
|
||||
verifier:
|
||||
inspec_tests:
|
||||
- path: test/integration/default
|
57
pillar.example
Normal file
57
pillar.example
Normal file
@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
TEMPLATE:
|
||||
lookup:
|
||||
master: template-master
|
||||
# Just for testing purposes
|
||||
winner: lookup
|
||||
added_in_lookup: lookup_value
|
||||
|
||||
# Using bash package and udev service as an example. This allows us to
|
||||
# test the template formula itself. You should set these parameters to
|
||||
# examples that make sense in the contexto of the formula you're writing.
|
||||
pkg:
|
||||
name: bash
|
||||
service:
|
||||
name: systemd-journald
|
||||
config: /etc/template-formula.conf
|
||||
|
||||
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://TEMPLATE/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:
|
||||
# TEMPLATE-config-file-file-managed:
|
||||
# - 'example_alt.tmpl'
|
||||
# - 'example_alt.tmpl.jinja'
|
||||
|
||||
# For testing purposes
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- 'example.tmpl.jinja'
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- 'subcomponent-example.tmpl.jinja'
|
||||
|
||||
# Just for testing purposes
|
||||
winner: pillar
|
||||
added_in_pillar: pillar_value
|
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 `m2r` to convert automatically produced `.md` docs to `.rst`
|
||||
###############################################################################
|
||||
|
||||
# Install `m2r`
|
||||
pip3 install m2r
|
||||
|
||||
# Copy and then convert the `.md` docs
|
||||
cp ./*.md docs/
|
||||
cd docs/ || exit
|
||||
m2r --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 ..
|
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/saltstack-formulas/template-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 'TEMPLATE._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 'TEMPLATE.config.file' do
|
||||
title 'Verify the configuration file'
|
||||
|
||||
describe file('/etc/template-formula.conf') 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": '\
|
||||
'{"TEMPLATE-config-file-file-managed": ["example.tmpl.jinja"], '\
|
||||
'"TEMPLATE-subcomponent-config-file-file-managed": '\
|
||||
'["subcomponent-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
|
21
test/integration/default/controls/packages.rb
Normal file
21
test/integration/default/controls/packages.rb
Normal file
@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Prepare platform "finger"
|
||||
platform_finger = system.platform[:finger].split('.').first.to_s
|
||||
|
||||
control 'TEMPLATE.package.install' do
|
||||
title 'The required package should be installed'
|
||||
|
||||
# Overide by `platform_finger`
|
||||
package_name =
|
||||
case platform_finger
|
||||
when 'centos-6', 'amazonlinux-1'
|
||||
'cronie'
|
||||
else
|
||||
'bash'
|
||||
end
|
||||
|
||||
describe package(package_name) do
|
||||
it { should be_installed }
|
||||
end
|
||||
end
|
23
test/integration/default/controls/services.rb
Normal file
23
test/integration/default/controls/services.rb
Normal file
@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Prepare platform "finger"
|
||||
platform_finger = system.platform[:finger].split('.').first.to_s
|
||||
|
||||
control 'TEMPLATE.service.running' do
|
||||
title 'The service should be installed, enabled and running'
|
||||
|
||||
# Overide by `platform_finger`
|
||||
service_name =
|
||||
case platform_finger
|
||||
when 'centos-6', 'amazonlinux-1'
|
||||
'crond'
|
||||
else
|
||||
'systemd-journald'
|
||||
end
|
||||
|
||||
describe service(service_name) do
|
||||
it { should be_installed }
|
||||
it { should be_enabled }
|
||||
it { should be_running }
|
||||
end
|
||||
end
|
25
test/integration/default/controls/subcomponent_config.rb
Normal file
25
test/integration/default/controls/subcomponent_config.rb
Normal file
@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
control 'TEMPLATE.subcomponent.config.file' do
|
||||
title 'Verify the subcomponent configuration file'
|
||||
|
||||
describe file('/etc/TEMPLATE-subcomponent-formula.conf') 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(
|
||||
'# File managed by Salt at '\
|
||||
'<salt://TEMPLATE/subcomponent/config/files/default/'\
|
||||
'subcomponent-example.tmpl.jinja>.'
|
||||
)
|
||||
end
|
||||
its('content') do
|
||||
should include(
|
||||
'This is another subcomponent example file from SaltStack '\
|
||||
'template-formula.'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
44
test/integration/default/files/_mapdata/amazonlinux-1.yaml
Normal file
44
test/integration/default/files/_mapdata/amazonlinux-1.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: cronie
|
||||
rootgroup: root
|
||||
service:
|
||||
name: crond
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
44
test/integration/default/files/_mapdata/amazonlinux-2.yaml
Normal file
44
test/integration/default/files/_mapdata/amazonlinux-2.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
@ -0,0 +1,44 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# Arch
|
||||
---
|
||||
values:
|
||||
added_in_defaults: defaults_value
|
||||
added_in_lookup: lookup_value
|
||||
added_in_pillar: pillar_value
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
44
test/integration/default/files/_mapdata/centos-6.yaml
Normal file
44
test/integration/default/files/_mapdata/centos-6.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: cronie
|
||||
rootgroup: root
|
||||
service:
|
||||
name: crond
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
44
test/integration/default/files/_mapdata/centos-7.yaml
Normal file
44
test/integration/default/files/_mapdata/centos-7.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
44
test/integration/default/files/_mapdata/centos-8.yaml
Normal file
44
test/integration/default/files/_mapdata/centos-8.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
44
test/integration/default/files/_mapdata/debian-10.yaml
Normal file
44
test/integration/default/files/_mapdata/debian-10.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
44
test/integration/default/files/_mapdata/debian-9.yaml
Normal file
44
test/integration/default/files/_mapdata/debian-9.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
44
test/integration/default/files/_mapdata/fedora-31.yaml
Normal file
44
test/integration/default/files/_mapdata/fedora-31.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
44
test/integration/default/files/_mapdata/fedora-32.yaml
Normal file
44
test/integration/default/files/_mapdata/fedora-32.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
44
test/integration/default/files/_mapdata/fedora-33.yaml
Normal file
44
test/integration/default/files/_mapdata/fedora-33.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
44
test/integration/default/files/_mapdata/gentoo-2-sysd.yaml
Normal file
44
test/integration/default/files/_mapdata/gentoo-2-sysd.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
arch: amd64
|
||||
config: /etc/template-formula.conf
|
||||
lookup:
|
||||
added_in_lookup: lookup_value
|
||||
master: template-master
|
||||
winner: lookup
|
||||
map_jinja:
|
||||
sources:
|
||||
- Y:G@osarch
|
||||
- Y:G@os_family
|
||||
- Y:G@os
|
||||
- Y:G@osfinger
|
||||
- C@TEMPLATE:lookup
|
||||
- C@TEMPLATE
|
||||
- Y:G@id
|
||||
master: template-master
|
||||
pkg:
|
||||
name: app-shells/bash
|
||||
rootgroup: root
|
||||
service:
|
||||
name: systemd-journald
|
||||
subcomponent:
|
||||
config: /etc/TEMPLATE-subcomponent-formula.conf
|
||||
tofs:
|
||||
files_switch:
|
||||
- any/path/can/be/used/here
|
||||
- id
|
||||
- roles
|
||||
- osfinger
|
||||
- os
|
||||
- os_family
|
||||
source_files:
|
||||
TEMPLATE-config-file-file-managed:
|
||||
- example.tmpl.jinja
|
||||
TEMPLATE-subcomponent-config-file-file-managed:
|
||||
- subcomponent-example.tmpl.jinja
|
||||
winner: pillar
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user