Environment sdb Module
SaltStack
New
None
all
This module allows access to environment variables using an sdb://
URI.
Example configuration for this module:
osenv:
driver: env
OS environment variables will be available to read via SDB. Please make sure you don't have any sensitive data in your environment variables!!
Example usage of sdb env module:
set some env var:
cmd.run:
- name: echo {{ salt['sdb.set']('sdb://osenv/foo', 'bar') }}
- order: 1
{% if salt['sdb.get']('sdb://osenv/foo') == 'bar' %}
always-changes-and-succeeds:
test.succeed_with_changes:
- name: foo
{% else %}
always-changes-and-fails:
test.fail_with_changes:
- name: foo
{% endif %}
The above example will return success.
The env
sdb module can also be used with salt cloud.
Assuming you have exported the environment variable named
compute
(and have osenv
defined).
The example below will look for the salt cloud config key compute_name
in the environment:
my-openstack-config:
compute_name: sdb://osenv/compute
..snip
Get a value
Set a key/value pair