# ios\_config module questions

**URL:** <https://forum.ansible.com/t/ios-config-module-questions/23483>\
**Category:** Ansible Project\
**Created:** [January 17, 2017, 9:54pm UTC](https://forum.ansible.com/t/ios-config-module-questions/23483 "2017-01-17T21:54:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stijn](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@Stijn](https://forum.ansible.com/u/Stijn)\
**Post date:** [January 17, 2017, 9:54pm UTC](https://forum.ansible.com/t/ios-config-module-questions/23483/1 "2017-01-17T21:54:45Z")

</div>

Hey everyone,

I’m giving Ansible a try and I’m quite impressed.  
I have a couple of questions regarding the ios\_config module.

`

---

<div class="post-metadata">

**Author:** ![psprygada](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@psprygada](https://forum.ansible.com/u/psprygada)\
**Post date:** [January 18, 2017, 11:34pm UTC](https://forum.ansible.com/t/ios-config-module-questions/23483/2 "2017-01-18T23:34:00Z")

</div>

Hi Stijn:

For the host argument use the following syntax: host: “{{ inventory\_hostname }}”  
That will replace the value for host based on the node defined in inventory.

For the using the env var you need to set that in your shell environment, not the inventory file. If you want to keep the password in the inventory file, then reference in your playbook as such:

[ios]  
ios01

[ios:vars]  
ios\_password=mysecret

ios\_config  
commands: show version  
host: “{{ inventory\_hostname }}”  
username: cisco  
password: “{{ ios\_password }}”

Lastly, with regards to how Ansible makes decisions about how to push config. Its based on what is in the running config with exact string matching. In other words, the values in lines must match exactly what is reflected in the device running-config otherwise Ansible thinks it needs to push the command.

---

<div class="post-metadata">

**Author:** ![Stijn](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@Stijn](https://forum.ansible.com/u/Stijn)\
**Post date:** [January 19, 2017, 3:43pm UTC](https://forum.ansible.com/t/ios-config-module-questions/23483/3 "2017-01-19T15:43:46Z")

</div>

Thanks a lot Peter, that works flawlessly.  
Regarding the pushing of the config I found the “mistake”, my config pushes the sequence of the ACL rules which is not shown in the running config. So that’s why there’s no exact match as you explained. I removed the sequence numbers and now it’s ok.

I tried the  
`save: yes`

option and that doesn’t seem to work. It says

`

fatal: [192.168.1.1]: FAILED! =\> {“changed”: false, “failed”: true, “msg”: “timeout trying to send command: copy running-config startup-config\r”}

`

I also think I know why it says that. When I run this command directly on the router I get

`

Router#copy running-config startup-config

Destination filename [startup-config]?

Building configuration…

[OK]

`

So it seems Ansible times out on the confirmation the router is expecting for the file to write to, in this case startup-config.  
This is an old box so don’t know if it’s the same on newer IOS versions, but this looks like a bug in the ios\_config module or am I doing something wrong?

Thanks everyone!!!  
Stijn
