From 7a9885bb27e4768884ef2dee9012358a0877cee7 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Thu, 29 Nov 2018 21:39:16 +0100 Subject: [PATCH] Fix Ansible warnings Add support for Ubuntu 18.04 and Debian 9 --- .travis.yml | 4 +++- README.md | 14 +++++++++----- Vagrantfile | 20 ++++++++++++++++++-- meta/main.yml | 3 +++ tasks/main.yml | 3 +-- templates/etc/snmp/snmpd.conf.j2 | 2 +- tests/vagrant.sh | 2 +- 7 files changed, 36 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 76efdea..c0001cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,10 @@ python: "2.7" env: - ANSIBLE_VERSION=latest + - ANSIBLE_VERSION=2.7.2 - ANSIBLE_VERSION=2.7.1 - ANSIBLE_VERSION=2.7.0 + - ANSIBLE_VERSION=2.6.8 - ANSIBLE_VERSION=2.6.7 - ANSIBLE_VERSION=2.6.6 - ANSIBLE_VERSION=2.6.5 @@ -60,7 +62,7 @@ script: && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1) - - if [ "$ANSIBLE_VERSION" = "latest" ]; then ansible-lint tests/test.yml || true; fi + - if [ "$ANSIBLE_VERSION" = "latest" ]; then ansible-lint tests/test.yml; fi notifications: email: false diff --git a/README.md b/README.md index 4e09663..a3c3b8d 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,16 @@ on **Ubuntu** this package is in **multiverse**. See the *"Recommended"* section * `snmpd_disks_include_all`: [default: `false`]: Include all disks mounted on the system in the SNMP table * `snmpd_disks_include_all_threshold_minpercent`: [default: `10%`]: Minimum free space specified as a percentage * `snmpd_disks`: [default: `[]`]: List of disk paths and their corresponding thresholds to be included in the SNMP table -* `snmpd_disks.path`: [required]: The disks mountpoint (e.g. `/`) -* `snmpd_disks.threshold`: [required]: The disks minimum threshold either be specified in kB (MINSPACE) or as a percentage of the total disk (MINPERCENT% with a '%' character) (e.g. `10%`) +* `snmpd_disks.{n}.path`: [required]: The disks mountpoint (e.g. `/`) +* `snmpd_disks.{n}.threshold`: [required]: The disks minimum threshold either be specified in kB (MINSPACE) or as a percentage of the total disk (MINPERCENT% with a '%' character) (e.g. `10%`) -* `snmpd_default_monitors` [default: `true`]: -* `snmpd_link_up_down_notifications` [default: `true`]: -* `snmpd_extensions`: [default: `[]`]: List of extension names and commands +* `snmpd_default_monitors` [default: `true`]: Configure the Event `MIB` tables to monitor the various `UCD-SNMP-MIB` tables for problems +* `snmpd_link_up_down_notifications` [default: `true`]: Configure the Event `MIB` tables to monitor the `fTable` for network interfaces being taken up or down, and triggering a `linkUp` or `linkDown` notification as appropriate + +* `snmpd_extensions`: [default: `[]`]: Extension MIB declaration(s) +* `snmpd_extensions.{n}.name`: [required]: An identifying string for the extension +* `snmpd_extensions.{n}.prog`: [required]: The program to run +* `snmpd_extensions.{n}.args`: [default: `[]`]: The arguments to give the program ## Dependencies diff --git a/Vagrantfile b/Vagrantfile index 0a32e9a..689bf9d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,6 +3,7 @@ role = File.basename(File.expand_path(File.dirname(__FILE__))) + boxes = [ { :name => "ubuntu-1204", @@ -25,17 +26,31 @@ boxes = [ :cpu => "50", :ram => "256" }, + { + :name => "ubuntu-1804", + :box => "bento/ubuntu-18.04", + :ip => '10.0.0.14', + :cpu => "50", + :ram => "256" + }, { :name => "debian-7", :box => "bento/debian-7", - :ip => '10.0.0.14', + :ip => '10.0.0.15', :cpu => "50", :ram => "256" }, { :name => "debian-8", :box => "bento/debian-8", - :ip => '10.0.0.15', + :ip => '10.0.0.16', + :cpu => "50", + :ram => "256" + }, + { + :name => "debian-9", + :box => "bento/debian-9", + :ip => '10.0.0.17', :cpu => "50", :ram => "256" }, @@ -54,6 +69,7 @@ Vagrant.configure("2") do |config| vms.vm.network :private_network, ip: box[:ip] + # TODO: Cleanup vms.vm.provision :shell do |shell| shell.path = "tests/vagrant.sh" end diff --git a/meta/main.yml b/meta/main.yml index a1c3c37..ce08f93 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,6 +1,7 @@ # meta file for snmpd --- galaxy_info: + role_name: snmpd author: Mischa ter Smitten company: Oefenweb.nl B.V. description: Set up snmp(d) in Debian-like systems @@ -12,10 +13,12 @@ galaxy_info: - precise - trusty - xenial + - bionic - name: Debian versions: - wheezy - jessie + - stretch galaxy_tags: - system dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml index 384f260..95b8d85 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,9 +13,8 @@ - name: install apt: - name: "{{ item }}" + name: "{{ snmpd_install }}" state: "{{ apt_install_state | default('latest') }}" - with_items: "{{ snmpd_install }}" tags: - configuration - snmpd diff --git a/templates/etc/snmp/snmpd.conf.j2 b/templates/etc/snmp/snmpd.conf.j2 index a17e82c..1a7464e 100644 --- a/templates/etc/snmp/snmpd.conf.j2 +++ b/templates/etc/snmp/snmpd.conf.j2 @@ -33,7 +33,7 @@ defaultMonitors {{ 'yes' if snmpd_default_monitors else 'no' }} linkUpDownNotifications {{ 'yes' if snmpd_link_up_down_notifications else 'no' }} {% for snmpd_extension in snmpd_extensions | default([]) %} -extend {{ snmpd_extension.name }} {{ snmpd_extension.command }} +extend {{ snmpd_extension.name }} {{ snmpd_extension.prog }} {{ snmpd_extension.args | default([]) | join(' ') }} {% endfor %} master agentx diff --git a/tests/vagrant.sh b/tests/vagrant.sh index 0fa169b..16996f0 100755 --- a/tests/vagrant.sh +++ b/tests/vagrant.sh @@ -8,7 +8,7 @@ thisFile="$(readlink -f ${0})"; thisFilePath="$(dirname ${thisFile})"; # Only provision once -if [ -f /provisioned ]; then +if [[ -f /provisioned ]]; then exit 0; fi