os_nova_flavor does not update a flavor if it already exists...

102 views
Skip to first unread message

Thiago Martins

unread,
Apr 17, 2016, 11:52:30 AM4/17/16
to Ansible Project
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:

---
- name: nova updating m1.small flavor
  environment: "{{admin_openrc_env}}"
  os_nova_flavor:
    state=present
    name=m1.small
    ram=2048
    swap=1024
    vcpus=2
    disk=20
    ephemeral=4
---

 I was thinking that, if "m1.small" flavor doesn't have those settings, it sill be "changed", otherwise, if it already have those settings, it will "not be changed / green Ansible ok".

 Is there any way to make it behaves like this?

Thanks!
Thiago

David Shrewsbury

unread,
Apr 17, 2016, 5:27:46 PM4/17/16
to Ansible Project
The Nova API does not have any way to update flavors. Because of this, the Ansible
module does not support updating.

Thiago Martins

unread,
Apr 17, 2016, 6:13:21 PM4/17/16
to Ansible Project
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"?

David Shrewsbury

unread,
Apr 17, 2016, 7:28:57 PM4/17/16
to Ansible Project

David Shrewsbury

unread,
Apr 18, 2016, 8:05:48 AM4/18/16
to Ansible Project
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.

Arun prasath

unread,
Mar 8, 2018, 1:53:24 AM3/8/18
to Ansible Project
Raised a PR for this issue - https://github.com/ansible/ansible/pull/37170
Reply all
Reply to author
Forward
0 new messages