Variables

Hey ho…

I’m trying to get/parse some info out of the yaml returned by a module and want to know if there is any better documentation available than:

E.g.:

my module returns the data like this:

proc[‘COMMAND’] = ‘/opt/mw/java/jdk1.6.0_29-32b/bin/java -Dprogram.name=rc_jboss.sh -server -Xmx2048m -Xms2048m …20 other parameters… org.jboss.Main -c PPPTN-PLAB1 -b HOSTTTY -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB’
proc[‘PID’] = ‘1234’
module.exit_json(changed=False, rc=0, process=proc)

my playbook looks something like:

  • name: check status of jboss instances
    hosts: xx.yy.com
    gather_facts: no
    tasks:
  • jboss:
    register: out
  • debug: msg=“PID of JBOSS instance {{out.COMMAND|???}} is {{out.PID}}.”
    when: “True”

In this case I would love to have a jinja filter that supports better parsing than replace(). E.g. a replace() that supports python regEx, or a substring() function.

I’ve never used Jinja before so I hope this is not a stupid question. I read what documentation I could find. But feel free to point me to the right documentation if there one…

Any ideas? custom Jinja filters?

Thanks
Kashyap