以下ec2モジュールでインスタンスを作成後、route53への登録の処理で失敗します。
インスタンスの作成までは問題はなく、デバック用の処理でも値でも、'{{ item.public_dns_name }}'の
値は正常に表示されているのですが、route53側の処理に入った際にエラー終了となります。
①"msg": "xxxxxxxxxxxxxxxxx.compute.amazonaws.com"
②fatal: [127.0.0.1]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'item' is undefined\n\nThe error appears to have been in '/mnt/share/aws/test.yml': line 35, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Set Public DNS to CNAME in Route53\n ^ here\n"}
★以下コマンド実行にてroute53側で大本のZONE自体は登録されていることは確認済みです。
$ aws route53 list-hosted-zones
test.yml ======================= - hosts: localhost gather_facts: no connection: local tasks: - name: Create ec2 instanse ec2: key_name: xxxx instance_type: t2.micro image: ami-XXXX monitoring: yes wait: yes region: ap-northeast-1 group_id: sg-XXX vpc_subnet_id: subnet-XXX assign_public_ip: yes instance_tags: Name: ansible1 register: ec2 #デバック用 - debug: msg='{{ item.public_dns_name }}' --① with_items: "{{ ec2.instances }}" - command: echo '{{ item.public_dns_name }}' with_items: "{{ ec2.instances }}" #route53 - name: Set Public DNS to CNAME in Route53 --② route53: command: create zone: "ex.com" record: www.web1.ex.com type: "CNAME" value: '{{ item.public_dns_name }}' overwrite: yes ttl: 300 with_items: "{{ ec2.instances }}" =======================
原因についてご存知の方がいらっしゃたら、ご教示いただければ幸いです。
参考サイト)
http://www.1x1.jp/blog/2014/10/create-ec2-instance-with-ansible.html
http://docs.ansible.com/ansible/latest/ec2_module.html
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。