I have a Salt script that, among other things, initializes a Postgres database. After initializing the database, I want to read some properties from a file, and do an
INSERT (into a configuration table) for each key/value pair.
I've seen Salt's psql_query which should solve part of the problem. My question is, how do I iterate over the pairs in my property file, then do a query for each entry?
So, the file
key1 = value1 key2 = other value
should translate into salt
my_config_key1: - postgres.psql_query: query: UPDATE configuration SET value = 'value1' WHERE key = 'key1'; my_config_key2: - postgres.psql_query: query: UPDATE configuration SET value = 'other value' WHERE key = 'key2';
If there's a better way than a property file for passing in the key/values, that would be fine too.