Ansible ec2.py独立运行但在playbook中失败

时间:2017-06-24 14:36:56

标签: python amazon-ec2 ansible

我在这个主题上看过几篇关于奇怪难以重现行为的帖子。这是一组新的数据点。

  1. 目前以下作品
  2. cd ./hosts ./ec2.py --profile=dev

    1. 这失败了
    2. AWS_PROFILE=dev; ansible-playbook test.yml

      这些都是几天前工作的。我环境中的某些东西发生了变化还在调查。任何猜测?

      错误讯息:

      ERROR! The file ./hosts/ec2.py is marked as executable, but failed to execute correctly. If this is not supposed to be an executable script, correct this with chmod -x ./hosts/ec2.py. ERROR! Inventory script (./hosts/ec2.py) had an execution error: ERROR: "Error connecting to AWS backend. You are not authorized to perform this operation.", while: getting EC2 instances ERROR! ./hosts/ec2.py:3: Error parsing host definition ''''': No closing quotation

      请注意,正常凭据错误是:

      ERROR: "Error connecting to AWS backend. You are not authorized to perform this operation.", while: getting EC2 instances

      ...

      嗯。错误消息已移位。 AWS_PROFILE=dev; ansible-playbook test.yml ERROR! ERROR! ./hosts/tmp:2: Expected key=value host variable assignment, got: {

1 个答案:

答案 0 :(得分:0)

看起来问题是hosts文件夹中的临时文件。删除后,问题就消失了。它看起来像std ansible行为:拉入hosts文件夹中的所有文件。