I have the following dict:

syslog_clients:

                mailout:
                    hosts: "[ '10.5.10.111', '10.5.10.112', '10.5.10.11' ]"
                    destinations:
                        - destination: '/logs/mail/mail.log'

     apache:
         hosts: "[ '10.5.13.24', '10.5.13.25', '10.5.13.26' ]"
         destinations:
             - var: '$syslogtag'
               contains: 'apache-access:'
               destination: '/logs/web/access.log'
             - var: '$syslogtag'
               contains: 'apache-error:'
               destination: '/logs/web/error.log'


Required output:

if $fromhost-ip == [ "10.5.10.111", "10.5.10.112", "10.5.10.11" ] then 
/logs/mail/mail.log
& stop
if $fromhost-ip == [ '10.5.13.24', '10.5.13.25', '10.5.13.26' ] then {
  if $syslogtag contains 'apache-access:' then /logs/web/access.log
  & stop
  else if $syslogtag contains 'apache-error:' then /logs/web/error.log
  & stop
  else /logs/web/other.log
  & stop
}


Above output is a Rsyslog config file. Logs from certain (like *apache*) 
`syslog-clients` need to have the variable '$syslogtag' evaluated, while 
from some (like *mailout*) need not. I need to have a Jinja2 template that 
fits both the types of `syslog-clients`.

Thank you.

-- 
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/13c95507-f744-4914-96cd-78004158cabb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to