過去数日間、AWS クラウド モジュールを使用して ansible プレイブックを実行するとき、またはローカル マシンから --refresh-cache コマンドを使用して ec2.py ファイルを直接実行すると、次のエラーが発生します。
ap:~ ap$ /ansible/inventory/ec2.py --refresh-cache
Traceback (most recent call last):
File "/ansible/inventory/ec2.py", line 1510, in <module>
Ec2Inventory()
File "/ansible/inventory/ec2.py", line 186, in __init__
self.do_api_calls_update_cache()
File "/ansible/inventory/ec2.py", line 492, in do_api_calls_update_cache
self.get_elasticache_replication_groups_by_region(region)
File "/ansible/inventory/ec2.py", line 722, in get_elasticache_replication_groups_by_region
self.add_elasticache_replication_group(replication_group, region)
File "/ansible/inventory/ec2.py", line 1198, in add_elasticache_replication_group
dest = replication_group['NodeGroups'][0]['PrimaryEndpoint']['Address']
TypeError: 'NoneType' object has no attribute '__getitem__'
この問題は、AWS アカウントの Ec2 インスタンスから実行すると解消されるようです。
最新の EC2.py および EC2.ini ファイルがあり、Ansible バージョンは 2.2.0.0 で、boto3 がインストールされており、プレイブックを実行する前に有効な AWS 資格情報を設定しています。
何が起こっているかについてのアイデアはありますか?