Ansible-lint compliance for roles/snmpd_conf
All checks were successful
continuous-integration/drone/push Build is passing
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-centos9) (push) Successful in 19s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian11) (push) Successful in 13s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian12) (push) Successful in 13s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-fedora39) (push) Successful in 14s

This commit is contained in:
Chris Hammer 2023-12-23 01:03:58 -05:00
parent c5e6681e6d
commit 04b10864dc
10 changed files with 32 additions and 72 deletions

View File

@ -1,23 +1,23 @@
--- ---
__project_author : Chris Hammer snmpd_conf_project_author : Chris Hammer
__project_email : chris@thezengarden.net snmpd_conf_project_email : chris@thezengarden.net
__project_repo : https://github.com/jchristianh-ansible-collections/baseos snmpd_conf_project_repo : https://github.com/jchristianh-ansible-collections/baseos
__template_header : The Zen Garden snmpd_conf_template_header : The Zen Garden
__snmpd_conf_file : /etc/snmp/snmpd.conf snmpd_conf_snmpd_conf_file : /etc/snmp/snmpd.conf
__snmpd_conf_version : 1.0.1 snmpd_conf_snmpd_conf_version : 1.0.1
__snmpd_conf_revision : 231210 snmpd_conf_snmpd_conf_revision : 231210
__snmp_pkg : net-snmp snmpd_conf_snmp_pkg : net-snmp
__snmpd_location : 'Newport News, VA' snmpd_conf_snmpd_location : 'Newport News, VA'
__snmpd_contact_name : 'Chris Hammer' snmpd_conf_snmpd_contact_name : 'Chris Hammer'
__snmpd_contact_email : '<chris@thezengarden.net>' snmpd_conf_snmpd_contact_email : '<chris@thezengarden.net>'
... ...

View File

@ -1,40 +1,35 @@
--- ---
- name: Include distribution specific variables or include defaults
block:
- name: Include distribution specific variables
include_vars:
file: "{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}.yml"
rescue:
- name: Non-supported distribution; using default package set
include_vars:
file: __default_packages.yml
- name: Deploy and configure SNMP - name: Deploy and configure SNMP
block: block:
- name: Set package name for Debian 12
ansible.builtin.set_fact:
snmpd_conf_snmp_pkg: snmpd
when:
- ansible_distribution | lower == 'debian'
- ansible_distribution_major_version == '12'
- name: Install SNMP - name: Install SNMP
package: ansible.builtin.package:
name: "{{ __snmp_pkg }}" name: "{{ snmpd_conf_snmp_pkg }}"
state: present state: present
- name: Ensure /etc/snmp directory is present - name: Ensure /etc/snmp directory is present
file: ansible.builtin.file:
path: /etc/snmp path: /etc/snmp
state: directory state: directory
mode: "0755"
- name: Deploy snmpd.conf - name: Deploy snmpd.conf
template: ansible.builtin.template:
src: templates/snmpd_conf.j2 src: templates/snmpd_conf.j2
dest: "{{ __snmpd_conf_file }}" dest: "{{ snmpd_conf_snmpd_conf_file }}"
mode: 0644 mode: "0644"
notify: Restart_SNMPd notify: Restart_SNMPd
rescue: rescue:
- name: Unable to deploy SNMP - name: Unable to deploy SNMP
debug: ansible.builtin.debug:
msg: "Unable to deploy SNMP to {{ inventory_hostname }}." msg: "Unable to deploy SNMP to {{ inventory_hostname }}."

View File

@ -1,11 +1,11 @@
############################################### ###############################################
# {{ __template_header }} # {{ snmpd_conf_template_header }}
############################################### ###############################################
# #
# Configuration : {{ __snmpd_conf_file }} # Configuration : {{ snmpd_conf_snmpd_conf_file }}
# Template Version : {{ __snmpd_conf_version}}-{{ __snmpd_conf_revision }} # Template Version : {{ snmpd_conf_snmpd_conf_version }}-{{ snmpd_conf_snmpd_conf_revision }}
# #
# {{ __project_author }} ({{ __project_email }}) # {{ snmpd_conf_project_author }} ({{ snmpd_conf_project_email }})
############################################### ###############################################
@ -33,6 +33,6 @@ access MyRWGroup "" any noauth exact all all none
############################################################################### ###############################################################################
# System contact information # System contact information
# #
syslocation {{ __snmpd_location }} syslocation {{ snmpd_conf_snmpd_location }}
syscontact {{ __snmpd_contact_name }} {{ __snmpd_contact_email }} syscontact {{ snmpd_conf_snmpd_contact_name }} {{ snmpd_conf_snmpd_contact_email }}
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -1,5 +0,0 @@
---
__snmp_pkg: net-snmp
...

View File

@ -1,5 +0,0 @@
---
__snmp_pkg: net-snmp
...

View File

@ -1,5 +0,0 @@
---
__snmp_pkg: net-snmp
...

View File

@ -1,5 +0,0 @@
---
__snmp_pkg: net-snmp
...

View File

@ -1,5 +0,0 @@
---
__snmp_pkg: snmpd
...

View File

@ -1,5 +0,0 @@
---
__snmp_pkg: snmpd
...

View File

@ -1,5 +0,0 @@
---
__snmp_pkg: net-snmp
...