ansible - small iterations server lifecycle

Hey guys!
I’d like to emulate “migration” system for ansible provisioning of my servers. For example, let’s say:

  1. 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…

Ideally, I’d like to have some “incremental” strategy which stores successfully applied “server migration” to database and then while next run it won’t execute it again

середа, 3 січня 2018 р. 01:54:53 UTC+1 користувач Sergey Glazyrin написав:

This seems to me to be ‘going against the grain’ of how ansible wants to work.

What I do is organise hosts into groups by their function, web server, database server etc and I have a playbook for provisioning/updating each server type. The playbooks share a lot of roles but if I need to do something for a specific server type then

If it takes a long time to check that your host is provisioned then there are various ways you can skip steps which only need to occur when the hosts are provisioned - by using tags or by skipping roles when some condition is met for example.

Your environments are likely to be different from mine though so I’d recommend experimenting and seeing what works for you. If you have lots of clients running lots of different versions of similar software packages I think what I describe wouldn’t work well.

Jon