Compare commits
1 commit
main
...
feature-dd
Author | SHA1 | Date | |
---|---|---|---|
Nils Norman Haukås | 7981055d1a |
12
playbook.yml
12
playbook.yml
|
@ -25,11 +25,13 @@
|
|||
firewall_allowed_ports:
|
||||
- { port: 80, proto: "tcp" }
|
||||
- { port: 443, proto: "tcp" }
|
||||
ddns_domains:
|
||||
- { host: "", type: "A"}
|
||||
roles:
|
||||
- backup
|
||||
- sendmail
|
||||
- nodejs
|
||||
- firewall
|
||||
- forgejo
|
||||
- caddy
|
||||
# - backup
|
||||
# - sendmail
|
||||
# - firewall
|
||||
# - forgejo
|
||||
# - caddy
|
||||
|
||||
|
|
3
roles/ddns/defaults/main.yml
Normal file
3
roles/ddns/defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
# Domains to keep up to date
|
||||
ddns_domains: []
|
10
roles/ddns/files/update-ddns.service
Normal file
10
roles/ddns/files/update-ddns.service
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Updates DDNS of various IPv4/IPv6 services
|
||||
OnFailure=status-email@%n
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/root/update-ddns.sh
|
||||
User=root
|
||||
Group=root
|
||||
|
9
roles/ddns/files/update-ddns.timer
Normal file
9
roles/ddns/files/update-ddns.timer
Normal file
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=Ensure DNS is update to date, by checking hourly
|
||||
|
||||
[Timer]
|
||||
OnCalendar="*-*-* *:15:00"
|
||||
Persistent=false
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
23
roles/ddns/tasks/main.yml
Normal file
23
roles/ddns/tasks/main.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
|
||||
|
||||
- name: upload ddns script
|
||||
ansible.builtin.template:
|
||||
src: update-ddns.sh.j2
|
||||
dest: /root/update-ddns.sh
|
||||
mode: '0700'
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: upload systemd unit files
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/etc/systemd/system/{{ item }}"
|
||||
loop:
|
||||
- update-ddns.service
|
||||
- update-ddns.timer
|
||||
|
||||
- name: enable update-ddns.timer
|
||||
ansible.builtin.systemd:
|
||||
name: update-ddns.timer
|
||||
state: started
|
||||
enabled: true
|
5
roles/ddns/templates/update-ddns.sh.j2
Normal file
5
roles/ddns/templates/update-ddns.sh.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/env bash
|
||||
|
||||
{% for item in ddns_domains %}
|
||||
curl -X PUT https://box.nilsnh.no/admin/dns/custom/{{item.host}}/{{item.rtype}} --user {{ vault_mta_user }}:{{ vault_mta_user_pw }}
|
||||
{% endfor %}
|
Loading…
Reference in a new issue