mirror of
https://github.com/saltstack-formulas/template-formula.git
synced 2025-04-17 10:10:28 +00:00
update formula with map.jinja and style guide references, improve README and VERSION
This commit is contained in:
parent
95e5e37934
commit
775a9309e7
10 changed files with 100 additions and 31 deletions
|
@ -1,6 +1,31 @@
|
|||
template formula
|
||||
================
|
||||
|
||||
0.1.1 (2019-02-10)
|
||||
|
||||
- Update map.jinja and README
|
||||
- Add tags and update VERSION and CHANGELOG
|
||||
|
||||
0.1.0 (2019-02-08)
|
||||
|
||||
- Update formula with TOFS pattern
|
||||
|
||||
0.0.9 (2018-12-11)
|
||||
|
||||
- Add Version File
|
||||
|
||||
0.0.8 (2018-03-02)
|
||||
|
||||
- Align with Saltstack Official Documenation
|
||||
|
||||
0.0.7 (2017-06-18)
|
||||
|
||||
- Fix typos and comments
|
||||
|
||||
0.0.6 (2015-07-1)
|
||||
|
||||
- Improve style and jinja to match salt-Formula
|
||||
|
||||
0.0.5 (2014-07-28)
|
||||
|
||||
- Fixed broken link to Salt Formula documentation
|
||||
|
|
24
README.rst
24
README.rst
|
@ -3,7 +3,7 @@ template-formula
|
|||
================
|
||||
|
||||
A SaltStack formula that is empty. It has dummy content to help with a quick
|
||||
start on a new formula.
|
||||
start on a new formula and it serves as a style guide.
|
||||
|
||||
**NOTE**
|
||||
|
||||
|
@ -27,4 +27,24 @@ Available states
|
|||
``template``
|
||||
------------
|
||||
|
||||
Installs the template package, and starts the associated template service.
|
||||
Meta-state (This is a state that includes other states)
|
||||
|
||||
This installs the template package, and starts the associated template service.
|
||||
|
||||
``template.install``
|
||||
--------------------
|
||||
|
||||
This state will install the template package only.
|
||||
|
||||
``template.config``
|
||||
-------------------
|
||||
|
||||
This state will configure the template service and has a depency on ``template.install``
|
||||
via include list.
|
||||
|
||||
``template.service``
|
||||
--------------------
|
||||
|
||||
This state will start the template service and has a depency on ``template.config``
|
||||
via include list.
|
||||
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1,2 +1,2 @@
|
|||
# should contain the currently released version of the formula
|
||||
1.0.0
|
||||
0.0.6
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
template:
|
||||
lookup:
|
||||
master: template-master
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
{% from "template/map.jinja" import template with context %}
|
||||
{% from "template/macros.jinja" import files_switch with context %}
|
||||
|
||||
include:
|
||||
- template.install
|
||||
|
||||
template-config:
|
||||
file.managed:
|
||||
- name: {{ template.config }}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
template:
|
||||
pkg: template
|
||||
config: '/etc/template'
|
||||
|
|
|
@ -1,33 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=jinja
|
||||
|
||||
{## Start with defaults from defaults.yaml ##}
|
||||
{% import_yaml 'template/defaults.yaml' as default_settings %}
|
||||
{## Start imports as ##}
|
||||
{% import_yaml 'template/defaults.yaml' as defaults %}
|
||||
{% import_yaml 'template/osfamilymap.yaml' ad osfamilymap %}
|
||||
{% import_yaml 'template/osmap.yaml' ad osmap %}
|
||||
|
||||
{##
|
||||
Setup variables using grains['os_family'] based logic, only add key:values
|
||||
that differ from what is in defaults.yaml
|
||||
##}
|
||||
{% set os_family_map = salt['grains.filter_by']({
|
||||
'Debian': {},
|
||||
'Suse': {},
|
||||
'Arch': {
|
||||
"pkg" : 'template-arch',
|
||||
},
|
||||
'RedHat': {
|
||||
"config": '/etc/template.conf',
|
||||
},
|
||||
}
|
||||
, grain="os_family"
|
||||
, merge=salt['pillar.get']('template:lookup'))
|
||||
%}
|
||||
{## Merge the flavor_map to the default settings ##}
|
||||
{% do default_settings.template.update(os_family_map) %}
|
||||
{## merge the osfamilymap ##}
|
||||
{% set osfamily = salt['grains.filter_by']('osfamilymap', grain='os_family_map') or{} %}
|
||||
{% do salt['defaults.merge'](defaults['template'], osfamily) %}
|
||||
|
||||
{## Merge in template:lookup pillar ##}
|
||||
{% set template = salt['pillar.get'](
|
||||
'template',
|
||||
default=default_settings.template,
|
||||
merge=True
|
||||
)
|
||||
%}
|
||||
{## merge the osmap ##}
|
||||
{% set osmap = salt['grains.filter_by']('osmap', grain='os') or{} %}
|
||||
{% do salt['defaults.merge'](defaults['template'], osmap) %}
|
||||
|
||||
{## merge the lookup ##}
|
||||
{% lookup = salt['pillar.get']('template:lookup', default={}, merge=True) %}
|
||||
{% do salt['defaults.merge'](defaults['template'], lookup) %}
|
||||
|
||||
{## merge the template pillar ##}
|
||||
{% set template = salt['pillar.get']('template', default=defaults['template'], merge=True) %}
|
||||
|
|
17
template/osfamilymap.yaml
Normal file
17
template/osfamilymap.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# # vim: ft=yaml
|
||||
---
|
||||
Debian:
|
||||
pkg: template-debian
|
||||
config: /etc/template.d/custom.conf
|
||||
|
||||
RedHat:
|
||||
pkg: template-redhat
|
||||
config: /etc/template.conf
|
||||
|
||||
Suse:
|
||||
pkg: template-suse
|
||||
|
||||
Arch:
|
||||
pkg: template-arch
|
||||
|
8
template/osmap.yaml
Normal file
8
template/osmap.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
Fedora:
|
||||
pkg: template-fedora
|
||||
|
||||
Ubuntu:
|
||||
pkg: template-ubuntu
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
{% from "template/map.jinja" import template with context %}
|
||||
|
||||
include:
|
||||
- template.config
|
||||
|
||||
template-name:
|
||||
service.running:
|
||||
- name: {{ template.service.name }}
|
||||
|
|
Loading…
Add table
Reference in a new issue