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/ 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/ -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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.