2016-11-02 13 views
2

Ansible 2.1.2.0のAnier ec2_asgモジュールで作業しています。私たちは、モジュールec2_asg掘り下げる可能性のあるec2_asg - TypeError: 'NoneType'オブジェクトは反復不可能です

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: 'NoneType' object is not iterable 
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_sYlKBr/ansible_module_ec2_asg.py\", line 832, in <module>\n main()\n File \"/tmp/ansible_sYlKBr/ansible_module_ec2_asg.py\", line 821, in main\n create_changed, asg_properties=create_autoscaling_group(connection, module)\n File \"/tmp/ansible_sYlKBr/ansible_module_ec2_asg.py\", line 471, in create_autoscaling_group\n for tag in as_group.tags:\nTypeError: 'NoneType' object is not iterable\n", "module_stdout": "", "msg": "MODULE FAILURE"} 

、それはここで失敗している:私は、自動スケーリンググループを作成しようとしているときに、私は次のエラーを取得する

Ansible ec2_asg

for tag in as_group.tags: 
     have_tags[tag.key] = [tag.value, tag.propagate_at_launch] 
     if tag.key not in want_tags: 
      changed = True 
      dead_tags.append(tag) 

そして、私の可能なタスクは次のとおりです。

- name: Configuring Auto Scaling Group and perform rolling deploy 
    ec2_asg: 
    region: "ap-southeast-1a" 
    name: "MY-ASG" 
    vpc_zone_identifier: [ "{{ services_1_subnet_id }}", "{{ services_2_subnet_id }}" ] 
    launch_config_name: "{{ service_group }}-{{ current_datetime }}" 
    health_check_type: "{{ health_check_type }}" 
    health_check_period: "{{ health_check_period }}" 
    desired_capacity: "{{ min_instances }}" 
    replace_all_instances: yes 
    replace_batch_size: "{{ replace_batch_size }}" 
    min_size: "{{ min_instances }}" 
    max_size: "{{ max_instances }}" 
    wait_for_instances: yes 
    wait_timeout: 600 
    tags: 
     - Name: "{{ service_group }}" 
     - deploy_colour: "{{ deploy_colour }}" 
     - Type: "ABC" 
     - Env: "{{ env }}" 
    state: present 
    register: asg_result 

iablesはすでに定義されており、正しいものです。

ASGには既にタグがあります。

+0

'タイプ:" {{item.type}} "'の 'item'とは何ですか?いくつかのリストをループしますか? –

+0

はい。 ' - {name: 'XYZ'、タイプ: 'ABC'}' –

+0

のような項目のリストをループします。ループすると、エラーメッセージに項目の値があるはずです: 'failed:[localhost]( item = {u'type ':u'ABC'、u'name ':u'XYZ'})=> {"failed" ... 'あなたのプレイブックの抜粋に' with_items'を指定していません。 –

答えて

0

私はこれを理解するのにかなりの時間を費やしました。私のこの問題に対する解決策は、私のASGがターゲットグループとクラシックELBを持っていることでした。

AWS APIにはいくつかの変更があります。そのため、ASGのターゲットグループに接続しても機能しません。

解決策は、ターゲットグループを使用してASGを削除してから試してみることです。それは私のために働いた。

乾杯!

+0

明らかにするために、ASGがターゲットグループの一部であれば、AWSのASGのタグを更新できませんAPI? –

+0

私はaws cliを介してタグを追加することができたので、問題は不可能と思われます。私はここで問題を作りました:https://github.com/ansible/ansible/issues/23234 –

関連する問題