update currency conversions daily(ish) for units

This commit is contained in:
Pig Monkey 2019-07-23 19:19:30 -07:00
parent 5695dcd45a
commit 24ef24c34a
7 changed files with 60 additions and 2 deletions

View file

@ -89,7 +89,6 @@ base_packages:
- python-docs
- python2-docs
- screen
- units
- python-pipenv
- termdown
@ -292,6 +291,9 @@ syncthing:
run_on: trusted
mirrorlist:
run_on: trusted
run_on: trusted
units:
run_on: trusted
kernel_parameters: "quiet consoleblank=60 i915.enable_psr=2"

View file

@ -78,6 +78,7 @@
- { role: goesimage, tags: ['goesimage'], when: "goesimage is defined" }
- { role: syncthing, tags: ['syncthing'], when: "syncthing is defined" }
- { role: mirrorlist, tags: ['mirrorlist'], when: "mirrorlist is defined" }
- { role: units, tags: ['units'], when: "units is defined" }
- { role: logitech, tags: ['logitech'] }
vars_prompt:
- name: user_password

View file

@ -0,0 +1,4 @@
---
- name: restart units_cur
service: name=units_cur.timer state=restarted
when: units.run_on == "all"

View file

@ -0,0 +1,4 @@
---
dependencies:
- { role: nmtrust }
- { role: systemd }

View file

@ -0,0 +1,25 @@
---
- name: Install GNU Units
pacman:
name: units
state: present
- name: Push GNU Units currency update service file
template:
src: units_cur.service.j2
dest: /etc/systemd/system/units_cur.service
notify:
- reload systemd config
- name: Push GNU Units currency update timer file
template:
src: units_cur.timer.j2
dest: /etc/systemd/system/units_cur.timer
notify:
- reload systemd config
- restart units_cur
- include_tasks: roles/nmtrust/tasks/unit.yml
vars:
unit: units_cur.timer
run_on: "{{ units.run_on }}"

View file

@ -0,0 +1,10 @@
# {{ ansible_managed }}
[Unit]
Description=GNU Units Currency Update Service
After=network.target
[Service]
Type=oneshot
StandardOutput=syslog
StandardError=syslog
ExecStart=/usr/bin/units_cur{% if 'args' in units %} {{ units.args }}{% endif %}

View file

@ -0,0 +1,12 @@
# {{ ansible_managed }}
[Unit]
Description=GNU Units Currency Update Timer
[Timer]
OnCalendar=daily
Persistent=true
RandomizedDelaySec=3600
Unit=units_cur.service
[Install]
WantedBy=timers.target