I have dynmaic inventory which has 10 nodes. 8 of them are RedHat and 2 of them are Ubuntu. The hosts are in random order.
I want to write a playbook so that it will patch the Ubuntu node at last after all the RedHat node are patched first. Instead of manipulating the inventory, how can I write a playbook for it?
I have written a playbook but it doesn’t work.
You may have a look into Conditionals based on
ansible_facts
and the following minimal example playbooks options.1.)
Documentation
ansible_facts
dnf
module – Manages packages with the dnf package managerapt
module – Manages apt-packages2.)
Depending if groups are used
Documentation
3.)
Documentation
import_tasks
module – Import a task listinclude_tasks
module – Dynamically include a task listinclude_tasks
andimport_tasks
?... and many more options to structure the upgrade process.