No description
| _modules | ||
| _states | ||
| _utils | ||
| xd_templates/bash | ||
| .gitignore | ||
| README.md | ||
| requirements.txt | ||
utils-formula
This formula adds functionality to other formula's
Content
- libTOFS
- Pillar config
- Templates 3.1. bash/installer
1. libTOFS
this is a replacement for tofs.jinja, shipped by more official formula's.
usage:
my-state:
file.managed:
- source: {{ salt.xd_tofs.files_switch(['my-file.conf.jinja', 'my-file.conf'], tpldir = tpldir) }}
This will expand to:
my-state:
file.managed:
- source:
- salt://tpldir/files/{grain:id}/my-file.conf.jinja
- salt://tpldir/files/{grain:id}/my-file.conf
- salt://tpldir/files/{grain:os_family}/my-file.conf.jinja
- salt://tpldir/files/{grain:os_family}/my-file.conf
- salt://tpldir/files/default/my-file.conf.jinja
- salt://tpldir/files/default/my-file.conf
these files will be pulled from tpldir/files
NOTE:
tpldiris a variable that is populated by salt in yourslsfile.
2. Pillar config (_utils/xd_Config)
usage:
# file: _pillar/cups.py
from xd_Config import xd_Config, xd_Config_Property
__virtualname__ = 'cups'
def __virtual__():
return __virtualname__
class _cupsConfig(xd_Config):
# Supports computed properties
# This property will be available as pillar.cups.my_computed_property
@xd_Config_Property
def my_computed_property(self, original):
return "Hello, World"
# This property will be available as pillar.cups.my['custom-path']
@xd_Config_Property(path = ['my', 'custom-path'])
def my_custom_property2(self, original):
return "Other property"
def ext_pillar(minion_id, pillar, **config):
return _cupsConfig.ext_pillar(
minion_id,
pillar,
config,
opts = __opts__,
grains = __grains__,
salt = __salt__
)
The following must be enabled (and highstated if managed by salt) before using the pillar variables
# file: /etc/salt/master.conf (or /etc/salt/minion.conf if masterless)
ext_pillar:
- cups:
name: cups
path: [ cups ]
Now you are set-up to use the pillar configuration
3. Templates
3.1. bash/installer
TODO