diff --git a/roles/base/defaults/main.yml b/roles/base/defaults/main.yml index ae3cc02..74fbca3 100644 --- a/roles/base/defaults/main.yml +++ b/roles/base/defaults/main.yml @@ -2,11 +2,6 @@ manage_network: false network_type: static allow_reboot: true -ddclient_web: dynamicdns.park-your-domain.com/getip -ddclient_server: dynamicdns.park-your-domain.com -ddclient_protocol: namecheap -ddclient_verbose: "yes" - packages: - cryptsetup - curl diff --git a/roles/base/tasks/ddclient.yml b/roles/base/tasks/ddclient.yml index eeb107e..f1e1121 100644 --- a/roles/base/tasks/ddclient.yml +++ b/roles/base/tasks/ddclient.yml @@ -7,7 +7,7 @@ template: src: ddclient.conf.j2 dest: /etc/ddclient.conf - register: ddclient + register: ddclient_settings - name: Start ddclient and enable on boot service: @@ -19,4 +19,4 @@ service: name: ddclient state: restarted - when: ddclient.changed + when: ddclient_settings.changed diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 881893f..dfc96c8 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -14,4 +14,4 @@ - import_tasks: ddclient.yml tags: ddclient - when: ddclient_password is defined + when: ddclient is defined diff --git a/roles/base/templates/ddclient.conf.j2 b/roles/base/templates/ddclient.conf.j2 index 33e73fe..313d56c 100644 --- a/roles/base/templates/ddclient.conf.j2 +++ b/roles/base/templates/ddclient.conf.j2 @@ -2,10 +2,17 @@ # # /etc/ddclient.conf -verbose={{ ddclient_verbose }} -use=web, web={{ ddclient_web }} -protocol={{ ddclient_protocol }} -server={{ ddclient_server }} -login={{ ddclient_login }} -password={{ ddclient_password }} -{{ ddclient_host }} +{% for domain in ddclient %} +{% if domain.verbose is sameas true or domain.verbose is not defined %} +verbose=yes +{% else %} +verbose=no +{% endif %} +use=web, web={{ domain.web | default('dynamicdns.park-your-domain.com/getip')}} +protocol={{ domain.protocol | default('namecheap')}} +server={{ domain.server | default('dynamicdns.park-your-domain.com')}} +login={{ domain.name }} +password={{ domain.pass }} +{{ domain.host }} + +{% endfor %}