[英]Why ansible evaluate variables which is not used in playbook?
I am using ansible 2.3.1.1 with jenkins. 我正在与詹金斯一起使用ansible 2.3.1.1。 I have encountered the following issue - my playbook which uses variables from aws dynamic inventory becomes extremely slow. 我遇到了以下问题-使用aws动态清单中的变量的剧本变得非常慢。 The most interesting case that if I copy this playbook outside my jenkins workspace and run in any other directory the execution speed is OK. 最有趣的情况是,如果将这个剧本复制到jenkins工作区之外并在其他任何目录中运行,则执行速度可以。 In order to test it I remove all variable files from workspace directory /group_vars/all - after that the execution speed for this playbook inside workspace become OK too. 为了对其进行测试,我从工作区目录/ group_vars / all中删除了所有变量文件-之后,该工作簿在工作区中的执行速度也变得可以。 So, as I understand ansible calculate all variables from group_vars/all even if they are not used in current playbook. 因此,据我所知,即使当前剧本中未使用它们,也要从group_vars / all计算所有变量。 So could someone explain why ansible does so and how it could be tuned? 那么有人可以解释为什么ansible这样做以及如何对其进行调整吗?
the playbook is the following 剧本如下
============ ============
- hosts: "xxxx" -主机:“ xxxx”
tasks: 任务:
- name: print something
debug:
var: hostvars["{{item}}"]['ec2_vpc_id']
with_items: "{{groups['some_tag']}}"
============ ============
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.