title: Conditional substring in a Jinja2 template
body: <p>When deploying with ansible, There's 1 specific case where I need to strip a string of a trailing <code>-p</code> substring.</p>
  
  <p>The string <code>somemachine-prod-p</code> should become <code>somemachine-prod</code> only if the <code>-p</code> is at the end.</p>
  
  <p>The substring function I saw I can use with Jinja does not fulfill my needs as I need to strip the end of the string, not the start.</p>
  
  <p>Ideas?</p>