Merge pull request 'Set up DynDNS cron via Ansible' (!60) from dyndns-cron into master
Reviewed-on: https://gitea.n39.eu/Netz39_Admin/netz39-infra-ansible/pulls/60 Reviewed-by: dkdent <dkdent@netz39.de>
This commit is contained in:
commit
900f9f43da
6 changed files with 51 additions and 0 deletions
|
@ -46,6 +46,16 @@ all:
|
||||||
sudo: yes
|
sudo: yes
|
||||||
docker: yes
|
docker: yes
|
||||||
|
|
||||||
|
# Data for DD24 dyndns updates
|
||||||
|
dyndns_domain: "dyndns.n39.eu"
|
||||||
|
dyndns_password: !vault |
|
||||||
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
|
65653833376630636530373933326362316164353965643732323634393934383764376563613063
|
||||||
|
6632333438636434376666666132313139393363366665380a353737326231613862333866323031
|
||||||
|
30353966366436613433363937643463613332643133643637643232633238373638303063646635
|
||||||
|
3132306530356431630a333538616466643933643230383165646362643738616237383937666332
|
||||||
|
3164
|
||||||
|
|
||||||
hosts:
|
hosts:
|
||||||
tau.netz39.de:
|
tau.netz39.de:
|
||||||
server_admin: "admin+tau@netz39.de"
|
server_admin: "admin+tau@netz39.de"
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
vars:
|
vars:
|
||||||
docker_data_root: "/srv/docker"
|
docker_data_root: "/srv/docker"
|
||||||
- role: apache
|
- role: apache
|
||||||
|
- role: dd24-dyndns-cron
|
||||||
|
# variables are set in the inventory
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
|
|
5
roles/dd24-dyndns-cron/defaults/main.yml
Normal file
5
roles/dd24-dyndns-cron/defaults/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# DD24 Cron configuration
|
||||||
|
---
|
||||||
|
dyndns_domain: www.example.com
|
||||||
|
dyndns_password: yourpassword
|
||||||
|
dyndns_ip: auto
|
10
roles/dd24-dyndns-cron/handlers/main.yml
Normal file
10
roles/dd24-dyndns-cron/handlers/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# handlers file for cron-dd24-dyndns
|
||||||
|
---
|
||||||
|
- name: reload cron
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: service cron reload
|
||||||
|
warn: no
|
||||||
|
# Use the shell call because the task sometimes has problems finding the service state
|
||||||
|
# service:
|
||||||
|
# name: cron
|
||||||
|
# state: restarted
|
18
roles/dd24-dyndns-cron/tasks/main.yml
Normal file
18
roles/dd24-dyndns-cron/tasks/main.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
- name: Make sure cron and curl are installed
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- cron
|
||||||
|
- curl
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Setup cron file for DD24 updates
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "templates/dd24-dyndns.cron.j2"
|
||||||
|
dest: "/etc/cron.d/dd24-dyndns"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
notify: reload cron
|
||||||
|
# There is ansible.builtin.cron, but this makes configuration much
|
||||||
|
# more complicated, so we stick to the template.
|
6
roles/dd24-dyndns-cron/templates/dd24-dyndns.cron.j2
Normal file
6
roles/dd24-dyndns-cron/templates/dd24-dyndns.cron.j2
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# /etc/cron.d/dd24-dyndns: Cron call to renew DynDNS entry
|
||||||
|
|
||||||
|
SHELL=/bin/sh
|
||||||
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
|
||||||
|
*/5 * * * * root curl "https://dynamicdns.key-systems.net/update.php?hostname={{dyndns_domain}}&password={{dyndns_password}}&ip={{dyndns_ip}}" > /dev/null
|
Loading…
Reference in a new issue