Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the spelling of address and use [] around the IPv6 address in the template #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ ansible-galaxy install sbaerlocher.snmp
| snmp_encryption | snmp_encryption | SNMP Encryption |
| snmp_contact | | Optional: System Contact |
| snmp_location | | Optional: System Location |
| snmp_agentadress_protocol.ipvX | udp / udp6 | Optional: SNMP Protocol, X for ipv4 or ipv6 |
| snmp_agentadress_adress.ipvX | {{ ansible_default_ipv4.address }} / {{ ansible_default_ipv6.address }} | Optional: SNMP bind address, X for ipv4 or ipv6 |
| snmp_agentadress_port.ipvX | 161 / 161 | Optional: SNMP port, X for ipv4 or ipv6 |
| snmp_agentaddress_protocol.ipvX | udp / udp6 | Optional: SNMP Protocol, X for ipv4 or ipv6 |
| snmp_agentaddress_address.ipvX | {{ ansible_default_ipv4.address }} / {{ ansible_default_ipv6.address }} | Optional: SNMP bind address, X for ipv4 or ipv6 |
| snmp_agentaddress_port.ipvX | 161 / 161 | Optional: SNMP port, X for ipv4 or ipv6 |

## Dependencies

Expand Down
8 changes: 4 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ snmp_additional_packages: []
snmp_encryption: snmp_encryption
snmp_extension_scripts: '/usr/local/lib/snmpd'
snmp_logging_options: ''
snmp_access_adress: 0.0.0.0
snmp_access_address: 0.0.0.0
snmp_monitoring_server: 0.0.0.0
snmp_password: snmp_password
snmp_user: snmp

snmp_agentadress_protocol:
snmp_agentaddress_protocol:
ipv4: udp
ipv6: udp6
snmp_agentadress_adress:
snmp_agentaddress_address:
ipv4: "{{ ansible_default_ipv4.address if ansible_default_ipv4.address is defined else '127.0.0.1' }}"
ipv6: "{{ ansible_default_ipv6.address if ansible_default_ipv6.address is defined else '::1' }}"
snmp_agentadress_port:
snmp_agentaddress_port:
ipv4: 161
ipv6: 161

Expand Down
4 changes: 2 additions & 2 deletions tasks/distribution/Microsoft Windows 10 Pro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- path: PermittedManagers
name: '1'
type: string
data: '{{ snmp_access_adress | default() }}'
data: '{{ snmp_access_address | default() }}'
- path: RFC1156Agent
name: sysContact
type: string
Expand All @@ -34,7 +34,7 @@
notify:
- restart win snmp

- name: 'windows : set remote IP-Adresss'
- name: 'windows : set remote IP-Addresss'
set_fact:
snmp_remoteip: "{{ lookup('dig', snmp_monitoring_server ) }}"
when: not snmp_monitoring_server | ipaddr
Expand Down
4 changes: 2 additions & 2 deletions tasks/distribution/Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- path: PermittedManagers
name: '1'
type: string
data: '{{ snmp_access_adress | default() }}'
data: '{{ snmp_access_address | default() }}'
- path: RFC1156Agent
name: sysContact
type: string
Expand All @@ -33,7 +33,7 @@
notify:
- restart win snmp

- name: 'windows : set remote IP-Adresss'
- name: 'windows : set remote IP-Addresss'
set_fact:
snmp_remoteip: "{{ lookup('dig', snmp_monitoring_server ) }}"
when: not snmp_monitoring_server | ipaddr
Expand Down
4 changes: 2 additions & 2 deletions templates/snmp/snmpd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ createUser {{ snmp_user }} SHA {{ snmp_password }} AES {{ snmp_encryption }}

rouser {{ snmp_user }} priv
{% if ansible_default_ipv4.address is defined %}
agentAddress {{ snmp_agentadress_protocol.ipv4 }}:{{ snmp_agentadress_adress.ipv4 }}:{{ snmp_agentadress_port.ipv4 }}
agentAddress {{ snmp_agentaddress_protocol.ipv4 }}:{{ snmp_agentaddress_address.ipv4 }}:{{ snmp_agentaddress_port.ipv4 }}
{% endif %}
{% if ansible_default_ipv6.address is defined %}
agentAddress {{ snmp_agentadress_protocol.ipv6 }}:{{ snmp_agentadress_adress.ipv6 }}:{{ snmp_agentadress_port.ipv6 }}
agentAddress {{ snmp_agentaddress_protocol.ipv6 }}:[{{ snmp_agentaddress_address.ipv6 }}]:{{ snmp_agentaddress_port.ipv6 }}
{% endif %}

{% if snmp_location is defined %}
Expand Down