diff --git a/README.md b/README.md index d626c49..4580206 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,8 @@ Just use the same command ## Templates For templates are following parameters available: {HOST} = instance id -{IP} = instance public ip +{IP} or {PublicIP} = instance public ip +{PrivateIP} = instance private ip If you need more just create a feature request ## Contributing diff --git a/icinga2-aws.py b/icinga2-aws.py index 4439e37..237bf7e 100644 --- a/icinga2-aws.py +++ b/icinga2-aws.py @@ -9,6 +9,9 @@ def writeTemplate(template, targetFile, targetFolder): with open(icinga2ConfigDir + 'conf.d/hosts/' + targetFolder + '/' + targetFile + '.conf', 'w') as out: template = template template = template.replace('{HOST}', instance.id) + template = template.replace('{PublicIP}', instance.public_ip_address) + template = template.replace('{PrivateIP}', instance.private_ip_address) + # Backwards compatibility template = template.replace('{IP}', instance.public_ip_address) out.write(template) out.flush()