I'm glad that you wrote this down- I run snmpd on Ubuntu, and I suspect my
setup only works accidentally.
On Aug 19, 2014 9:07 AM, <[email protected]> wrote:

> I know this is an old thread, but it came up in google, and I have a
> working solution now, so here it is.
>
> The trick is to remember that /var/lib/snmp/snmpd.conf is overwritten from
> memory when snmpd shuts down, so it has to be off before you can write
> anything to it.
>
> - hosts: monitored
>   tasks:
>   - name: make sure snmpd is installed
>     apt: name=snmpd state=present
>   - name: make sure snmpd is off
>     service: name=snmpd state=stopped enabled=yes
>   - name: make sure snmpd is configured
>     copy: src=snmpd.conf.etc  dest=/etc/snmp/snmpd.conf
>   - name: make sure snmpd has creds
>     lineinfile: dest=/var/lib/snmp/snmpd.conf line='createUser nis MD5
> badpassword DES badpassword'
>   - name: make sure snmpd is on
>     service: name=snmpd state=started
>
>
> It would be nice to skip the restart if the credentials were already
> there, but since they are hashed there is no trivial way to check without
> the service restart.
>
> on the up side, if the createUser line is redundant snmpd does not create
> an extra hash line, it just saves the one.
>
> I originally tried adding the hashed credentail line before I discovered
> that the hash is generated with the snmpd serial#, so the hash will not
> validate unless generated on a machine with the same serial#
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8f7fbfe3-f709-41a9-b047-cb8f02250d3e%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/8f7fbfe3-f709-41a9-b047-cb8f02250d3e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAGYSzJ_F%2BA%3DvUABpr-H9dx%2B1dPZ6taj%3DHQVLZ2aBAP%2ByVG%2B4DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to