DDNS: Fix duplicated config variable

This commit is contained in:
Jannik Beyerstedt 2021-05-08 18:22:48 +02:00
parent 22dd9bfb3d
commit ec961db180
3 changed files with 5 additions and 4 deletions

View file

@ -47,7 +47,7 @@ This task and it's configuration files might be quite specific for the [davd/doc
Mandatory variables:
- `ddns_server_domain`: Domain name of the DynDNS server
- `ddns_passphrase`: Passphrase for updating dynDNS entries
- `ddns_domain`: Domain where the host's entries are created as `$hostname.$ddns_domain`
- `ddns_zone`: Domain where the host's entries are created as `$hostname.$ddns_zone`
Optional variable:
- `ddns_silence`: Set to true to silence stderr too

View file

@ -15,10 +15,10 @@
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_id }}"
mode: 0775
- name: "dyndns - Create cronjob for {{ ddns_domain }} dynDNS script"
- name: "dyndns - Create cronjob for {{ ddns_zone }} dynDNS script"
become: yes
cron:
name: "{{ ddns_domain }} dynDNS"
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 %}"

View file

@ -13,7 +13,8 @@ fi
ip6addr=''
ip4addr=''
if [ $platform = 'linux' ]; then
ip6addr=$(ip -6 addr show scope global | grep inet6 | tail -1 | egrep -o '([0-9abcdef]{4}[0-9:abcdef]*)')
# only accept global IPv6 addresses (starting with 2 or 3)
ip6addr=$(ip -6 addr show scope global | grep inet6 | tail -1 | egrep -o '([0-9abcdef]{4}[0-9:abcdef]*)' | egrep '^[2,3]')
# filter local IPv4 address ranges (172.16.0.0/12, 10.0.0.0/8, 192.168.0.0/16)
ip4addr=$(ip -4 addr show scope global | grep inet | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | grep -Ev '172.(1[6-9]|2[0-9]|3[0-1])' | grep -Ev '10.' | grep -Ev '192.168.' | head -n 1)
elif [ $platform = 'freebsd' ]; then