Add Cloudflare dynamic DNS updater

This commit is contained in:
David Stephens 2019-01-15 23:24:18 +00:00
parent 100f02539c
commit 9cbac4486c
6 changed files with 75 additions and 3 deletions

View file

@ -21,10 +21,12 @@ just a stock Ubuntu install, some clever Ansible config and a bunch of Docker co
* Source control with Gitea
* SSL secured external access to some applications via Traefik
* A Docker host with Portainer for image and container management
* An automatic dynamic DNS updater if you use Cloudflare to host your domain DNS
### Docker Containers Used
* [Airsonic](https://airsonic.github.io/) - catalog and stream music
* [Cloudflare DDNS](https://hub.docker.com/r/joshuaavalon/cloudflare-ddns/) - automatically update Cloudflare with your dynamic IP address
* [CouchPotato](https://couchpota.to/) - for downloading and managing movies
* [Duplicati](https://www.duplicati.com/) - for backing up your stuff
* [Emby](https://emby.media/) - Media streaming and management

View file

@ -0,0 +1,15 @@
# Cloudflare Dynamic DNS Updater
Homepage: [https://github.com/joshuaavalon/docker-cloudflare](https://github.com/joshuaavalon/docker-cloudflare)
Cloudflare: [https://www.cloudflare.com](https://www.cloudflare.com)
If you want your Ansible-NAS accessible externally then you'll need a domain name. You'll also need to set a wildcard
host A record to point to your static IP, or enable this container to automatically update Cloudflare with your dynamic IP address.
## Usage
Set `cloudflare_ddns_enabled: true` in your `group_vars/all.yml` file.
## Specific Configuration
Make sure you set your Cloudflare login, domain and API key details within your `group_vars/all.yml` file.

View file

@ -5,8 +5,8 @@
# External Access
# Traefik will allow access to certain applications externally. To enable this you'll need a domain name that points to your
# home static IP address, or use a dynamic DNS provider like no-ip. You'll also need to map ports 80 and 443 from your router
# to your ansible-nas server.
# home static IP address, cloudflare with the cloudflare_ddns dynamic DNS container enabled, or use a dynamic DNS provider like no-ip.
# You'll also need to map ports 80 and 443 from your router to your ansible-nas server.
traefik_enabled: false
# BitTorrent
@ -42,6 +42,7 @@ stats_enabled: false
guacamole_enabled: false
netdata_enabled: false
watchtower_enabled: false
cloudflare_ddns_enabled: false
# Backup & Restore
duplicati_enabled: false
@ -182,6 +183,24 @@ samba_shares:
browsable: yes
path: "{{ samba_shares_root }}/photos"
###
### Cloudflare
###
# Cloudflare is a great free DNS option for domains. If you use the cloudflare_ddns container then you'll need to
# set the options below.
# Your domain name
cloudflare_zone: awesomedomain.com
# The hostname you want the container to update. You shouldn't need to change this.
cloudflare_host: "*.{{ cloudflare_zone }}"
# Email address used to register for Cloudflare
cloudflare_email: dave@awesomedomain.com
# Cloudflare 'Global API Key', can be found on the 'My Profile' page
cloudflare_api_key: abcdeabcdeabcdeabcde1234512345
##################################################################
###### You shouldn't need to edit anything below this point ######
##################################################################

View file

@ -117,4 +117,8 @@
- import_tasks: tasks/airsonic.yml
when: airsonic_enabled
tags: airsonic
tags: airsonic
- import_tasks: tasks/cloudflare_ddns.yml
when: cloudflare_ddns_enabled
tags: cloudflare_ddns

13
tasks/cloudflare_ddns.yml Normal file
View file

@ -0,0 +1,13 @@
- name: Cloudflare Dynamic DNS Container
docker_container:
name: cloudflare-ddns
image: joshava/cloudflare-ddns:latest
pull: true
env:
ZONE: {{ cloudflare_zone }}
HOST: {{ cloudflare_host }}
EMAIL: {{ cloudflare_email }}
API: {{ cloudflare_api_key }}
restart_policy: unless-stopped
memory: 512mb

View file

@ -42,6 +42,7 @@ stats_enabled: false
guacamole_enabled: false
netdata_enabled: false
watchtower_enabled: false
cloudflare_ddns_enabled: false
# Backup & Restore
duplicati_enabled: false
@ -182,6 +183,24 @@ samba_shares:
browsable: yes
path: "{{ samba_shares_root }}/photos"
###
### Cloudflare
###
# Cloudflare is a great free DNS option for domains. If you use the cloudflare_ddns container then you'll need to
# set the options below.
# Your domain name
cloudflare_zone: awesomedomain.com
# The hostname you want the container to update. You shouldn't need to change this.
cloudflare_host: "*.{{ cloudflare_zone }}"
# Email address used to register for Cloudflare
cloudflare_email: dave@awesomedomain.com
# Cloudflare 'Global API Key', can be found on the 'My Profile' page
cloudflare_api_key: abcdeabcdeabcdeabcde1234512345
##################################################################
###### You shouldn't need to edit anything below this point ######
##################################################################