# os\_nova\_flavor does not update a flavor if it already exists...

**URL:** <https://forum.ansible.com/t/os-nova-flavor-does-not-update-a-flavor-if-it-already-exists/21183>\
**Category:** Ansible Project\
**Created:** [April 17, 2016, 3:52pm UTC](https://forum.ansible.com/t/os-nova-flavor-does-not-update-a-flavor-if-it-already-exists/21183 "2016-04-17T15:52:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thiago\_Martins](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Thiago\_Martins](https://forum.ansible.com/u/Thiago_Martins)\
**Post date:** [April 17, 2016, 3:52pm UTC](https://forum.ansible.com/t/os-nova-flavor-does-not-update-a-flavor-if-it-already-exists/21183/1 "2016-04-17T15:52:30Z")

</div>

Guys,

I’m trying to update the default OpenStack flavors, by using “os\_nova\_flavor” but, it does not update the flavors settings if it already exists…

Is there any way to force it to update the flavors?

A workaround is to first, delete the flavors, and then, create it again. But this is bad because every time I run Ansible, it will delete and recreate the flavors over and over again.

My intention is to update the flavors, only if it is different. For example:

---

<div class="post-metadata">

**Author:** ![David\_Shrewsbury1](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@David\_Shrewsbury1](https://forum.ansible.com/u/David_Shrewsbury1)\
**Post date:** [April 17, 2016, 9:27pm UTC](https://forum.ansible.com/t/os-nova-flavor-does-not-update-a-flavor-if-it-already-exists/21183/2 "2016-04-17T21:27:46Z")

</div>

The Nova API does not have any way to update flavors. Because of this, the Ansible  
module does not support updating.

---

<div class="post-metadata">

**Author:** ![Thiago\_Martins](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Thiago\_Martins](https://forum.ansible.com/u/Thiago_Martins)\
**Post date:** [April 17, 2016, 10:13pm UTC](https://forum.ansible.com/t/os-nova-flavor-does-not-update-a-flavor-if-it-already-exists/21183/3 "2016-04-17T22:13:21Z")

</div>

Mmm… Interesting…

How it is done via Horizon? Since I can manually update the flavors via Web GUI…

Don’t you think that Shade / Ansible can somehow, mimic Horizon “flavor update feature”?

---

<div class="post-metadata">

**Author:** ![David\_Shrewsbury1](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@David\_Shrewsbury1](https://forum.ansible.com/u/David_Shrewsbury1)\
**Post date:** [April 17, 2016, 11:28pm UTC](https://forum.ansible.com/t/os-nova-flavor-does-not-update-a-flavor-if-it-already-exists/21183/4 "2016-04-17T23:28:57Z")

</div>

Looks to me like horizon just does a delete/create. So it’s the same as your workaround.

[https://github.com/openstack/horizon/blob/b0f3ec3ace531c110f328d208cded302d2617f88/openstack\_dashboard/dashboards/admin/flavors/workflows.py#L304-L309](https://github.com/openstack/horizon/blob/b0f3ec3ace531c110f328d208cded302d2617f88/openstack_dashboard/dashboards/admin/flavors/workflows.py#L304-L309)

---

<div class="post-metadata">

**Author:** ![David\_Shrewsbury1](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@David\_Shrewsbury1](https://forum.ansible.com/u/David_Shrewsbury1)\
**Post date:** [April 18, 2016, 12:05pm UTC](https://forum.ansible.com/t/os-nova-flavor-does-not-update-a-flavor-if-it-already-exists/21183/5 "2016-04-18T12:05:47Z")

</div>

I just realized that someone could probably add the logic to compare the current flavor  
and the parameters and, if different, do the delete/create to simulate the update. I’d be  
happy to merge such a change if you wanted to propose it. I could add it to my list of  
changes to do, but it would be low priority.

---

<div class="post-metadata">

**Author:** ![Arun\_prasath](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@Arun\_prasath](https://forum.ansible.com/u/Arun_prasath)\
**Post date:** [March 8, 2018, 6:53am UTC](https://forum.ansible.com/t/os-nova-flavor-does-not-update-a-flavor-if-it-already-exists/21183/6 "2018-03-08T06:53:24Z")

</div>

Raised a PR for this issue - [https://github.com/ansible/ansible/pull/37170](https://github.com/ansible/ansible/pull/37170)
