ansible-role-prometheus-nod.../tasks/main.yml

42 lines
866 B
YAML

- name: Install prometheus node exporter
become: true
apt:
name: prometheus-node-exporter
state: present
- name: Start and enable node exporter
become: true
systemd:
name: prometheus-node-exporter
state: started
enabled: true
- name: Place reverse proxy conf
become: true
template:
src: templates/nginx.conf.j2
dest: /etc/nginx/conf.d/{{ node_exporter_domain }}.conf
mode: 0600
notify: Check and Reload nginx
- name: Install apache2-utils
become: true
apt:
name: apache2-utils
state: present
- name: Setup htpasswd file
become: true
file:
path: "/etc/nginx/.htpasswd"
owner: www-data
group: www-data
mode: 0600
state: touch
- name: Set Login credentials
become: true
command:
cmd: "htpasswd -b /etc/nginx/.htpasswd prometheus {{ prometheus_pass }}"
changed_when: false