Hello, I'm starting with Ansible and I have a question about the Playbook

Hello, I’m starting with Ansible and I have a question about the Playbook:

Assuming that I create a configuration deployment / update recipe for the [web servers] group, and put it on the new “clean” server in this group and run this Playbook, Ansible will be able to detect that the old servers have already received the current configuration and it will igorará them, and in this way will execute the current configuration only in the new servers or Ansible would execute this Playbook in all the servers of the group, memso in those that already received this current configuration?

Thanks to all who can help!

ansible version: 1.7.2

Hi Vinícius,

Im pretty sure ansible wont work as you expect. He works in an imperative way rather than declarative, like puppet for example. You will have to manually check if the server should or not be updated, since ansible doesnt natively stores states.

Hope It clarifies you.

Hello Fabio, I understand. Thank you very much for your reply.

Sorry, I Think I misread your question.

If youre talking about changing ansible hosts, adding a New server inside a group, ansible Will rerun tour playbook on all hosts, but he also detect If a task should run or not. When the result is a Green “ok”, It means It didnt changed anything. So It Will probably work as you expect.

Just pay attention on shell, raw or command tasks, it's just runs and command on the server and can't check if it was ran before, see the changed_when clause: https://docs.ansible.com/ansible/2.6/user_guide/playbooks_error_handling.html#overriding-the-changed-result

Thank you very much Fabio!

Hello Everson, thank you very much!