Skip to content

Use namespace as global variable in Ansible Jinja templates

A simple task, or so I thought: in a Jinja template keep track of the number of items in a loop. And then use that count afterwards.

Disclaimer: the number of items is not equal the number of times the loop runs, so I can't use the loop variables.

Turns out that Jinja has other opinions, and variables inside a loop are all local. When a variable is changed inside the loop, the scoop of the variable stays local, and once the loop ends the original value of the variable is restored. That's even true for variables which are created outside the loop.

 

Continue reading "Use namespace as global variable in Ansible Jinja templates"
  • Twitter
  • Bookmark Use namespace as global variable in Ansible Jinja templates at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Use namespace as global variable in Ansible Jinja templates
  • Bloglines Use namespace as global variable in Ansible Jinja templates
  • Technorati Use namespace as global variable in Ansible Jinja templates
  • Fark this: Use namespace as global variable in Ansible Jinja templates
  • Bookmark Use namespace as global variable in Ansible Jinja templates at YahooMyWeb
  • Bookmark Use namespace as global variable in Ansible Jinja templates at Furl.net
  • Bookmark Use namespace as global variable in Ansible Jinja templates at reddit.com
  • Bookmark Use namespace as global variable in Ansible Jinja templates at blinklist.com
  • Bookmark Use namespace as global variable in Ansible Jinja templates at Spurl.net
  • Bookmark Use namespace as global variable in Ansible Jinja templates at Simpy.com
  • Bookmark Use namespace as global variable in Ansible Jinja templates at blogmarks
  • Bookmark Use namespace as global variable in Ansible Jinja templates with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Certificate expiration date in Ansible

In one of my Ansible Playbooks I'm updating Let's Encrypt certificates. Because the Playbook is rather long, I want to make sure that Ansible is not spending cycles on a certificate which is not about to expire. Hence I wrote a small filter plugin, which receives the certificate path and the number of days the certificate must be still valid.

This plugin is used to filter out any "good" certificate which does not need to be updated.

 

Continue reading "Certificate expiration date in Ansible"
  • Twitter
  • Bookmark Certificate expiration date in Ansible at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Certificate expiration date in Ansible
  • Bloglines Certificate expiration date in Ansible
  • Technorati Certificate expiration date in Ansible
  • Fark this: Certificate expiration date in Ansible
  • Bookmark Certificate expiration date in Ansible at YahooMyWeb
  • Bookmark Certificate expiration date in Ansible at Furl.net
  • Bookmark Certificate expiration date in Ansible at reddit.com
  • Bookmark Certificate expiration date in Ansible at blinklist.com
  • Bookmark Certificate expiration date in Ansible at Spurl.net
  • Bookmark Certificate expiration date in Ansible at Simpy.com
  • Bookmark Certificate expiration date in Ansible at blogmarks
  • Bookmark Certificate expiration date in Ansible with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca