--- - name: configure monitoring copy: src={{ item }}_nagios2.cfg dest=/etc/nagios3/conf.d/{{ item }}_nagios2.cfg with_items: - 'hostgroups' - 'hosts' - 'commands' - 'services' - 'contactgroup' - 'contacts' - 'generic-host' - 'generic-service' sudo: true - name: remove unwanted configure files file: path=/etc/nagios3/conf.d/{{ item }}_nagios2.cfg state=absent with_items: - 'localhost' - 'extinfo' sudo: true - name: change cgi config copy: src=cgi.cfg dest=/etc/nagios3/cgi.cfg sudo: true - name: change the default email command copy: src=commands.cfg dest=/etc/nagios3/commands.cfg become: true become_user: root - name: nagios restart service: name=nagios3 state=restarted sudo: true