Ansible: バグレポート:ec2モジュールが「ERROR!モジュールにインタープリターラインがありません」で壊れています

作成日 2015年10月14日  ·  3コメント  ·  ソース: ansible/ansible

問題の種類:

Bug Report

Ansibleバージョン:

ansible 2.0.0 (devel 2963bba901) last updated 2015/10/14 15:07:35 (GMT +300)
  lib/ansible/modules/core: (devel 95b10c9fdd) last updated 2015/10/14 10:52:54 (GMT +300)
  lib/ansible/modules/extras: (devel 15480e3d04) last updated 2015/10/14 10:52:56 (GMT +300)
  config file = /etc/ansible/ansible.cfg
  configured module search path = None

Ansible構成:

ansible.cfgのgithubバージョンでも問題が存在します

環境:

MacOSXヨセミテ10.10.5

概要:

最近の開発では、ec2モジュールの使用法が壊れています。 ec2_module -pageの基本的な例でも使用しようとすると、次のメッセージが表示されます。

 fatal: [localhost]: FAILED! => {"failed": true, "msg": "ERROR! module is missing interpreter line"}

モジュールオプションが解析される前でも、エラーが発生します。

コミット18e2ee16ef0895831ead312550eb5de44c99524c以降、機能が壊れています。 そのコミットがec2モジュールを壊した理由を理解できませんでした。

再現する手順:

- hosts: localhost
  tasks:
   - ec2:
      key_name: mykey
      instance_type: t2.micro
      image: ami-123456
      wait: yes
      group: webserver
      count: 3
      vpc_subnet_id: subnet-29e63245
      assign_public_ip: yes

期待される結果:

ec2モジュールは以前と同じように機能し、インスタンスの作成を許可する必要があります。
実績:

以下のエラーが出力され、プレイブックの実行が終了します。

fatal: [localhost -> localhost]: FAILED! => {"failed": true, "msg": "ERROR! module is missing interpreter line"}
bug

最も参考になるコメント

注意点として、以下が欠落している場合、このエラーが発生する可能性があります。

#!/usr/bin/python

モジュールファイルの先頭にあるhashbang。 おそらく、独自のモジュールを開発している人々にのみ関係があります。 しかし、それは私をつまずかせました!

全てのコメント3件

複製できません。 このエラーは、モジュールに必要なパスがないことを示していますが、実際にはあります: https

パスの問題やセットアップの問題が原因である可能性があります。 これは他のモジュールでも起こりますか?

OSX:10.10.2

テスト済みのHEAD:

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [ec2 aws_secret_key=***** count=1 aws_access_key=****** group=All key_name=***** region=us-west-1 vpc_subnet_id=subnet-64e9d522 instance_type=t2.micro assign_public_ip=True image=ami-df6a8b9b wait=True] ***
changed: [localhost] => {"changed": true, "instance_ids": ["i-249c1196"], "instances": [{"ami_launch_index": "0", "architecture": "x86_64", "block_device_mapping": {"/dev/sda1": {"delete_on_termination": true, "status": "attached", "volume_id": "vol-c611fe3e"}}, "dns_name": "ec2-54-193-42-241.us-west-1.compute.amazonaws.com", "ebs_optimized": false, "groups": {"sg-f2953597": "All"}, "hypervisor": "xen", "id": "i-249c1196", "image_id": "ami-df6a8b9b", "instance_type": "t2.micro", "kernel": null, "key_name": "*****", "launch_time": "2015-10-20T05:02:16.000Z", "placement": "us-west-1a", "private_dns_name": "ip-172-31-10-161.us-west-1.compute.internal", "private_ip": "172.31.10.161", "public_dns_name": "ec2-54-193-42-241.us-west-1.compute.amazonaws.com", "public_ip": "54.193.42.241", "ramdisk": null, "region": "us-west-1", "root_device_name": "/dev/sda1", "root_device_type": "ebs", "state": "running", "state_code": 16, "tags": {}, "tenancy": "default", "virtualization_type": "hvm"}], "tagged_instances": []}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0

テスト済みコミット:18e2ee16ef0895831ead312550eb5de44c99524c

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [ec2 aws_secret_key=***** count=1 aws_access_key=*****group=All key_name=***** region=us-west-1 vpc_subnet_id=subnet-64e9d522 instance_type=t2.micro assign_public_ip=True image=ami-df6a8b9b wait=True] ***
changed: [localhost] => {"changed": true, "instance_ids": ["i-9d911c2f"], "instances": [{"ami_launch_index": "0", "architecture": "x86_64", "block_device_mapping": {"/dev/sda1": {"delete_on_termination": true, "status": "attached", "volume_id": "vol-7468878c"}}, "dns_name": "ec2-54-193-61-87.us-west-1.compute.amazonaws.com", "ebs_optimized": false, "groups": {"sg-f2953597": "All"}, "hypervisor": "xen", "id": "i-9d911c2f", "image_id": "ami-df6a8b9b", "instance_type": "t2.micro", "kernel": null, "key_name": "*****", "launch_time": "2015-10-20T05:21:45.000Z", "placement": "us-west-1a", "private_dns_name": "ip-172-31-5-245.us-west-1.compute.internal", "private_ip": "172.31.5.245", "public_dns_name": "ec2-54-193-61-87.us-west-1.compute.amazonaws.com", "public_ip": "54.193.61.87", "ramdisk": null, "region": "us-west-1", "root_device_name": "/dev/sda1", "root_device_type": "ebs", "state": "running", "state_code": 16, "tags": {}, "tenancy": "default", "virtualization_type": "hvm"}], "tagged_instances": []}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0

プレイブック:

- hosts: localhost
  connection: local
  tasks:
   - ec2:
      aws_access_key: '*****'
      aws_secret_key: '*****'
      region: us-west-1
      key_name: *****
      instance_type: t2.micro
      image: ami-df6a8b9b
      wait: yes
      group: All
      count: 1
      vpc_subnet_id: subnet-64e9d522
      assign_public_ip: yes

私はついにバグを解決しました。 'library' -directoryにec2.iniがあり、何らかの理由で、ec2-moduleを検索するときにansibleがそれを選択していました。 ec2.iniの名前をec2_dynamic_inventory.iniに変更し、「export EC2_INI_PATH = library / ec2_dynamic_inventory.ini」を実行すると、問題が修正されました。

注意点として、以下が欠落している場合、このエラーが発生する可能性があります。

#!/usr/bin/python

モジュールファイルの先頭にあるhashbang。 おそらく、独自のモジュールを開発している人々にのみ関係があります。 しかし、それは私をつまずかせました!

このページは役に立ちましたか?
0 / 5 - 0 評価