Link: https://openstack.nimeyo.com/83165/?show=88496#a88496<br />
From: AndrewLiu <andrew.lhj@gmail.com><br />
<br />
<p>Recently, we find this feature of ansible:<br><a rel="nofollow" href="http://docs.ansible.com/ansible/playbooks_loops.html">http://docs.ansible.com/ansible/playbooks_loops.html</a><a rel="nofollow" href="https://openstack.nimeyo.com/tag/finding-first-matched-files">#finding-first-matched-files</a></p>
<p>A specific path of template file can be add in the ansible task.</p>
<p>If a user want to customize an non-ini template file, the user can copy the template file to the customization directory, and modify the template file as the user wants.</p>
<p>An example of how to modify the ansible task:</p>
<p>change from:</p>
<pre><code>- name: Copying over horizon.conf
template:
src: "{{ item }}.conf.j2"
dest: "{{ node_config_directory }}/{{ item }}/{{ item }}.conf"
with_items:
- "horizon"
</code></pre>
<p>to:</p>
<pre><code>- name: Copying over horizon.conf
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/horizon/horizon.conf"
with_first_found:
- "{{ node_custom_config }}/horizon.conf.j2"
- "horizon.conf.j2"
</code></pre>
<p>But a convention of how to organize the directory structure of customization template files should be addressed.</p>