Hi,
I am trying to write ansible playbook for Nagios client installation and configuration.
- name: untar Plugin Zip file to libexec directory
command: mount | grep -v "rootLV" | grep ext4 | awk '{print $3}'
register: dirlist
- name: create Nagios Host ServiceConfig file
blockinfile:
dest: /scripts/{{ ansible_hostname }}_svc.cfg
block: |
define service{
host_name {{ ansible_hostname }}
service_description {{ item }} filesystem
check_command check_nrpe!check_disk_boot
max_check_attempts 3
normal_check_interval 5
retry_check_interval 3
check_period 24x7
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
contact_groups touchpoint
notifications_enabled 1}
with_items: "{{dirlist.stdout_lines}}"
I was trying to create service configuration file using above playbook but it's been failing. Can someone guide me on this