ansible-debops-infrastructure

DebOps and Ansible scripts to manage my infrastructure
git clone git://git.erethon.com/ansible-debops-infrastructure
Log | Files | Refs

commit 9eab3aa8a826eafeb2b7ac1bc4de6838bca3ed02
parent c1817425635a4ce1c75a44c3a4ef674fef695ee5
Author: Dionysis Grigoropoulos <dgrig@erethon.com>
Date:   Thu,  8 Nov 2018 22:47:09 +0200

monitoring: Install node_exporter from backports

Diffstat:
ansible/inventory/group_vars/all/apt_install.yml | 2+-
ansible/inventory/group_vars/all/apt_preferences.yml | 5+++++
ansible/inventory/group_vars/all/monitoring.yml | 2--
ansible/inventory/host_vars/rpizw/monitoring.yml | 4----
ansible/inventory/host_vars/spinny/apt_install.yml | 6++++++
ansible/roles/monitoring/tasks/main.yml | 56+-------------------------------------------------------
ansible/roles/monitoring/templates/sysconfig.node_exporter.j2 | 2+-
7 files changed, 14 insertions(+), 63 deletions(-)

diff --git a/ansible/inventory/group_vars/all/apt_install.yml b/ansible/inventory/group_vars/all/apt_install.yml @@ -4,4 +4,4 @@ apt_install__packages: [git, vim, rxvt-unicode-256color, screen, tmux, fail2ban, mlocate, htop, sudo, ferm, strace, ltrace, file, monit, less, nmon, colordiff, bash-completion, telnet, dstat, ca-certificates, curl, sysstat, tcpdump, zsh, mosh, lsof, iotop, netcat, mtr-tiny, bwm-ng, - etckeeper] + etckeeper,prometheus-node-exporter] diff --git a/ansible/inventory/group_vars/all/apt_preferences.yml b/ansible/inventory/group_vars/all/apt_preferences.yml @@ -0,0 +1,5 @@ +--- + +apt_preferences__list: + - package: 'prometheus-node-exporter' + backports: ['stretch'] diff --git a/ansible/inventory/group_vars/all/monitoring.yml b/ansible/inventory/group_vars/all/monitoring.yml @@ -1,5 +1,3 @@ --- -node_exporter__bundle: https://github.com/prometheus/node_exporter/releases/download/v0.16.0/node_exporter-0.16.0.linux-amd64.tar.gz -node_exporter__checksum: "sha256:e92a601a5ef4f77cce967266b488a978711dabc527a720bea26505cba426c029" node_exporter__listen_address: "{{ ansible_host }}" diff --git a/ansible/inventory/host_vars/rpizw/monitoring.yml b/ansible/inventory/host_vars/rpizw/monitoring.yml @@ -1,4 +0,0 @@ ---- - -node_exporter__bundle: https://github.com/prometheus/node_exporter/releases/download/v0.16.0/node_exporter-0.16.0.linux-armv6.tar.gz -node_exporter__checksum: "sha256:f9518aea4fa7127122a6bf384ba8f70120deaaef75532749f1765cf6e25fd820" diff --git a/ansible/inventory/host_vars/spinny/apt_install.yml b/ansible/inventory/host_vars/spinny/apt_install.yml @@ -0,0 +1,6 @@ +--- + +apt_install__host_packages: ['haproxy', 'cryptsetup', 'kvm', 'libvirt-clients', + 'libvirt-daemon-system', 'ebtables', 'dnsmasq', + 'bridge-utils', 'qemu-utils', 'virtinst', + 'openvpn', 'easy-rsa', 'pdns-server'] diff --git a/ansible/roles/monitoring/tasks/main.yml b/ansible/roles/monitoring/tasks/main.yml @@ -1,63 +1,9 @@ --- -- name: Download node_exporter - get_url: - url: "{{ node_exporter__bundle }}" - dest: /tmp/node_exporter.tar.gz - checksum: "{{ node_exporter__checksum }}" - -- file: - path: /tmp/node_exporter/ - state: directory - -- name: Extract node exporter bundle - unarchive: - src: /tmp/node_exporter.tar.gz - dest: /tmp/node_exporter - remote_src: yes - list_files: yes - register: unarchived_files - -- name: Copy node_exporter to /usr/sbin/ - copy: - src: "/tmp/node_exporter/{{ unarchived_files.files[0] }}/node_exporter" - dest: "/usr/sbin/" - remote_src: yes - owner: root - group: root - mode: 0755 - -- name: Delete /tmp/node_exporter - file: - path: /tmp/node_exporter - state: absent - -- name: Create node_exporter system user - user: - name: node_exporter - create_home: no - system: yes - shell: "/sbin/nologin" - -- name: Copy systemd unit file - copy: - src: node_exporter.service - dest: /etc/systemd/system/ - owner: root - group: root - mode: 0644 - - name: Copy systemd environment file template: src: sysconfig.node_exporter.j2 - dest: /etc/default/node_exporter + dest: /etc/default/prometheus-node-exporter owner: root group: root mode: 0644 - -- name: Enable node_exporter systemd service - systemd: - name: node_exporter - daemon_reload: yes - state: restarted - enabled: yes diff --git a/ansible/roles/monitoring/templates/sysconfig.node_exporter.j2 b/ansible/roles/monitoring/templates/sysconfig.node_exporter.j2 @@ -1 +1 @@ -OPTIONS="--web.listen-address={{ node_exporter__listen_address }}:9100" +ARGS="--web.listen-address={{ node_exporter__listen_address }}:9100"