removed dhcp option

This commit is contained in:
Scott Crossen 2020-10-18 21:05:23 -07:00
parent de1511b4bb
commit 19721be8b1
9 changed files with 11 additions and 88 deletions

View File

@ -1,28 +1,25 @@
# Whether dynamic dns is enabled # Whether dynamic dns is enabled
matrix_dynamic_dns_enabled: false matrix_dynamic_dns_enabled: false
# Allowed values: 'daemon', 'dhcp'
matrix_dynamic_dns_mode: 'daemon'
# The dynamic dns daemon interval # The dynamic dns daemon interval
matrix_dynamic_dns_daemon_interval: '300' matrix_dynamic_dns_daemon_interval: '300'
# The docker container to use when in daemon mode # The docker container to use when in mode
matrix_dynamic_dns_docker_image: 'linuxserver/ddclient' matrix_dynamic_dns_docker_image: 'linuxserver/ddclient'
# The image to force pull # The image to force pull
matrix_dynamic_dns_docker_image_force_pull: "{{ matrix_dynamic_dns_docker_image.endswith(':latest') }}" matrix_dynamic_dns_docker_image_force_pull: "{{ matrix_dynamic_dns_docker_image.endswith(':latest') }}"
# List of extra arguments to pass to the ontainer daemon mode # List of extra arguments to pass to the ontainer mode
matrix_dynamic_dns_container_extra_arguments: [] matrix_dynamic_dns_container_extra_arguments: []
# List of wanted services when running in daemon mode # List of wanted services when running in mode
matrix_dynamic_dns_systemd_wanted_services_list: [] matrix_dynamic_dns_systemd_wanted_services_list: []
# List of required services when running in daemon mode # List of required services when running in mode
matrix_dynamic_dns_systemd_required_services_list: ['docker.service'] matrix_dynamic_dns_systemd_required_services_list: ['docker.service']
# Build the container from source when running in daemon mode # Build the container from source when running in mode
matrix_dynamic_dns_container_image_self_build: false matrix_dynamic_dns_container_image_self_build: false
# Config paths # Config paths

View File

@ -1,7 +1,3 @@
- set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['ddclient'] }}"
when: "matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_mode == 'dhcp'"
- set_fact: - set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-dynamic-dns'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-dynamic-dns'] }}"
when: "matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_mode == 'daemon'" when: "matrix_dynamic_dns_enabled|bool"

View File

@ -1,17 +0,0 @@
---
- name: Ensure ddclient domain config exists
template:
src: "{{ role_path }}/templates/ddclient.conf.j2"
dest: "/etc/ddclient.conf"
mode: 0600
- name: Ensure ddclient client config exists
copy:
content: "run_dhclient=\"true\"\nrun_ipup=\"false\"\nrun_daemon=\"false\""
dest: "/etc/default/ddclient"
mode: 0600
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
- import_tasks: "{{ role_path }}/tasks/platform/main.yml"

View File

@ -8,26 +8,14 @@
- setup-all - setup-all
- setup-dynamic-dns - setup-dynamic-dns
- import_tasks: "{{ role_path }}/tasks/install_dhcp.yml" - import_tasks: "{{ role_path }}/tasks/install.yml"
when: "run_setup|bool and matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_mode == 'dhcp'" when: "run_setup|bool and matrix_dynamic_dns_enabled|bool"
tags: tags:
- setup-all - setup-all
- setup-dynamic-dns - setup-dynamic-dns
- import_tasks: "{{ role_path }}/tasks/uninstall_dhcp.yml" - import_tasks: "{{ role_path }}/tasks/uninstall.yml"
when: "run_setup|bool and not matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_mode == 'dhcp'" when: "run_setup|bool and not matrix_dynamic_dns_enabled|bool"
tags:
- setup-all
- setup-dynamic-dns
- import_tasks: "{{ role_path }}/tasks/install_daemon.yml"
when: "run_setup|bool and matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_mode == 'daemon'"
tags:
- setup-all
- setup-dynamic-dns
- import_tasks: "{{ role_path }}/tasks/uninstall_daemon.yml"
when: "run_setup|bool and not matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_mode == 'daemon'"
tags: tags:
- setup-all - setup-all
- setup-dynamic-dns - setup-dynamic-dns

View File

@ -1,33 +0,0 @@
---
- import_tasks: "{{ role_path }}/tasks/platform/main.yml"
- name: Check existence of ddclient.service
stat:
path: "{{ systemd_path }}/ddclient.service"
register: matrix_dynamic_dns_ddclient_service_stat
- name: Ensure ddclient.service is stopped
service:
name: dynamic-dns
state: stopped
daemon_reload: yes
when: "matrix_dynamic_dns_ddclient_service_stat.stat.exists"
- name: Ensure ddclient.service doesn't exist
file:
path: "{{ systemd_path }}/ddclient.service"
state: absent
when: "matrix_dynamic_dns_ddclient_service_stat.stat.exists"
- name: Ensure ddclient configuration files don't exist
file:
path:
- "etc/ddclient.conf"
- "etc/default/ddclient"
state: absent
- name: Ensure systemd reloaded after ddclient.service removal
service:
daemon_reload: yes
when: "matrix_dynamic_dns_ddclient_service_stat.stat.exists"

View File

@ -8,10 +8,3 @@
with_items: with_items:
- "matrix_dynamic_dns_domain" - "matrix_dynamic_dns_domain"
- "matrix_dynamic_dns_provider" - "matrix_dynamic_dns_provider"
- "matrix_dynamic_dns_mode"
- name: Fail if dynamic dns mode is incorrect
fail:
msg: >-
matrix_dynamic_dns_mode needs to be set to 'daemon' or 'dhcp'
when: "matrix_dynamic_dns_enabled and matrix_dynamic_dns_mode != 'daemon' and matrix_dynamic_dns_mode != 'dhcp'"

View File

@ -1,7 +1,6 @@
{% if matrix_dynamic_dns_mode == "daemon" %}}
daemon={{ matrix_dynamic_dns_daemon_interval }} daemon={{ matrix_dynamic_dns_daemon_interval }}
syslog=no syslog=no
pid=/var/run/ddclient/ddclient.pid {% endif %} pid=/var/run/ddclient/ddclient.pid
ssl=yes ssl=yes
use={{ matrix_dynamic_dns_use }} use={{ matrix_dynamic_dns_use }}
protocol={{ matrix_dynamic_dns_protocol }} protocol={{ matrix_dynamic_dns_protocol }}