---
- name: Install Nagios
  action: apt pkg=nagios3=3.5.1-1ubuntu1 state=installed

- name: Delete default Nagios config files
  action: file path=/etc/nagios3/conf.d/{{ item }} state=absent
  with_items:
    - contacts_nagios2.cfg
    - extinfo_nagios2.cfg
    - generic-host_nagios2.cfg
    - generic-service_nagios2.cfg
    - hostgroups_nagios2.cfg
    - localhost_nagios2.cfg
    - services_nagios2.cfg
    - timeperiods_nagios2.cfg
  notify: Restart Nagios

- name: Configure Nagios
  action: copy src=conf/{{ item }} dest=/etc/nagios3/conf.d/{{ item }} owner=nagios group=nagios
  with_fileglob: conf/*
  notify: Restart Nagios

- name: Install NRPE plugin
  action: apt pkg=nagios-nrpe-plugin state=installed
  notify: Restart Nagios

- name: Configure nginx site
  action: copy src=nagios.pittcsc.org dest=/etc/nginx/sites-available/nagios.pittcsc.org
  notify: Restart nginx

- name: Enable nginx site
  action: file path=/etc/nginx/sites-enabled/nagios.pittcsc.org src=/etc/nginx/sites-available/nagios.pittcsc.org state=link
  notify: Restart nginx

- name: Allow HTTP traffic
  action: ufw direction=in proto=tcp port=80 rule=allow
  notify: Reload ufw

---
- name: Install Nagios
  action: apt pkg=nagios3=3.5.1-1ubuntu1 state=installed

- name: Delete default Nagios config files
  action: file path=/etc/nagios3/conf.d/{{ item }} state=absent
  with_items:
    - contacts_nagios2.cfg
    - extinfo_nagios2.cfg
    - generic-host_nagios2.cfg
    - generic-service_nagios2.cfg
    - hostgroups_nagios2.cfg
    - localhost_nagios2.cfg
    - services_nagios2.cfg
    - timeperiods_nagios2.cfg
  notify: Restart Nagios

- name: Configure Nagios
  action: copy src=conf/{{ item }} dest=/etc/nagios3/conf.d/{{ item }} owner=nagios group=nagios
  with_fileglob:
    - conf/*
  notify: Restart Nagios

- name: Install NRPE plugin
  action: apt pkg=nagios-nrpe-plugin state=installed
  notify: Restart Nagios

- name: Configure nginx site
  action: copy src=nagios.pittcsc.org dest=/etc/nginx/sites-available/nagios.pittcsc.org
  notify: Restart nginx

- name: Enable nginx site
  action: file path=/etc/nginx/sites-enabled/nagios.pittcsc.org src=/etc/nginx/sites-available/nagios.pittcsc.org state=link
  notify: Restart nginx

- name: Allow HTTP traffic
  action: ufw direction=in proto=tcp port=80 rule=allow
  notify: Reload ufw

Fix possibly incorrect Ansible syntax
Fix possibly incorrect Ansible syntax
