Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. This works:
  2.  
  3. - name: "[{{ _aws_role_config.role }}::{{ _aws_vpc_name }}::{{ _aws_subnet_name }}::{{_aws_hostname}}] Launch Instance {{ _aws_hostname }}"
  4. debug:
  5. msg:
  6. region: "{{ aws_vpc_map[_aws_vpc_name] }}"
  7. keypair: "{{ aws_keypair }}"
  8. group_id: "{{ aws_sg_map[_aws_subnet_name] }}"
  9. instance_type: "{{ _aws_role_config['type'] }}"
  10. image: "{{ aws_images[_aws_vpc_name] }}"
  11. instance_tags: "{{ {'Name':_aws_hostname } |combine(aws_tags) }}"
  12. exact_count: 1
  13. count_tag:
  14. Name: "{{ _aws_hostname }}"
  15. wait: true
  16. vpc_subnet_id: "{{ _aws_subnets_map[_aws_vpc_name + '-' + _aws_subnet_name] }}"
  17.  
  18. If I do something stupid, for instance, change the image line to
  19.  
  20. image: "{{ aws_images['public-1'] }}"
  21.  
  22. which I know doesn't exist, I get the following:
  23.  
  24. TASK [aws-instance : [ibgw::smc-west::public-1::smc-ibgw-6001a] Launch Instance smc-ibgw-6001a] ************************
  25. fatal: [localhost]: FAILED! => {}
  26.  
  27. MSG:
  28.  
  29. The task includes an option with an undefined variable. The error was: 'dict object' has no attribute u'public-1'
  30.  
  31. The error appears to have been in '/mnt/c/Users/chrome/Development/ansible-smc/roles/aws-instance/tasks/each_instance.yml': line 27, column 3, but may
  32. be elsewhere in the file depending on the exact syntax problem.
  33.  
  34. The offending line appears to be:
  35.  
  36.  
  37. - name: "[{{ _aws_role_config.role }}::{{ _aws_vpc_name }}::{{ _aws_subnet_name }}::{{_aws_hostname}}] Launch Instance {{ _aws_hostname }}"
  38. ^ here
  39. We could be wrong, but this one looks like it might be an issue with
  40. missing quotes. Always quote template expression brackets when they
  41. start a value. For instance:
  42.  
  43. with_items:
  44. - {{ foo }}
  45.  
  46. Should be written as:
  47.  
  48. with_items:
  49. - "{{ foo }}"
  50.  
  51. exception type: <class 'ansible.errors.AnsibleUndefinedVariable'>
  52. exception: 'dict object' has no attribute u'public-1'
  53.  
  54.  
  55.  
  56.  
  57. super unhelpful.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement