We run several Python virtual environments on our minions managed by salt.
The name of the system is build by this schema:
project_customer_stage
Example:
supercms_favoritcustomer_p
The pillar data:
systems:
- customer: favoritcustomer
project: supercms
stage: p
- customer: favoritcustomer
project: supercms
stage: q
For every virtualenv we have one linux user. Up to now we compute values like "home" like this:
{% for system in pillar.systems %}
{% set system_name = system.project + '_' + system.customer + '_' + system.stage %}
{% set system_home = '/home/' + system_name %}
...
But it is redundant.
How could we avoid copy+pasting {% set system_home = ...%}
?
I am like the way object oriented programming works:
- You could define a property for the home-directory
- If you need a different home-directory in a special case, then you could subclass the base class and overwrite the way the base class works.
In Salt you have YAML and templating ... Both nice things. But in my case OOP would be nice.