Wednesday, May 12, 2021

 How to copy block of lines to end of file through Ansible


Following playbook can be used to push block of lines in list.cfg(in this case) to nrpe.cfg  at End of file.

We can push to many number of servers from single ansible Control node.

---

- name: copy the repo

  hosts: localhost

  tasks:

    - blockinfile:

            block: "{{ lookup('file', 'list.cfg') }}"

            dest: /etc/nagios/nrpe.cfg

            backup: yes

      register: output


Ansible Playbook to collect uptime of servers

Hi,  This is to explain how we can write a small playbook to collect uptime of all servers in our environment. We can use our own server l...