目前在 site.yml 中定义了多个角色:
- include: role1.yml
- include: role2.yml
- include: role3.yml
- include: role4.yml
- include: role5.yml
这些通过发出以下命令同步运行:
ansible-playbook -i testing site.yml -u root --vault-password-file ~/.vault_pass.txt
问题
如何一次性运行 site.yml 中定义的角色?
讨论
它可以通过打开多个终端并运行来异步运行所有角色:
ansible-playbook -i testing playbook1.yml -u root --vault-password-file ~/.vault_pass.txt
ansible-playbook -i testing playbook2.yml -u root --vault-password-file ~/.vault_pass.txt
ansible-playbook -i testing playbook3.yml -u root --vault-password-file ~/.vault_pass.txt
ansible-playbook -i testing playbook4.yml -u root --vault-password-file ~/.vault_pass.txt
ansible-playbook -i testing playbook5.yml -u root --vault-password-file ~/.vault_pass.txt
看看剧本策略:
值得尝试将策略设置为
free
:还要检查叉子设置
ansible.cfg
: