# How to add var file in task level and not playbook level

**URL:** <https://forum.ansible.com/t/how-to-add-var-file-in-task-level-and-not-playbook-level/33626>\
**Category:** Ansible Project\
**Created:** [August 17, 2020, 7:33am UTC](https://forum.ansible.com/t/how-to-add-var-file-in-task-level-and-not-playbook-level/33626 "2020-08-17T07:33:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dudu.c](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dudu.c](https://forum.ansible.com/u/dudu.c)\
**Post date:** [August 17, 2020, 7:33am UTC](https://forum.ansible.com/t/how-to-add-var-file-in-task-level-and-not-playbook-level/33626/1 "2020-08-17T07:33:51Z")

</div>

This is not working

Thanks

```auto
- name: Update server etc/host 
  vars_files: /opt/defaults/defaults.yml
  lineinfile:
      path: /etc/hosts
      line: "{{ external_address }} {{ service_name }}"
      state: present
      backup: yes

```
