Skip to content
Snippets Groups Projects
Commit 297501d3 authored by nimrod's avatar nimrod
Browse files

OpenWRT WAP daily updates script.

Download package updates and notify if there are pending updates.
parent 5c7d2aab
Branches
No related tags found
No related merge requests found
Pipeline #1509 passed
...@@ -5,6 +5,30 @@ ...@@ -5,6 +5,30 @@
- ansible_distribution == "OpenWrt" - ansible_distribution == "OpenWrt"
- ansible_distribution_major_version == "19" - ansible_distribution_major_version == "19"
- name: Install packages
loop:
- curl
community.general.opkg:
name: '{{ item }}'
state: present
update_cache: true
- name: Copy the daily updates script
ansible.builtin.template:
dest: &daily /usr/sbin/daily
group: root
mode: 0o0755
owner: root
src: daily.j2
- name: Set the daily updates script Cron job
ansible.builtin.cron:
hour: "3"
job: *daily
minute: "1"
name: Daily updates
state: present
- name: Create the www directory - name: Create the www directory
ansible.builtin.file: ansible.builtin.file:
path: /var/www path: /var/www
......
#!/bin/sh
set -eu
opkg update
opkg list-upgradable | awk '{print $1}' | sort | xargs -rn1 opkg upgrade --download-only
[ -z "$(opkg list-upgradable)" ] || curl https://notify.shore.co.il/send?message={{ (ansible_facts["hostname"] + " has pending updates.") | urlencode }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment