diff --git a/hosts b/hosts index dfd3a91..ef0fd9a 100755 --- a/hosts +++ b/hosts @@ -40,3 +40,6 @@ [netflows] 192.168.50.2 + +[youtube] +192.168.50.2 diff --git a/main.yaml b/main.yaml index d75d599..3d3051d 100644 --- a/main.yaml +++ b/main.yaml @@ -14,6 +14,11 @@ - hosts: pi roles: - snmpd + - wifi vars_prompt: - - name: rocommunity - prompt: "Enter SNMP RO community name" + - name: rocommunity + prompt: "Enter SNMP RO community name" + default: "public" +- hosts: youtube + roles: + - youtube diff --git a/roles/common/tasks/main.yaml b/roles/common/tasks/main.yaml index 8d54d52..481a20a 100755 --- a/roles/common/tasks/main.yaml +++ b/roles/common/tasks/main.yaml @@ -5,3 +5,14 @@ upgrade: yes update_cache: yes tags: apt_upgrade +- name: Create directories + file: + path: "{{ item }}" + state: directory + owner: pi + group: pi + with_items: + - /home/pi/Documents/ftp + - /home/pi/Documents/smb + - /home/pi/scripts + tags: create_dirs diff --git a/roles/wifi/tasks/main.yaml b/roles/wifi/tasks/main.yaml new file mode 100755 index 0000000..640fd76 --- /dev/null +++ b/roles/wifi/tasks/main.yaml @@ -0,0 +1,32 @@ +--- +- name: Remove wpasupplicant package + become: yes + apt: + name: ['wpasupplicant'] + state: absent + purge: true + tags: remove_wpasupplicant +- lineinfile: + path: /etc/snmp/snmpd.conf + state: present + backrefs: yes + regexp: "{{ item.regexp }}" + line: "{{ item.line }}" + with_items: + - { regexp: '^\s+rocommunity\s+public\s+default\s+-V\s+systemonly', line: ' rocommunity {{ rocommunity }}' } + - { regexp: '^agentAddress\s+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 diff --git a/roles/youtube/tasks/main.yaml b/roles/youtube/tasks/main.yaml new file mode 100755 index 0000000..0a44036 --- /dev/null +++ b/roles/youtube/tasks/main.yaml @@ -0,0 +1,9 @@ +--- +- name: enable cron job for youtube traffic + cron: + name: "youtubetraff" + minute: "*/30" + hour: "7-18" + weekday: "1-5" + job: "/usr/bin/perl -e 'sleep int rand 900' && /home/pi/scripts/youtube.sh" + tags: youtubetraff_cron