Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This works:
- - name: "[{{ _aws_role_config.role }}::{{ _aws_vpc_name }}::{{ _aws_subnet_name }}::{{_aws_hostname}}] Launch Instance {{ _aws_hostname }}"
- debug:
- msg:
- region: "{{ aws_vpc_map[_aws_vpc_name] }}"
- keypair: "{{ aws_keypair }}"
- group_id: "{{ aws_sg_map[_aws_subnet_name] }}"
- instance_type: "{{ _aws_role_config['type'] }}"
- image: "{{ aws_images[_aws_vpc_name] }}"
- instance_tags: "{{ {'Name':_aws_hostname } |combine(aws_tags) }}"
- exact_count: 1
- count_tag:
- Name: "{{ _aws_hostname }}"
- wait: true
- vpc_subnet_id: "{{ _aws_subnets_map[_aws_vpc_name + '-' + _aws_subnet_name] }}"
- If I do something stupid, for instance, change the image line to
- image: "{{ aws_images['public-1'] }}"
- which I know doesn't exist, I get the following:
- TASK [aws-instance : [ibgw::smc-west::public-1::smc-ibgw-6001a] Launch Instance smc-ibgw-6001a] ************************
- fatal: [localhost]: FAILED! => {}
- MSG:
- The task includes an option with an undefined variable. The error was: 'dict object' has no attribute u'public-1'
- 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
- be elsewhere in the file depending on the exact syntax problem.
- The offending line appears to be:
- - name: "[{{ _aws_role_config.role }}::{{ _aws_vpc_name }}::{{ _aws_subnet_name }}::{{_aws_hostname}}] Launch Instance {{ _aws_hostname }}"
- ^ here
- We could be wrong, but this one looks like it might be an issue with
- missing quotes. Always quote template expression brackets when they
- start a value. For instance:
- with_items:
- - {{ foo }}
- Should be written as:
- with_items:
- - "{{ foo }}"
- exception type: <class 'ansible.errors.AnsibleUndefinedVariable'>
- exception: 'dict object' has no attribute u'public-1'
- super unhelpful.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement