[英]How to reuse Ansible role with different set of variables in the same playbook
I want to invoke the same role twice with different set of variables.我想使用不同的变量集两次调用相同的角色。 However, when I run the playbook, the first instance of role is executed, the second call is ignored.但是,当我运行剧本时,第一个角色实例被执行,第二个调用被忽略。
The details are as follows.详细情况如下。
---
- hosts: server
gather_facts: true
roles:
- role: upgrade_opatch_utility
vars:
source: /u1/software/OPatch
opatch_file_name: p6880880_200000_Linux-x86-64.zip
oracle_home: /u1/app/oracle/product/19.3.0/dbhome_1
- role: upgrade_opatch_utility
vars:
source: /u1/software/OPatch
opatch_file_name: p6880880_200000_Linux-x86-64.zip
oracle_home: /u1/app/oracle/product/12.2.0/dbhome_1
How can I re arrange the roles invocation multiple times with different set of variables?如何使用不同的变量集多次重新安排角色调用?
Thanks in advance.提前致谢。
FR FR
Set a different name for each role invocation.为每个角色调用设置不同的名称。 That way Ansible won't consider them duplicates.这样 Ansible 就不会认为它们是重复的。
roles:
- name: upgrade_opatch_19
role: upgrade_opatch_utility
vars:
[...]
- name: upgrade_opatch_12
role: upgrade_opatch_utility
vars:
[...]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.