0

Here's the situation,

I've say 100 webservers, 100 DB-servers and 100 Backend-servers. All of them managed by Ansible. I want to use Ansible-pull to lighten the load on Ansible Admin node and expedite process.

The question is, when I run ansible-pull on each node with local mode, how I can apply specific role to that node. For example, how a webserver node will know that, it needs to apply webserver role to itself?

I hope I've made myself clear.

0

You can create a 'hostname'.yml file so only the matching host will run that .yml file.

Example repo could contain:
db1.yml
db2.yml
db3.yml

Then a server with hostname 'db1' will only run the db1.yml playbook. So in that playbook you can call all the tasks and roles it should have.

From the man page:

ansible-pull will look for a playbook based on the host’s fully-qualified domain name, on the host hostname and finally a playbook named local.yml.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.