mercredi 4 février 2015

Run salt states twice with different pillar data?


Vote count:

0




I have set up pillar data for websites, e.g. web_root, virtualhost and mysql:



web_root:
config_file: salt://some/path.conf
key: some data
directory_name: directoryA

virtualhost:
config_file: salt://some/path.conf
name: websiteA

mysql:
database:
- websiteA_db


These map to states for web_root, virtualhost and mysql (using formula).


I'd like to use have a minion run these states multiple times, using separate pillar data, e.g.



include:
- apache
- php
{% for instance in [instanceA, instanceB] -%}
{% load pillar data /pillar/{{ instance }} -%}
- web_root #run the state
- virtualhost #run the state
- mysql #run the state
{% endfor -%}


Is this possible? I know I can set up pillar data like so:



web_root:
instanceA:
config_file: salt://some/pathA.conf
key: some data
directory_name: directoryA
instanceB:
config_file: salt://some/pathB.conf
key: some data
directory_name: directoryB

virtualhost:
instanceA:
config_file: salt://some/pathA.conf
name: websiteA
instanceB:
config_file: salt://some/pathB.conf
name: websiteB

mysql:
database:
- websiteA_db
- websiteB_db


But it means I have to add loops to each state file, making it less readable as well as use different syntax, e.g. for mysql which is a formula with set syntax requirements.



asked 1 min ago







Run salt states twice with different pillar data?

Aucun commentaire:

Enregistrer un commentaire