I have a inventory file which looks like :
[database]
syd01-dev-shared.ce4l5of4bl3z.ap-southeast-2.rds.amazonaws.com
I need to configure 3 cloudwatch metrics for the above RDS endpoint, by reading the inventory. The DBInstanceIdentifier is actually syd01-dev-shared
only, how can i actually pick this part and feed it to something like below??
- name: Create CPU utilization metric alarm
sudo: false
local_action: ec2_metric_alarm
state=present
region={{region}}
name="HOW_TO_READ_DBInstanceOdentifier_NAME_FROM_Inventory"
metric="CPUUtilization"
statistic=Average comparison=">="
threshold=80.0
unit="Percent"
period=300
evaluation_periods=1
description="It will be triggered when CPU utilization is more than 80% for 5 minutes"
dimensions="InstanceId"="{{ec2_facts.ansible_facts.ansible_ec2_instance_id}}"
alarm_actions=arn:aws:sns:us-east-1:123412341234:My_SNS_Notification
ok_actions=arn:aws:sns:us-east-1:123412341234:My_SNS_Notification
I am not sure how to read the inventory and then split for what i am looking for.
Output: