diff --git a/roles/smbclient/tasks/playbook.yaml b/roles/smbclient/tasks/playbook.yaml new file mode 100755 index 0000000..33b82ce --- /dev/null +++ b/roles/smbclient/tasks/playbook.yaml @@ -0,0 +1,52 @@ +--- +- hosts: all + tasks: + - name: Upgrade all packages o the latest version + become: true + apt: + upgrade: yes + update_cache: yes + tags: apt_upgrade +- hosts: pi + tasks: + - name: Install snmpd Package + become: yes + apt: + name: ['snmpd'] + state: present + update_cache: true + tags: install_snmpd + - lineinfile: + path: /etc/snmp/snmpd.conf + state: present + regexp: "{{ item.regexp }}" + line: "{{ item.line }}" + with_items: + - { regexp: ' rocommunity public', line: ' rocommunity public' } + - { regexp: 'agentAddress udp:127.0.0.1:161', line: 'agentAddress udp:161' } + tags: configure_snmpd + become: true + - name: enable snmpd service and ensure it is not masked + systemd: + name: snmpd + enabled: yes + masked: no + state: restarted + tags: enablestart_snmpd + become: true + - name: set timezone + become: true + timezone: + name: America/New_York + tags: set_timezone + +- hosts: smbclient + tasks: + - name: enable cron job for smb traffic + cron: + name: "smbtraff" + minute: "*/20" + hour: "7-18" + weekday: "1-5" + job: "/usr/bin/perl -e 'sleep int rand 1199' && /home/pi/scripts/smb-session.sh" + tags: smbtraff_cron