Add custom configuration for snmpd systemd service

The point is to fix the error message on Debian Buster :
**snmpd[...]: error on subcontainer 'ia_addr' insert (-1)**
This commit is contained in:
Jeremy Gardais 2021-09-02 17:38:01 +02:00
parent 134640f473
commit c515e9ceec
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
7 changed files with 84 additions and 2 deletions

View File

@ -1,4 +1,4 @@
## v1.X.Y ## v1.4.0
### Fix ### Fix
@ -8,6 +8,9 @@
### Enhancements ### Enhancements
* Repository version 10.1.0.0 for Debian Bullseye and Ubuntu Focal. * Repository version 10.1.0.0 for Debian Bullseye and Ubuntu Focal.
* Manage custom configuration for snmpd systemd service on Debian Buster.
The point is to fix the error message :
**snmpd[...]: error on subcontainer 'ia_addr' insert (-1)**
## v1.3.1 ## v1.3.1

View File

@ -20,6 +20,10 @@ A role to manage OpenManage (via omreport, omconfig,…), it's web interface OMS
* **openmanage__dep_packages**: List of dependencies packages to be able to run racadm [default: `See default/main.yml`]. * **openmanage__dep_packages**: List of dependencies packages to be able to run racadm [default: `See default/main.yml`].
* **openmanage__base_packages**: List of base packages for all racadm base usage [default: `See default/main.yml`]. * **openmanage__base_packages**: List of base packages for all racadm base usage [default: `See default/main.yml`].
* **openmanage__stretch_packages**: List of some packages specific to Debian Stretch (or Ubuntu Xenial) and previous versions [default: `See default/main.yml`]. * **openmanage__stretch_packages**: List of some packages specific to Debian Stretch (or Ubuntu Xenial) and previous versions [default: `See default/main.yml`].
* **openmanage__snmpd_service_name**: SNMPD service name to manage [default : `snmpd`].
* **openmanage__snmpd_service_enabled**: If the SNMPD service should be enabled at startup [default : `true`].
* **openmanage__snmpd_service_override_path**: Path to store SNMPD custom conf [default : `/etc/systemd/system/snmpd.service.d/override.conf`].
* **openmanage__snmpd_service_override_content**: Template used to provide systemd custom conf for SNMPD service [default : `etc/systemd/system/snmpd.service.d/override.conf.j2`].
* **openmanage__webgui_state**: The desired state for web interface of OMSA [default : `absent`]. * **openmanage__webgui_state**: The desired state for web interface of OMSA [default : `absent`].
* **openmanage__webgui_packages**: List of packages to provide web interface to OMSA [default: `See default/main.yml`]. * **openmanage__webgui_packages**: List of packages to provide web interface to OMSA [default: `See default/main.yml`].
* **openmanage__webgui_service_name**: Name of the systemd unit to manage web interface [default: `dsm_om_connsvc`]. * **openmanage__webgui_service_name**: Name of the systemd unit to manage web interface [default: `dsm_om_connsvc`].

View File

@ -140,6 +140,37 @@ openmanage__webgui_packages:
- 'srvadmin-webserver' - 'srvadmin-webserver'
# ]]] # ]]]
# ]]]
# Service management [[[
# ----------------------
# .. envvar:: openmanage__snmpd_service_name [[[
#
# SNMPD service name to manage.
openmanage__snmpd_service_name: 'snmpd'
# ]]]
# .. envvar:: openmanage__snmpd_service_enabled [[[
#
# If the SNMPD service should be enabled at startup? Possible options are:
#
# ``true``
# Default. The service is enabled.
#
# ``false``
# The service is disabled from startup.
openmanage__snmpd_service_enabled: true
# ]]]
# .. envvar:: openmanage__snmpd_service_override_path [[[
#
# Path to store SNMPD custom conf.
openmanage__snmpd_service_override_path: '/etc/systemd/system/snmpd.service.d/override.conf'
# ]]]
# .. envvar:: openmanage__snmpd_service_override_content [[[
#
# Template used to provide systemd custom conf for SNMPD service.
openmanage__snmpd_service_override_content: 'etc/systemd/system/snmpd.service.d/override.conf.j2'
# ]]]
# ]]] # ]]]
# Web interface [[[ # Web interface [[[
# ----------------------------- # -----------------------------

View File

@ -1,6 +1,17 @@
--- ---
# handlers file for openmanage # handlers file for openmanage
- name: Restart snmpd service
systemd:
daemon_reload: '{{ (openmanage__snmpd_register_systemd_custom.changed | default(False)) }}'
state: '{{ "restarted" if (openmanage__snmpd_service_enabled)
else "stopped" }}'
name: '{{ openmanage__snmpd_service_name }}'
enabled: '{{ openmanage__snmpd_service_enabled }}'
when:
- openmanage__deploy_state == "present"
- ansible_service_mgr == 'systemd'
- name: restart dataeng service - name: restart dataeng service
service: service:
name: 'dataeng' name: 'dataeng'

View File

@ -4,6 +4,8 @@ dependencies: []
galaxy_info: galaxy_info:
author: "Jérémy Gardais" author: "Jérémy Gardais"
namespace: ipr-cnrs
role_name: openmanage
description: "Setup Openmanage" description: "Setup Openmanage"
license: WTFPL license: WTFPL
company: IPR company: IPR
@ -12,8 +14,9 @@ galaxy_info:
platforms: platforms:
- name: Debian - name: Debian
versions: versions:
- stretch - bullseye
- buster - buster
- stretch
galaxy_tags: galaxy_tags:
- system - system
- openmanage - openmanage

View File

@ -110,6 +110,29 @@
- (openmanage__deploy_state == "absent") - (openmanage__deploy_state == "absent")
- "'srvadmin' in ansible_facts.packages" - "'srvadmin' in ansible_facts.packages"
# Manage configuration [[[1
- name: Create SNMPD custom directory for systemd service
file:
path: "{{ openmanage__snmpd_service_override_path | dirname }}"
state: directory
mode: '0755'
when:
- openmanage__deploy_state == "present"
- ansible_distribution_release in ["buster"]
- name: Add SNMPD systemd custom configuration
template:
src: '{{ openmanage__snmpd_service_override_content }}'
dest: '{{ openmanage__snmpd_service_override_path }}'
owner: 'root'
group: 'root'
mode: '0644'
register: openmanage__snmpd_register_systemd_custom
when:
- openmanage__deploy_state == "present"
- ansible_distribution_release in ["buster"]
notify: ['Restart snmpd service']
# Executable [[[1 # Executable [[[1
## Fix some permissions ## Fix some permissions
- name: Ensure Executables can be run - name: Ensure Executables can be run

View File

@ -0,0 +1,7 @@
# {{ ansible_managed }}
[Service]
# Fix error message: snmpd[...]: error on subcontainer 'ia_addr' insert (-1)
# By fixing logging options (-Lsd to -LS6d).
ExecStart=
ExecStart=/usr/sbin/snmpd -LS6d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f -p /run/snmpd.pid