I am running a playbook to display output correctly and have set the yaml callback plugin in ansible.cfg
ansible-playbook -i inventory syslog_new.yml --check
- name: Juniper SRX Compliance checks
hosts: juniper
gather_facts: false
tasks:
- name: Syslog server check
junos_config:
src: /home/gefelas/ansible_junos/files/syslog_config.txt
diff: true
register: junos_output
- debug:
msg: Syslog server check - This check has failed with the following output({{ junos_output.diff.prepared }})
when: junos_output.changed
- debug:
msg: Syslog server check - This check has passed with the following output({{ junos_output.diff.prepared }})
when: not junos_output.changed
The result gives
TASK [debug] ***********************************************************************************************************************************************
ok: [172.16.203.121] =>
msg: |-
Syslog server check - This check has failed with the following output([edit system syslog host 192.168.100.70]
+ interactive-commands any;
[edit system syslog host 192.168.100.70]
+ facility-override local1;
+ log-prefix firewall;
+ source-address 172.16.203.121;
+ explicit-priority;
[ edit system syslog]
+ file messages {
+ any critical;
+ authorization info;
+ }
+ file default-log-messages {
+ structured-data;
+ }
+ file sessions {
+ user info;
+ }
+ file interactive-commands {
+ interactive-commands error;
+ })
How can I turn it to something like this ?
How can I turn it to something like this ?
TASK [debug] ***********************************************************************************************************************************************
ok: [172.16.203.121] =>
msg: |-
Syslog server check - This check has failed with the following output
set system syslog archive size 300000
set system syslog archive files 3
set system syslog archive world-readable
set system syslog user * any emergency
set system syslog host 192.168.100.70 any any
set system syslog host 192.168.100.70 interactive-commands any
set system syslog host 192.168.100.70 facility-override local1
set system syslog host 192.168.100.70 log-prefix firewall
set system syslog host 192.168.100.70 source-address "172.16.203.121"
set system syslog host 192.168.100.70 explicit-priority
set system syslog file messages any critical
set system syslog file messages authorization info
set system syslog file default-log-messages structured-data
set system syslog file sessions user info
set system syslog file interactive-commands interactive-commands error