F
F
fara_ib2018-12-17 18:08:55
Ansible
fara_ib, 2018-12-17 18:08:55

Variables in Ansible template?

Hello. Tell me about ansible.
There is a simple playbook, it installs nginx then copies the configuration files to the server and the certificate files.
There is a template file nginx.conf.j2 (located in playbooks/templates), but when it is copied, the variables {{ server_name }} {{ cerf_file }} {{ key_file }} are not replaced in it with the values ​​that are in the playbook file . If these variables {{}} are replaced in this file and the paths to the certificate files are specified, then everything works, the site rises.
Why is there no replacement in this file when copying? What is done wrong? In the playbook file, the values ​​of the variables are applied.
5c17bb97cd26a938731077.jpeg5c17bba260f10218741402.jpeg5c17bba90ab50626604482.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2018-12-17
@fara_ib

You used copy and you needed template to deliver nginx.conf
https://docs.ansible.com/ansible/latest/modules/te...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question