---

- name: base packages installed
  package:
    name: 
    - prometheus
    - nginx

- name: prometheus site template
  template:
    src: prometheus_site.j2
    dest: /etc/nginx/sites-available/prometheus
  notify: reload nginx
  tags: nginx
- name: site link
  file:
    state: link
    path: /etc/nginx/sites-enabled/prometheus
    src: ../sites-available/prometheus
  notify: reload nginx
  tags: nginx
- name: prometheus role file
  lineinfile:
    path: /var/lib/prometheus/node-exporter/role.prom
    line: 'role{name="prometheus",type="monitoring server"} 1'
    regex: '^role{name="prometheus".*'
    create: yes
    owner: root
    group: root
    mode: 0644 
  tags: prom_textfile
