diff options
Diffstat (limited to 'roles/ddns.notyet')
-rw-r--r-- | roles/ddns.notyet/meta/main.yml | 3 | ||||
-rw-r--r-- | roles/ddns.notyet/tasks/main.yml | 11 | ||||
-rw-r--r-- | roles/ddns.notyet/templates/update-dns.j2 | 24 | ||||
-rw-r--r-- | roles/ddns.notyet/vars/main.yml | 2 | ||||
-rw-r--r-- | roles/ddns.notyet/vars/vault.yml | 8 |
5 files changed, 0 insertions, 48 deletions
diff --git a/roles/ddns.notyet/meta/main.yml b/roles/ddns.notyet/meta/main.yml deleted file mode 100644 index fdda41b..0000000 --- a/roles/ddns.notyet/meta/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -dependencies: - - role: common diff --git a/roles/ddns.notyet/tasks/main.yml b/roles/ddns.notyet/tasks/main.yml deleted file mode 100644 index 63caa0c..0000000 --- a/roles/ddns.notyet/tasks/main.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- include_vars: vars/vault.yml - -- name: install dns utilities - apt: name=dnsutils state=latest - -- name: install jq - apt: name=jq state=latest - -- name: schedule periodic updates of dns entry - template: src=update-dns.j2 dest=/etc/cron.daily/update-dns diff --git a/roles/ddns.notyet/templates/update-dns.j2 b/roles/ddns.notyet/templates/update-dns.j2 deleted file mode 100644 index 4d68666..0000000 --- a/roles/ddns.notyet/templates/update-dns.j2 +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -e - -api_email=jodersky@gmail.com -api_key={{ddns_api_key}} -zone_name={{ddns_zone}} -record_name={{ddns_record}} - -cf() { - curl \ - -sS \ - -H "X-Auth-Email: $api_email"\ - -H "X-Auth-Key: $api_key"\ - -H "Content-Type: application/json"\ - $@ -} - -external_ip=$(dig +short myip.opendns.com @resolver1.opendns.com) -zone_id=$(cf -X GET "https://api.cloudflare.com/client/v4/zones?name=$zone_name" | jq -r '.result[0].id') -record_id=$(cf -X GET "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records?name=$record_name" | jq -r '.result[0].id') - -cf -X PUT "https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records/${record_id}" \ - --data {\"type\":\"A\",\"name\":\""$record_name"\",\"content\":\""$external_ip"\"} \ - || (echo "Error updating IP address." >&2 && exit 1) diff --git a/roles/ddns.notyet/vars/main.yml b/roles/ddns.notyet/vars/main.yml deleted file mode 100644 index 6128462..0000000 --- a/roles/ddns.notyet/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -ddns_api_key: "{{vault_ddns_api_key}}" diff --git a/roles/ddns.notyet/vars/vault.yml b/roles/ddns.notyet/vars/vault.yml deleted file mode 100644 index 77502f8..0000000 --- a/roles/ddns.notyet/vars/vault.yml +++ /dev/null @@ -1,8 +0,0 @@ -$ANSIBLE_VAULT;1.1;AES256 -38333565623838383936376530366331383234626234346666623232643831333761376563666561 -3930343438613136656633656363633930623931626238330a656236633037303535663733383838 -33636566336164313365653766353931353739343562343435613130623739656432383831323466 -3039626461333738610a303632633562326133356635656234353334343764636236623238343262 -39623638376663643964623938626238626636313136636364633561346630303266303232363366 -33383361623532636165666433653964653937613038393132343762666131616338643230643734 -313734343834663538323038393337316635 |