Hey guys!
I’d like to emulate “migration” system for ansible provisioning of my servers. For example, let’s say:
- I add to my product “Feature A” which requires changes on hosts with role: elasticsearch, postgres, redis
2.Then I add “feature b” which partially rollbacks changes made for feature A on some servers.
Let’s say I’ve one common ansible(site.yml) playbook with includes:
include: - featurea/playbook.yml
include: - featureb/playbook.yml
And I apply my server changes using command ansible-playbook -i inventory_file site.yml
Right now, as far as I undetstand, all playbooks from site.yml would be executed always, if I use the command I mentioned above.
Sure, there’s a lot of ways to avoid it, like: storing facts about servers, something similar to: applied database for featureA, checking if changes required for featureA are in database and storing it into variable, and then skipping whole playbook for featurea BUT what is the best solution ? To be honest, as far as I understand ansible doesn’t support such feature. What do I expect from ansible ?
For intance, first time I executed site.yml, applied only: featurea/playbook.yml
While second time execution, I expected featureb/playbook.yml should be executed but featurea/playbook.yml. How do I achieve that ?
Maybe ansible tower may help here but I don’t want to setup ansible tower just for this purpose…