Switched to usage of FQCNs

This commit is contained in:
2025-11-26 15:48:40 +01:00
parent 990b22176f
commit 448f22b422
8 changed files with 52 additions and 52 deletions

View File

@@ -1,12 +1,12 @@
- include_vars: snmp_users.yml
- ansible.builtin.include_vars: snmp_users.yml
- name: server | snmpd | install package
package:
ansible.builtin.package:
name: "{{ snmpd_package }}"
state: present
- name: server | snmpd | install sudoers file
copy:
ansible.builtin.copy:
dest: "/etc/sudoers.d/10-debian-snmp"
src: "sudoers"
owner: "root"
@@ -16,14 +16,14 @@
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"]
- name: server | snmpd | create /etc/snmp
file:
ansible.builtin.file:
path: "/etc/snmp"
state: directory
owner: "root"
group: "root"
- name: server | snmpd | insert anchors to snmpd.conf
blockinfile:
ansible.builtin.blockinfile:
path: "{{ snmpd_conf }}"
create: true
marker: "# {mark} ANSIBLE MANAGED BLOCK"
@@ -32,24 +32,24 @@
# SECTION: custom settings
- name: server | snmpd | stop service
service:
ansible.builtin.service:
name: "snmpd"
state: stopped
- name: server | snmpd | setup monitoring user SNMPv3
lineinfile:
ansible.builtin.lineinfile:
path: "{{ snmpd_user_file }}"
create: true
line: "createuser {{ snmp_user }} {{ snmp_auth_proto }} {{ snmp_auth_pass }} {{ snmp_priv_proto }} {{ snmp_priv_pass }}"
- name: server | snmpd | setup ACLs
lineinfile:
ansible.builtin.lineinfile:
path: "{{ snmpd_conf }}" # required. The file to modify. Before Ansible 2.3 this option was only usable as I(dest), I(destfile) and I(name).
line: "rouser {{ snmp_user }} authpriv"
insertafter: "# SECTION: custom settings"
- name: server | snmpd | enable service on wireguard interface
lineinfile:
ansible.builtin.lineinfile:
path: "{{ snmpd_conf }}"
regexp: "^agentaddress.*$"
state: present
@@ -57,34 +57,34 @@
when: wg_local_ip is defined
- name: server | snmpd | set sysLocation
lineinfile:
ansible.builtin.lineinfile:
path: "{{ snmpd_conf }}"
regexp: '^sysLocation.*$'
state: present
line: "sysLocation {{ snmp_location }}"
- name: server | snmpd | set sysContact
lineinfile:
ansible.builtin.lineinfile:
path: "{{ snmpd_conf }}"
regexp: '^sysContact.*$'
state: present
line: "sysContact {{ snmp_contact }}"
- name: server | snmpd | enable service on all interfaces
lineinfile:
ansible.builtin.lineinfile:
path: "{{ snmpd_conf }}"
regexp: "^agentaddress.*$"
state: absent
when: wg_local_ip is not defined
- name: server | snmpd | copy distro script
copy:
ansible.builtin.copy:
dest: "/etc/snmp/distro"
src: "distro"
mode: "0755"
- name: server | snmpd | get os-updates script
get_url:
ansible.builtin.get_url:
url: "https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/osupdate"
dest: "/etc/snmp/osupdate"
mode: "0755"
@@ -92,7 +92,7 @@
group: "root"
- name: server | snmpd | configure extends
lineinfile:
ansible.builtin.lineinfile:
path: "{{ snmpd_conf }}"
state: present
line: "extend {{ item.service }} '{{ item.script }}'"
@@ -106,14 +106,14 @@
- block:
- name: server | snmpd | get proxmox script
get_url:
ansible.builtin.get_url:
url: "https://raw.githubusercontent.com/librenms/librenms-agent/master/agent-local/proxmox"
dest: "/usr/local/bin/proxmox"
mode: "0755"
owner: "root"
group: "root"
- name: server | snmpd | configure proxmox extends
lineinfile:
ansible.builtin.lineinfile:
path: "{{ snmpd_conf }}"
state: present
line: "extend proxmox {{ sudo }} /usr/local/bin/proxmox"
@@ -123,7 +123,7 @@
- is_proxmox == true
- name: server | snmpd start service
service:
ansible.builtin.service:
name: "snmpd"
state: started
enabled: true

View File

@@ -4,29 +4,29 @@
# state: absent
- name: server | telegraf | download key
uri:
ansible.builtin.uri:
url: "https://repos.influxdata.com/influxdata-archive_compat.key"
dest: "/tmp/influxdb.key"
creates: "/tmp/influxdb.key"
- name: server | telegraf | verify and import key
shell:
ansible.builtin.shell:
cmd: "echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c /tmp/influxdb.key' | sha256sum -c && cat /tmp/influxdb.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null"
creates: "/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg"
- name: server | telegraf | add repository
shell:
ansible.builtin.shell:
cmd: "echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list"
creates: "/etc/apt/sources.list.d/influxdata.list"
- name: server | telegraf | install telegraf
apt:
ansible.builtin.apt:
name: "telegraf"
state: latest
update_cache: yes
- name: server | telegraf | copy basic config
copy:
ansible.builtin.copy:
dest: "/etc/telegraf/telegraf.d/{{ item | basename }}"
src: "{{ item }}"
with_fileglob: