parallel-processing - 如何在 Ansible 剧本中并行运行几个角色?

标签 parallel-processing ansible

我需要在 Ansible 中以并发模式运行一些角色。

我通过以下方式运行 ansible:

ansible-playbook install_full.yml --tags "10_clean_up,20_pull_images,30_install_postgres_11,40_install_jboss-eap-7.0" --extra-vars "ansible_user=user ansible_password=password"

剧本 install_full.yml 看起来像:
- hosts: localhost

  vars_files:
    - "vars/build.yml"

  roles:
    - { role: 10_clean_up, tags: 10_clean_up }
    - { role: 20_pull_images, tags: 20_pull_images }
    - { role: 30_install_postgres_11, tags: 30_install_postgres_11 }
    - { role: 40_install_jboss-eap-7.0, tags: 40_install_jboss-eap-7.0 }

30 和 40 角色可以同时运行(以节省一些时间),是否可以并行运行几个角色,不像现在 - 按订单列表?

提前致谢!

最佳答案

你需要 strategy: free对于您要同时运行的一组角色。看一下这个:

https://medium.com/@ibrahimgunduz34/parallel-playbook-execution-in-ansible-30799ccda4e0

关于parallel-processing - 如何在 Ansible 剧本中并行运行几个角色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53340687/

相关文章:

jenkins - 如何修复 Ansible 中的内存错误?

Ansible 和库存特定变量

python-3.x - numpy 矩阵上的并行 for 循环

geometry - 适用于 GPU 的最快可用 Delaunay 三角剖分算法

c - C 上的 MPI,段错误 : 11

docker - 将Ansible应用程序安装到Docker容器

c - 如何在 MPI 中使用未阻塞的 Bcast?

python - 一次/并行检索多个网址

python - Ansible + Ubuntu 18.04 + MySQL = "The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required."

dictionary - ansible 的 key 方法