Browse Source

First import of librenms agent role

master
squeaky otter 3 years ago
commit
c071e69e73
Signed by: dashie GPG Key ID: C2D57B325840B755
  1. 11
      defaults/main.yml
  2. 28
      meta/main.yml
  3. 45
      tasks/install-agent.yml
  4. 8
      tasks/main.yml
  5. 8
      tasks/setup-Debian.yml
  6. 7
      tasks/setup-RedHat.yml

11
defaults/main.yml

@ -0,0 +1,11 @@
---
# Repository with LibreNMS Agent sources
librenms_agent_repository: 'https://github.com/librenms/librenms-agent.git'
# Which version to install, defaults to master
librenms_agent_version: 'master'
# check_mk scripts to deploy
# choice of available scripts: https://github.com/librenms/librenms-agent/tree/master/agent-local
librenms_agent_check_mk_scripts: []

28
meta/main.yml

@ -0,0 +1,28 @@
galaxy_info:
role_name: librenms_agent
description: Install and configure LibreNMS Agent.
author: Dashie <dashie@sigpipe.me>
license: MIT
min_ansible_version: 2.5
github_branch: master
platforms:
- name: Debian
versions:
- all
- name: Ubuntu
versions:
- all
- name: EL
versions:
- all
galaxy_tags:
- system
- development
- cloud
- librenms
- monitoring
- agent
- snmp
- checkmk
dependencies: []

45
tasks/install-agent.yml

@ -0,0 +1,45 @@
- name: Clone LibreNMS Agent repository
git:
repo: '{{ librenms_agent_repository }}'
dest: /opt/librenms-agent
version: '{{ librenms_agent_version }}'
- name: Copy check_mk_agent
copy:
src: /opt/librenms-agent/check_mk_agent
dest: /usr/bin/check_mk_agent
mode: u+r
- name: Install systemd service
copy:
src: /opt/librenms-agent/check_mk@.service
dest: /etc/systemd/system/check_mk@.service
- name: Install systemd service socket
copy:
src: /opt/librenms-agent/check_mk.socket
dest: /etc/systemd/system/check_mk.socket
- name: Create agent directories
file:
path: '{{ item.item }}'
state: directory
with_items:
- /usr/lib/check_mk_agent/plugins
- /usr/lib/check_mk_agent/local
# Install scripts from agent-local/ to /usr/lib/check_mk_agent/local and u+x
- name: Install check_mk agent scripts
copy:
src: '/opt/librenms-agent/agent-local/{{ item }}'
dest: '/usr/lib/check_mk_agent/local/{{ item }}'
mode: 0755
with_flattened: '{{ librenms_agent_check_mk_scripts }}'
- name: Enable check_mk service
systemd:
name: check_mk.socket
state: restarted
enabled: yes
daemon_reload: yes

8
tasks/main.yml

@ -0,0 +1,8 @@
---
- name: "{{ ansible_os_family }} Family"
include_tasks: "setup-{{ ansible_os_family}}.yml"
- name: "LibreNMS Agent installation"
include_tasks: install-agent.yml

8
tasks/setup-Debian.yml

@ -0,0 +1,8 @@
---
- name: Ensure that HTTPS transport for APT is installed
apt:
name: "apt-transport-https"
state: present
when: ansible_distribution == 'Debian'

7
tasks/setup-RedHat.yml

@ -0,0 +1,7 @@
---
- name: Install epel-release
yum:
name: "epel-release"
state: present
when: ansible_distribution == 'RedHat'
Loading…
Cancel
Save