with_items: not working for me.

122 views
Skip to first unread message

Chanaka Samarajeewa

unread,
Feb 23, 2015, 4:42:16 PM2/23/15
to ansible...@googlegroups.com
Hello,

Can someone please let me know why I am getting this error message when using with_items? Error message my task are as follows.

ERROR: Syntax Error while loading YAML script, /var/lib/awx/projects/_11813__automated_aws_cloud_watch_alarms/roles/cloudwatch_alarms/tasks/main.yml Note: The error may actually appear before this position: line 30, column 1 with_items: - { name: 'test-alarm', metric: 'CPUUtilization' } ^ This one looks easy to fix. It seems that there is a value started with a quote, and the YAML parser is expecting to see the line ended with the same kind of quote. For instance: when: "ok" in result.stdout Could be written as: when: '"ok" in result.stdout' or equivalently: when: "'ok' in result.stdout"


TASK:
--------------------------------------------

- name: singapore-ec2-cpu-utilization
  local_action:
    module: ec2_metric_alarm
    state: present
    region: ap-southeast-1
    name: "{{ item.name }}"
    metric: "{{ item.metric }}"
    namespace: "AWS/EC2"
    statistic: Average
    comparison: ">="
    threshold: 75.0
    period: 60
    evaluation_periods: 5
    unit: "Percent"
    description: "test"
    dimensions: {'InstanceId':'i-08a707c4'}
    alarm_actions: ["arn:aws:sns:ap-southeast-1:779200210943:chanakaalerts:35d082af-c259-4b8e-bc02-b2b516312afd"]
    with_items:
- { name: 'test-alarm', metric: 'CPUUtilization' }




Brian Coca

unread,
Feb 23, 2015, 6:44:51 PM2/23/15
to ansible...@googlegroups.com
you indented with_items too much
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/4d8bf1aa-8752-4d18-964d-624a9db05bc7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Brian Coca

Chanaka Samarajeewa

unread,
Mar 11, 2015, 2:00:00 PM3/11/15
to ansible...@googlegroups.com
Thanks for the help!
Reply all
Reply to author
Forward
0 new messages