# How to Inject Host and Group Vars from Ansible into NetBox Config Templates

DevFeed: [How to Inject Host and Group Vars from Ansible into NetBox Config Templates](<https://devfeed.tech/articles/how-to-inject-host-and-group-vars-from-ansible-into-netbox-config-templates-30855.md>)

Original publisher: [Read original article](<https://www.packetcoders.io/how-to-inject-host-and-group-vars-from-ansible-into-netbox-config-templates/>)

Author: Rick Donato

Published: 2025-12-18T09:00:32Z

Content type: tutorial

Language: en

Sources: [Packet Coders - Learn Network Automation](<https://devfeed.tech/sources/packet-coders-learn-network-automation.md>)

Topics: [Ansible](<https://devfeed.tech/topics/ansible.md>), [NetBox](<https://devfeed.tech/topics/netbox.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [API](<https://devfeed.tech/topics/api.md>)

Tags: [ansible](<https://devfeed.tech/tags/ansible.md>), [api](<https://devfeed.tech/tags/api.md>), [config](<https://devfeed.tech/tags/config.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [example](<https://devfeed.tech/tags/example.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [netbox](<https://devfeed.tech/tags/netbox.md>), [templates](<https://devfeed.tech/tags/templates.md>), [tips](<https://devfeed.tech/tags/tips.md>)

## AI overview

A tutorial showing how to pass Ansible group_vars and host_vars into NetBox Config Templates so the variables can be used when rendering configuration.

## Source excerpt

Ansible and NetBox Tip: Pass Ansible group_vars and host_vars into NetBox Config Templates by sending your Ansible vars, making them available directly within your Config Templates. Here is an example: # Ansible Playbook - name: Trigger NetBox to return rendered configuration ansible.builtin.uri: url: "{{ NETBOX_ENDPOINT }}/api/dcim/