Closed hackel closed 6 years ago
@pcdummy @keesbos Please could you answer this question?
Nope. It doesn't. Right now you'll have to install the salt packages in the container too (to have salt configure the os/apps in the container).
It would be nice to have a roster like ssh but doing stuff via lxc. In that case we would just need the host to be salted.
I'm quite new to Saltstack, but I'm trying to script this saltifying with a pre-mounted bootstrap_minion.sh script:
salt-call lxd.container_execute container_name '["/premounted/bootstrap_minion.sh"]'
works ok and saltifies the minion succesfully. Now I'm trying to figure out how to do this from a state.sls file:
{% salt.lxd.container_execute('container_name',"/premounted/bootstrap_minion.sh") %}
gives failed: Jinja syntax error: Encountered unknown tag 'salt'.; line 21
Can somebody point me in the right direction?
Hi @morgana2313
Use the module state: https://docs.saltstack.com/en/latest/ref/states/all/salt.states.module.html
And sorry for the late reply.
@morgana2313 your state.sls would resemble:
run-lxd-module-exec:
module.run:
- name: lxd.container_execute
- m_name: container_name
- cmd: [ "/premounted/bootstrap_minion.sh" ]
I've added support for bootstraping/salitfying Containers, see: https://github.com/saltstack-formulas/lxd-formula/blob/master/pillar.example.yaml#L13
@pcdummy thanks for implementing this. I'm currently trying it out, but if I understand everything correctly, the salt master still needs to accepts the corresponding minion key (currently the newly created minion just times out).
Any ideas how that could be fixed?
Edit: created a new issue #13
Does this formula support automatically saltifying a container? It seems like I would have to manually install salt in the container to set it up as a minion. Or would it be better to figure out how to do this using salt-cloud?