# Rolling upgrades based on dynamic-attribute

**URL:** <https://forum.ansible.com/t/rolling-upgrades-based-on-dynamic-attribute/35843>\
**Category:** Ansible Project\
**Created:** [October 11, 2021, 8:49am UTC](https://forum.ansible.com/t/rolling-upgrades-based-on-dynamic-attribute/35843 "2021-10-11T08:49:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Radu\_Stoenescu](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@Radu\_Stoenescu](https://forum.ansible.com/u/Radu_Stoenescu)\
**Post date:** [October 11, 2021, 8:49am UTC](https://forum.ansible.com/t/rolling-upgrades-based-on-dynamic-attribute/35843/1 "2021-10-11T08:49:32Z")

</div>

I’m trying to manage a set of hosts that make up a dynamic inventory with Ansible.

Based on the contents of a database that I can query from Ansible code - these hosts get assigned numbers is a sequence 0,1,2 …

I would like to apply a playbook to this inventory using this clustering - in other words, playbook gets applied to hosts with sequence number 0, after this batch is finished (playbook successfully applied to all) the playbook is applied to hosts with sequence number 1 and s.o.

I’m faulty new to Ansible and would really appreciate some pointers towards the idiomatic way of achieving this.

Thank you  
Rady
