Reviewing playbook and role
Let's jump right into examining the roles we created.
The completed role and file named main.yml
located in the snmp-config/tasks
directory looks like this:
--- name: Install additional packages apt: name="{{ item }}" state=present with_items: - snmpd name: Move standard config command: mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org name: Place new config file template: src=snmpd.conf dest=/etc/snmp/snmpd.conf name: Update SNMP options shell: chdir=/bin sed -i 's+^SNMPDOPTS.*+SNMPDOPTS="-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf"+' /etc/default/snmpd name: Stop SNMP service command: service snmpd stop name: Start SNMP service command: service snmpd start name: Set SNMP service ...
Get OpenStack Administration with Ansible 2 - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.