# \#template

**URL:** https://forum.ansible.com/tag/template/186.md

[Latest](https://forum.ansible.com/latest.md) · [Categories](https://forum.ansible.com/categories.md) · [Tags](https://forum.ansible.com/tags.md)

---

## [Re: Custom name for a template’s temporary file name?](https://forum.ansible.com/t/re-custom-name-for-a-template-s-temporary-file-name/45405)

<div class="topic-metadata">

**Author:** [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Replies:** 0\
**Last updated:** [February 25, 2026, 3:38pm UTC](https://forum.ansible.com/t/re-custom-name-for-a-template-s-temporary-file-name/45405 "2026-02-25T15:38:42Z")

</div>

While doing maintenance on some roles/playbooks, I came across several template tasks that create systemd service unit files. A few years ago I had a question about how to validate those: Custom name for a template's te…

---

## [Ansible Network Automation - Issue Rendering Jinja2 Template - Invalid input](https://forum.ansible.com/t/ansible-network-automation-issue-rendering-jinja2-template-invalid-input/45109)

<div class="topic-metadata">

**Author:** [@IPvSean](https://forum.ansible.com/u/IPvSean)\
**Replies:** 0\
**Last updated:** [January 14, 2026, 9:31pm UTC](https://forum.ansible.com/t/ansible-network-automation-issue-rendering-jinja2-template-invalid-input/45109 "2026-01-14T21:31:25Z")

</div>

Recent community reports around Ansible network automation stem from a regression introduced in ansible-core 2.19 related to how network \*\_config modules handle templating of the src parameter. Historically, some network…

---

## [\`ansible\_host\` with \`delegate\_to\` points to \`inventory\_hostname\`, not delegated host](https://forum.ansible.com/t/ansible-host-with-delegate-to-points-to-inventory-hostname-not-delegated-host/45075)

<div class="topic-metadata">

**Author:** [@marvic](https://forum.ansible.com/u/marvic)\
**Replies:** 7\
**Last updated:** [January 9, 2026, 9:27pm UTC](https://forum.ansible.com/t/ansible-host-with-delegate-to-points-to-inventory-hostname-not-delegated-host/45075 "2026-01-09T21:27:26Z")

</div>

Hello, I am quite new to Ansible, hence knowledge might be a bit rough on the edges. As follows is a simple reproduction example. inventory.yml: # Inventory has inlined variables for ease of use. # In practice these a…

---

## [Ansible 2.19 template change](https://forum.ansible.com/t/ansible-2-19-template-change/44336)

<div class="topic-metadata">

**Author:** [@k-cerman-qdt](https://forum.ansible.com/u/k-cerman-qdt)\
**Replies:** 12\
**Last updated:** [September 3, 2025, 8:04am UTC](https://forum.ansible.com/t/ansible-2-19-template-change/44336 "2025-09-03T08:04:16Z")

</div>

Hi, I upgraded to ansible 2.19.0 and start issuing lazy templating error. Current task - name: Setting conf file location ansible.builtin.set\_fact: \_autoConfFile: "{{ tmpDir }}/silent\_installation\_au…

---

## [How to use awx.awx.job\_launch usage](https://forum.ansible.com/t/how-to-use-awx-awx-job-launch-usage/44296)

<div class="topic-metadata">

**Author:** [@Warpzone](https://forum.ansible.com/u/Warpzone)\
**Replies:** 0\
**Last updated:** [August 14, 2025, 1:22pm UTC](https://forum.ansible.com/t/how-to-use-awx-awx-job-launch-usage/44296 "2025-08-14T13:22:55Z")

</div>

We use Ansible to baseline our Windows VM’s and it’s been working great for several years. However it’s got to a point that we need to branch things out between teams. I’ve configured a new project, template and linked …

---

## [Why do variables for a template need top be defined 'above' the template task?](https://forum.ansible.com/t/why-do-variables-for-a-template-need-top-be-defined-above-the-template-task/41007)

<div class="topic-metadata">

**Author:** [@halloleo](https://forum.ansible.com/u/halloleo)\
**Replies:** 4\
**Last updated:** [March 13, 2025, 11:18pm UTC](https://forum.ansible.com/t/why-do-variables-for-a-template-need-top-be-defined-above-the-template-task/41007 "2025-03-13T23:18:00Z")

</div>

I want to use ansible.builtin.template. So I tried as a task: - name: Create cfg file ansible.builtin.template: src: path/to/my/template.j2 dest: /path/to/output/file.conf vars: my\_port: 1234 with t…

---

## [Inline template into variable](https://forum.ansible.com/t/inline-template-into-variable/40818)

<div class="topic-metadata">

**Author:** [@vegivamp](https://forum.ansible.com/u/vegivamp)\
**Replies:** 3\
**Last updated:** [March 6, 2025, 12:53pm UTC](https://forum.ansible.com/t/inline-template-into-variable/40818 "2025-03-06T12:53:15Z")

</div>

Hi there, I’ve been trying to do something I think I already saw done, but I can’t get it to work: I want to parse an inline template into a variable. Everything I find is either to file (ansible.builtin.template task)…

---

## [Help looping over local directories](https://forum.ansible.com/t/help-looping-over-local-directories/40636)

<div class="topic-metadata">

**Author:** [@vinylen](https://forum.ansible.com/u/vinylen)\
**Replies:** 1\
**Last updated:** [February 26, 2025, 1:10pm UTC](https://forum.ansible.com/t/help-looping-over-local-directories/40636 "2025-02-26T13:10:43Z")

</div>

Hello! Our company is moving to Ansible from SaltStack and i’ve been tearing my hair out over this one thing that i cannot really seem to figure out how to do! Basically this is the code: - name: Template example pipel…

---

## [Why role cannot find template](https://forum.ansible.com/t/why-role-cannot-find-template/40379)

<div class="topic-metadata">

**Author:** [@rwagnergit](https://forum.ansible.com/u/rwagnergit)\
**Replies:** 6\
**Last updated:** [February 20, 2025, 8:56pm UTC](https://forum.ansible.com/t/why-role-cannot-find-template/40379 "2025-02-20T20:56:44Z")

</div>

Why would a role be able to find a template on one control machine but not another (both control machines are running out of the same git repo, so the playbooks/roles/templates/ansible.cfg are identical)? Directory stru…

---

## [AWX shared playbook between projects/templates?](https://forum.ansible.com/t/awx-shared-playbook-between-projects-templates/40233)

<div class="topic-metadata">

**Author:** [@dpowell](https://forum.ansible.com/u/dpowell)\
**Replies:** 5\
**Last updated:** [February 14, 2025, 6:44pm UTC](https://forum.ansible.com/t/awx-shared-playbook-between-projects-templates/40233 "2025-02-14T18:44:48Z")

</div>

Is it possible to share a playbook between projects? I’m able to share roles by creating a symlink but it doesn’t appear to work with playbooks. I have a playbook that basically includes a role which works between projec…

---

## [Regex\_replace behavior changes when multi-line string used](https://forum.ansible.com/t/regex-replace-behavior-changes-when-multi-line-string-used/39767)

<div class="topic-metadata">

**Author:** [@pabigot](https://forum.ansible.com/u/pabigot)\
**Replies:** 1\
**Last updated:** [January 22, 2025, 3:27pm UTC](https://forum.ansible.com/t/regex-replace-behavior-changes-when-multi-line-string-used/39767 "2025-01-22T15:27:27Z")

</div>

Using Ansible 2.18.1 core, this command: ansible-playbook repro.yml with this playbook: - name: Run the test play hosts: 127.0.0.1 connection: local tasks: - name: Map issue delegate\_to: localhost …

---

## [Template with to\_ini in a loop: 'str' object has no attribute 'items'](https://forum.ansible.com/t/template-with-to-ini-in-a-loop-str-object-has-no-attribute-items/11007)

<div class="topic-metadata">

**Author:** [@daks](https://forum.ansible.com/u/daks)\
**Replies:** 14\
**Last updated:** [November 25, 2024, 4:49pm UTC](https://forum.ansible.com/t/template-with-to-ini-in-a-loop-str-object-has-no-attribute-items/11007 "2024-11-25T16:49:44Z")

</div>

I’m trying to generate some files using ansible.builtin.template and I would like to use the community.general.to\_ini jinja filter. The problem is that I have an error The error was: ansible.errors.AnsibleFilterError: …

---

## [Unable to use Parentheses for Jinja2 functions in Conditionals](https://forum.ansible.com/t/unable-to-use-parentheses-for-jinja2-functions-in-conditionals/10843)

<div class="topic-metadata">

**Author:** [@AnthonyAnsible](https://forum.ansible.com/u/AnthonyAnsible)\
**Replies:** 3\
**Last updated:** [November 12, 2024, 5:41am UTC](https://forum.ansible.com/t/unable-to-use-parentheses-for-jinja2-functions-in-conditionals/10843 "2024-11-12T05:41:07Z")

</div>

Hello, I’m having problems using a Jinja2 function in an Ansible conditional and was hoping someone could please help me find a way around it. As far as I can tell I must use both parentheses and single quotes in the J…

---

## [Comments Don't Show Up in "Extra variables" Box?](https://forum.ansible.com/t/comments-dont-show-up-in-extra-variables-box/9593)

<div class="topic-metadata">

**Author:** [@Donny\_Ta](https://forum.ansible.com/u/Donny_Ta)\
**Replies:** 13\
**Last updated:** [October 3, 2024, 3:42pm UTC](https://forum.ansible.com/t/comments-dont-show-up-in-extra-variables-box/9593 "2024-10-03T15:42:16Z")

</div>

Hi, We just upgraded from AWX 21.x to the latest 24.6.1 version. We deploy it as containers from the devel branch. With that out of the way, we use comments in the “Extra variables” box to help users understand how to …

---

## [Feature Request: Grouping Templates in AWX for Better Visual Organization](https://forum.ansible.com/t/feature-request-grouping-templates-in-awx-for-better-visual-organization/8340)

<div class="topic-metadata">

**Author:** [@alvaroc20](https://forum.ansible.com/u/alvaroc20)\
**Replies:** 1\
**Last updated:** [September 9, 2024, 8:48am UTC](https://forum.ansible.com/t/feature-request-grouping-templates-in-awx-for-better-visual-organization/8340 "2024-09-09T08:48:16Z")

</div>

Hi! I would like to propose a feature that could improve the visual organization of templates within AWX. Often, there is a set of templates that are related in some way, making it helpful to group them together in view…

---

## [How instant is ansible.builtin.template?](https://forum.ansible.com/t/how-instant-is-ansible-builtin-template/8140)

<div class="topic-metadata">

**Author:** [@Jure\_Sah](https://forum.ansible.com/u/Jure_Sah)\
**Replies:** 2\
**Last updated:** [August 28, 2024, 5:58pm UTC](https://forum.ansible.com/t/how-instant-is-ansible-builtin-template/8140 "2024-08-28T17:58:51Z")

</div>

I have a system under high usage load which is sensitive to partially written files. Basically you can imagine the file as a blacklist, because of the high load some requests might bypass the blacklist if there is ever a…

---

## [Nested Jinja2 templates and template\_module](https://forum.ansible.com/t/nested-jinja2-templates-and-template-module/7421)

<div class="topic-metadata">

**Author:** [@yokodzun](https://forum.ansible.com/u/yokodzun)\
**Replies:** 9\
**Last updated:** [August 6, 2024, 7:38am UTC](https://forum.ansible.com/t/nested-jinja2-templates-and-template-module/7421 "2024-08-06T07:38:19Z")

</div>

I am using Ansible as part of my GitLab CI/CD pipeline, and I have separate playbooks for rendering configs for my app and Nginx. The folder structure looks like this ├── XXX/YYY/playbook.yml ├── templates │…

---

## [How do I get a list of diffs when looping around the template module?](https://forum.ansible.com/t/how-do-i-get-a-list-of-diffs-when-looping-around-the-template-module/6058)

<div class="topic-metadata">

**Author:** [@Sasa993](https://forum.ansible.com/u/Sasa993)\
**Replies:** 0\
**Last updated:** [May 29, 2024, 12:36pm UTC](https://forum.ansible.com/t/how-do-i-get-a-list-of-diffs-when-looping-around-the-template-module/6058 "2024-05-29T12:36:57Z")

</div>

Hi guys, I am working on an action plugin that is mostly a wrapper around a template module. It loops through a list of users and executes the template module for each user and their destination files. Everything works …

---

## [How to Use AWX 'limit' Value in Extra Vars or Playbook Variables"](https://forum.ansible.com/t/how-to-use-awx-limit-value-in-extra-vars-or-playbook-variables/5844)

<div class="topic-metadata">

**Author:** [@alvaroc20](https://forum.ansible.com/u/alvaroc20)\
**Replies:** 0\
**Last updated:** [May 16, 2024, 5:01pm UTC](https://forum.ansible.com/t/how-to-use-awx-limit-value-in-extra-vars-or-playbook-variables/5844 "2024-05-16T17:01:10Z")

</div>

Hello, I am currently working with AWX and I would like to know if it’s possible to use the limit value (which is defined by AWX) in the extra variables or directly within my playbook variables. Specifically, I want to …

---

## [Expressions vs. templates](https://forum.ansible.com/t/expressions-vs-templates/4386)

<div class="topic-metadata">

**Author:** [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Replies:** 2\
**Last updated:** [March 15, 2024, 6:58am UTC](https://forum.ansible.com/t/expressions-vs-templates/4386 "2024-03-15T06:58:23Z")

</div>

One thing that frequently causes quite some pain in Ansible are automatic conversion of templated strings to types (here’s yet another occurence which triggered me finally writing this post, after seeing many similar “bu…

---

## [CLI tool for rendering Jinja2 templates (with Ansible filters and tests)](https://forum.ansible.com/t/cli-tool-for-rendering-jinja2-templates-with-ansible-filters-and-tests/3669)

<div class="topic-metadata">

**Author:** [@kpfleming](https://forum.ansible.com/u/kpfleming)\
**Replies:** 2\
**Last updated:** [February 5, 2024, 3:16pm UTC](https://forum.ansible.com/t/cli-tool-for-rendering-jinja2-templates-with-ansible-filters-and-tests/3669 "2024-02-05T15:16:08Z")

</div>

This is partially Ansible related, but since Ansible users learn how to use Jinja2 templates and want to use them for everything, even outside of Ansible… After a social media post from @jpmens inspired me, I created Ji…

---

## [Whitespace in templates](https://forum.ansible.com/t/whitespace-in-templates/2173)

<div class="topic-metadata">

**Author:** [@devnull](https://forum.ansible.com/u/devnull)\
**Replies:** 7\
**Last updated:** [November 6, 2023, 8:50pm UTC](https://forum.ansible.com/t/whitespace-in-templates/2173 "2023-11-06T20:50:11Z")

</div>

Hi, it’s really a minor issue, but it’s at least annoying me in a way that I will ask for advice :slight\_smile: I am creating a config based on this Jinja template: listen-on port 53 { {% for ip in ips -%}…

---

## [Nginx configuration using Ansible](https://forum.ansible.com/t/nginx-configuration-using-ansible/1001)

<div class="topic-metadata">

**Author:** [@Akila](https://forum.ansible.com/u/Akila)\
**Replies:** 5\
**Last updated:** [October 6, 2023, 8:55am UTC](https://forum.ansible.com/t/nginx-configuration-using-ansible/1001 "2023-10-06T08:55:50Z")

</div>

Hi! im actually new to ansible and i need to change some multiple nginx files. since it kind of have a structure of server { } and location{} etc. also think there are more blocks of server{} and location{} in the etc in…
