Hi guys,
I'm new to salt and I'm migrating from Ansible.
I try to organise my configs and I would like to have your opinion about the best salty way to do it.
I want to deploy apps with salt.
Each app is defined by a set of parameters :
myapp1:
domain: myapp1.example.com
repository: github.com/plup/myapp1
myapp2:
domain: myapp2.example.com
repository: github.com/plup/myapp2
And each app has one profile (django, nodejs,...) which is configured in a state file profile/init.sls (simplified for the example) :
deploy {{ app }}:
cmd.run:
- name: 'echo I\'m deploying {{ app }}'
file.managed:
- name: '/tmp/{{ app }}.conf'
- source: 'salt://{{ slspath }}/tmpl.j2'
- template: jinja
With the template file profile/tmpl.j2 :
You will find the source code of {{ app }} at {{ repository }}
And now I would like to deploy my applications with something like that:
salt '*' state.apply myapp1
salt '*' state.apply myapp2
I tried to use macro defining app parameters in myappX.sls files and calling the macro fonction from profile/init.sls. But it doesn't work with the variables in the template file.
I tried to use pillar to configure apps but as the entrypoint of deploy command is the profile/init.sls I didn't find a way to pass app specific parameters to the state file.
And now, I'm stuck. Any idea would by appreciated.