41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
|
|
|
||
|
|
---
|
||
|
|
- name: installing metrics storage
|
||
|
|
hosts: server
|
||
|
|
gather_facts: false
|
||
|
|
tasks:
|
||
|
|
- name: Create prometheus directory if it does not exist
|
||
|
|
ansible.builtin.file:
|
||
|
|
path: /opt/infra/prometheus
|
||
|
|
state: directory
|
||
|
|
mode: '0755'
|
||
|
|
- name: Create prometheus config file
|
||
|
|
ansible.builtin.copy:
|
||
|
|
src: prometheus/prometheus.yml
|
||
|
|
dest: /opt/infra/prometheus/prometheus.yml
|
||
|
|
- name: Install collectd
|
||
|
|
ansible.builtin.apt:
|
||
|
|
name: collectd
|
||
|
|
state: present
|
||
|
|
update_cache: yes
|
||
|
|
become: true
|
||
|
|
- name: Install collectd config file
|
||
|
|
ansible.builtin.copy:
|
||
|
|
src: collectd/collectd.conf
|
||
|
|
dest: /etc/collectd/collectd.conf
|
||
|
|
become: true
|
||
|
|
- name: Restart collectd service
|
||
|
|
ansible.builtin.systemd_service:
|
||
|
|
name: collectd.service
|
||
|
|
state: restarted
|
||
|
|
become: true
|
||
|
|
- name: Create prometheus compose file
|
||
|
|
ansible.builtin.copy:
|
||
|
|
src: prometheus/compose.yml
|
||
|
|
dest: /opt/infra/prometheus/compose.yml
|
||
|
|
- name: Deploy prometheus compose file
|
||
|
|
community.docker.docker_compose_v2:
|
||
|
|
project_src: /opt/infra/prometheus
|
||
|
|
files:
|
||
|
|
- compose.yml
|