# virt\_net and ignore\_errors

**URL:** <https://forum.ansible.com/t/virt-net-and-ignore-errors/21903>\
**Category:** Ansible Project\
**Created:** [July 1, 2016, 3:20am UTC](https://forum.ansible.com/t/virt-net-and-ignore-errors/21903 "2016-07-01T03:20:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![foo](https://avatars.discourse-cdn.com/v4/letter/f/b19c9b/32.png) [@foo](https://forum.ansible.com/u/foo)\
**Post date:** [July 1, 2016, 3:20am UTC](https://forum.ansible.com/t/virt-net-and-ignore-errors/21903/1 "2016-07-01T03:20:39Z")

</div>

Hi,  
I’ve just started using ansible and I wanted to delete the “default” network created in my KVM install. I’m using the following syntax:

- name: destroy default network  
virt\_net: command=destroy name=default  
ignore\_errors: true

- name: undefine default network  
virt\_net: command=undefine name=default  
ignore\_errors: true

This works fine, but I had to put in the “ignore\_errors: true” flag because if i run this playbook more than once, the second time it will error out as the “default” network does not exist. On most other ansible tasks, for example when creating a linux user account, ansible will skip over it if the user account already exists and does not error out in the middle of the playbook.

Is there a way to do the same for my destroy and undefine commands in virt\_net? I’m not sure if what i’m doing is the cleanest method. I know in a perfect world, i would not be running this playbook more than once, but I am running it multiple times testing different additions to the playbook.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 1, 2016, 2:01pm UTC](https://forum.ansible.com/t/virt-net-and-ignore-errors/21903/2 "2016-07-01T14:01:18Z")

</div>

Remove command and add state=absent ?

- name: default network  
&nbsp;&nbsp;&nbsp;virt\_net: state=absent name=default

---

<div class="post-metadata">

**Author:** ![foo](https://avatars.discourse-cdn.com/v4/letter/f/b19c9b/32.png) [@foo](https://forum.ansible.com/u/foo)\
**Post date:** [July 1, 2016, 2:16pm UTC](https://forum.ansible.com/t/virt-net-and-ignore-errors/21903/3 "2016-07-01T14:16:26Z")

</div>

Worked like a champ!!! Thanks.
