# ansible  group\_vars still needs for vars: in playbook ?

**URL:** <https://forum.ansible.com/t/ansible-group-vars-still-needs-for-vars-in-playbook/25999>\
**Category:** Ansible Project\
**Created:** [November 11, 2017, 5:46pm UTC](https://forum.ansible.com/t/ansible-group-vars-still-needs-for-vars-in-playbook/25999 "2017-11-11T17:46:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Federico\_Olivieri](https://avatars.discourse-cdn.com/v4/letter/f/d78d45/32.png) [@Federico\_Olivieri](https://forum.ansible.com/u/Federico_Olivieri)\
**Post date:** [November 11, 2017, 5:46pm UTC](https://forum.ansible.com/t/ansible-group-vars-still-needs-for-vars-in-playbook/25999/1 "2017-11-11T17:46:26Z")

</div>

Hi all,  
I moved host variables from inventory to `group_vars/all`:

In one example I have seen on a book seems that, once moved the variable from playbook to `group_vars`, it is possible to remove `vars:` section from playbook (like the playbook automagically discover the `group_vars/all`. If I do that is not going to works. Still I need for vars: into playbook. Please see below. My question is: is it correct that I can remove `vars:` from playbook or not? In case is possible, what am I doing wrong?

From this:

vars:  
cisco\_asa:  
host: “{{ ansible\_host }}”  
username: “{{ username }}”  
password: “{{ password }}”  
authorize: “yes”  
auth\_pass: “{{ auth\_pass }}”  
transport: cli  
timeout: 60  
snmp\_host: [10.42.9.61, 10.42.9.62]

tasks:

- name: add new TSDP IPs  
asa\_config:  
lines:
- snmp-server host transit {{ item }} community 0 SaNu9eSu  
provider: “{{ cisco\_asa }}”  
with\_items: “{{ snmp\_host }}”  
register: result
- debug:  
var: result

to this:

vars:

# cisco\_asa:

# host: “{{ ansible\_host }}”

# username: “{{ username }}”

# password: “{{ password }}”

# authorize: “yes”

# auth\_pass: “{{ auth\_pass }}”

# transport: cli

# timeout: 60

snmp\_host: [10.42.9.61, 10.42.9.62]

tasks:

- name: add new TSDP IPs  
asa\_config:  
lines:
- snmp-server host transit {{ item }} community 0 SaNu9eSu

# provider: “{{ cisco\_asa }}”

with\_items: “{{ snmp\_host }}”  
register: result

- debug:  
var: result

federico@federico:~/git/ansible\_cisco $ ansible-playbook playbooks/update\_snmp\_asa.yml --check

PLAY [cisco\_test] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [add new TSDP IPs] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [IE23PVPNFW01] (item=10.42.9.61) =\> {“changed”: false, “failed”: true, “item”: “10.42.9.61”, “msg”: “unable to open shell. Please see: [https://docs.ansible.com/ansible/network\_debug\_troubleshooting.html#unable-to-open-shell](https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell)”}  
failed: [IE23PVPNFW01] (item=10.42.9.62) =\> {“changed”: false, “failed”: true, “item”: “10.42.9.62”, “msg”: “unable to open shell. Please see: [https://docs.ansible.com/ansible/network\_debug\_troubleshooting.html#unable-to-open-shell](https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell)”}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
IE23PVPNFW01 : ok=0 changed=0 unreachable=0 failed=1
