How can I stop the look inside the jinja template so when it gets the the
last item it doesn't add a comma at the end breaking the json format. I can
clearly see whats wrong but I can't come up with a solution. Thanks!
This is my jinja template:
{
"checks":
{
{% if elite_receipt_active_domains is defined %}
{% for check in elite_receipt_active_domains %}
"{{ check.domain }}-cert_check": {
"command": "/etc/sensu/plugins/check-https-cert.rb --url https://{{
check.domain }} --warning 30 --critical 10",
"handlers": [
{{ check.handlers | to_nice_json }}
],
"interval": {{ ssl_cert_check_interval }},
"standalone": true,
"subscribers": ["test"]
},
{% endfor %}
{% for check in elite_receipt_active_domains %}
"{{ check.domain }}-http_redirect_check": {
"command": "/etc/sensu/plugins/check-http.rb --url https://{{
check.domain }} -s false --response-code 301 --redirect-to https://{{
check.domain }} ",
"handlers": [
{{ check.handlers | to_nice_json }}
],
"interval": {{ http_redirect_checK_interval }},
"standalone": true
},
{% endfor %}
{% for check in elite_receipt_active_domains %}
"{{ check.domain }}-https_check": {
"command": "/etc/sensu/plugins/check-http.rb --url https://{{
check.domain }} -s true ",
"handlers": [
{{ check.handlers | to_nice_json }}
],
"interval": {{ http_check_interval }},
"standalone": true
},
{% endfor %}
{% endif %}
}
and this is what it outputs:
{
"checks":
{
"hotwheelsrewards.com-cert_check": {
"command": "/etc/sensu/plugins/check-https-cert.rb --url
https://hotwheelsrewards.com --warning 30 --critical 10",
"handlers": [
"mailer"
],
"interval": 3600,
"standalone": true,
"subscribers": ["test"]
},
"elite-receipt.com-cert_check": {
"command": "/etc/sensu/plugins/check-https-cert.rb --url
https://elite-receipt.com --warning 30 --critical 10",
"handlers": [
"mailer"
],
"interval": 3600,
"standalone": true,
"subscribers": ["test"]
},
"suavefamilyperks.com-cert_check": {
"command": "/etc/sensu/plugins/check-https-cert.rb --url
https://suavefamilyperks.com --warning 30 --critical 10",
"handlers": [
"mailer"
],
"interval": 3600,
"standalone": true,
"subscribers": ["test"]
},
"thomasandfriendsrewards.com-cert_check": {
"command": "/etc/sensu/plugins/check-https-cert.rb --url
https://thomasandfriendsrewards.com --warning 30 --critical 10",
"handlers": [
"mailer"
],
"interval": 3600,
"standalone": true,
"subscribers": ["test"]
},
"paisleypoints.com-cert_check": {
"command": "/etc/sensu/plugins/check-https-cert.rb --url
https://paisleypoints.com --warning 30 --critical 10",
"handlers": [
"mailer"
],
"interval": 3600,
"standalone": true,
"subscribers": ["test"]
},
"hotwheelsrewards.com-http_redirect_check": {
"command": "/etc/sensu/plugins/check-http.rb --url
https://hotwheelsrewards.com -s false --response-code 301 --redirect-to
https://hotwheelsrewards.com ",
"handlers": [
"mailer"
],
"interval": 5,
"standalone": true
},
"elite-receipt.com-http_redirect_check": {
"command": "/etc/sensu/plugins/check-http.rb --url
https://elite-receipt.com -s false --response-code 301 --redirect-to
https://elite-receipt.com ",
"handlers": [
"mailer"
],
"interval": 5,
"standalone": true
},
"suavefamilyperks.com-http_redirect_check": {
"command": "/etc/sensu/plugins/check-http.rb --url
https://suavefamilyperks.com -s false --response-code 301 --redirect-to
https://suavefamilyperks.com ",
"handlers": [
"mailer"
],
"interval": 5,
"standalone": true
},
"thomasandfriendsrewards.com-http_redirect_check": {
"command": "/etc/sensu/plugins/check-http.rb --url
https://thomasandfriendsrewards.com -s false --response-code 301
--redirect-to https://thomasandfriendsrewards.com ",
"handlers": [
"mailer"
],
"interval": 5,
"standalone": true
},
"paisleypoints.com-http_redirect_check": {
"command": "/etc/sensu/plugins/check-http.rb --url
https://paisleypoints.com -s false --response-code 301 --redirect-to
https://paisleypoints.com ",
"handlers": [
"mailer"
],
"interval": 5,
"standalone": true
},
"hotwheelsrewards.com-https_check": {
"command": "/etc/sensu/plugins/check-http.rb --url
https://hotwheelsrewards.com -s true ",
"handlers": [
"mailer"
],
"interval": 5,
"standalone": true
},
"elite-receipt.com-https_check": {
"command": "/etc/sensu/plugins/check-http.rb --url
https://elite-receipt.com -s true ",
"handlers": [
"mailer"
],
"interval": 5,
"standalone": true
},
"suavefamilyperks.com-https_check": {
"command": "/etc/sensu/plugins/check-http.rb --url
https://suavefamilyperks.com -s true ",
"handlers": [
"mailer"
],
"interval": 5,
"standalone": true
},
"thomasandfriendsrewards.com-https_check": {
"command": "/etc/sensu/plugins/check-http.rb --url
https://thomasandfriendsrewards.com -s true ",
"handlers": [
"mailer"
],
"interval": 5,
"standalone": true
},
"paisleypoints.com-https_check": {
"command": "/etc/sensu/plugins/check-http.rb --url
https://paisleypoints.com -s true ",
"handlers": [
"mailer"
],
"interval": 5,
"standalone": true
},
}
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ec01036e-0959-4c3f-bd6d-439ff5a1ee9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.