Ansible: deploy on multiple hosts in the same time

前端 未结 7 1580
暖寄归人
暖寄归人 2020-12-08 06:19

Is it possible to run ansible playbook, which looks like this (it is an example from this site: http://docs.ansible.com/playbooks_roles.html):

- name: this i         


        
7条回答
  •  半阙折子戏
    2020-12-08 07:04

    I played a long time with things like ls -1 | xargs -P to parallelize my playbooks runs. But to get a prettier display, and simplicity I wrote a simple Python tool to do it, ansible-parallel.

    It goes like this:

    pip install ansible-parallel
    ansible-parallel *.yml
    

    To answer precisely to the original question (how to run some tasks first, and the rest in parallel), it can be solved by removing the 3 includes and running:

    ansible-playbook say_hi.yml
    ansible-parallel load_balancers.yml webservers.yml dbservers.yml
    

提交回复
热议问题