ansible combination of “template” and “synchronize”?

The name of the picture


ansible combination of “template” and “synchronize”?



We have a large number of jinja templates and have been using Ansible's template_module to render them and deploy them locally, or on a remote nfs (mounted locally).


jinja



We now need to deply them on a remote machine's local disc, and the only thing comes to mind is Ansible synchronize_module. However, I cannot see a direct way to ask the synchronize module to render jina templates before rsyncing them remotely.


synchronize



What is the best way to do this under Ansible?





I am not shure, if I understood your question correctly. As far as I understood it, you want to place a rendered template file on a remote machine. But this is exactly what the template module can be used for: - template: src: /mytemplates/foo.j2 dest: /etc/file.conf will place the file on /etc/file.conf on the remote machine.
– Stefan Wegener
5 hours ago







@StefanWegener I can't see any option to specify the localhost and the remotehost?
– Meitham
5 hours ago





The remotehosts are defined via your inventory, if you want to execute it on your local machine, you could execute template in combination with local_action (docs.ansible.com/ansible/2.5/user_guide/…)
– Stefan Wegener
5 hours ago









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Keycloak server returning user_not_found error when user is already imported with LDAP

PHP parse/syntax errors; and how to solve them?

How to scale/resize CVPixelBufferRef in objective C, iOS