ansible-role-server/tasks/dyndns.yml

25 lines
714 B
YAML

---
# Server/Dyndns: Setup dynDNS Script
- name: dyndns - Install needed tools
become: yes
ansible.builtin.package:
name: curl
state: present
- name: dyndns - Copy dynDNS script
become: yes
ansible.builtin.template:
src: "{{ role_path }}/templates/ddns-hosts.sh"
dest: /usr/local/bin/ddns-hosts.sh
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_id }}"
mode: 0775
- name: "dyndns - Create cronjob for {{ ddns_zone }} dynDNS script"
become: yes
ansible.builtin.cron:
name: "{{ ddns_zone }} dynDNS"
minute: "*/5"
hour: "*"
job: "/usr/local/bin/ddns-hosts.sh > /dev/null{% if ddns_silence is defined and ddns_silence is sameas true %} 2>&1{% endif %}"