Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>
pull/4902/head
| @@ -1,61 +0,0 @@ | |||||
| # SPDX-FileCopyrightText: 2020 - 2025 Slavi Pantaleev | |||||
| # SPDX-FileCopyrightText: 2020 Scott Crossen | |||||
| # SPDX-FileCopyrightText: 2021 - 2022 MDAD project contributors | |||||
| # SPDX-FileCopyrightText: 2021 Ahmad Haghighi | |||||
| # SPDX-FileCopyrightText: 2022 Marko Weltzer | |||||
| # SPDX-FileCopyrightText: 2022 Nikita Chernyi | |||||
| # SPDX-FileCopyrightText: 2023 Samuel Meenzen | |||||
| # | |||||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||||
| --- | |||||
| # Project source code URL: https://github.com/linuxserver/docker-ddclient | |||||
| # Whether dynamic dns is enabled | |||||
| ddclient_enabled: true | |||||
| # The dynamic dns daemon interval | |||||
| ddclient_daemon_interval: '300' | |||||
| # renovate: datasource=docker depName=linuxserver/ddclient versioning=semver | |||||
| ddclient_version: 4.0.0 | |||||
| ddclient_container_network: '' | |||||
| ddclient_container_additional_networks: "{{ ddclient_container_additional_networks_auto + ddclient_container_additional_networks_custom }}" | |||||
| ddclient_container_additional_networks_auto: [] | |||||
| ddclient_container_additional_networks_custom: [] | |||||
| # List of extra arguments to pass to the container mode | |||||
| ddclient_container_extra_arguments: [] | |||||
| # List of wanted services when running in mode | |||||
| ddclient_systemd_wanted_services_list: [] | |||||
| # List of required services when running in mode | |||||
| ddclient_systemd_required_services_list: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" | |||||
| # Build the container from source when running in mode | |||||
| ddclient_container_image_self_build: false | |||||
| ddclient_container_image_self_build_repo: "https://github.com/linuxserver/docker-ddclient.git" | |||||
| ddclient_container_image_self_build_repo_branch: "{{ ddclient_version }}" | |||||
| # Config paths | |||||
| ddclient_config_path: "{{ ddclient_base_path }}/config" | |||||
| ddclient_docker_src_files_path: "{{ ddclient_base_path }}/docker-src" | |||||
| # Config options | |||||
| ddclient_use: "web" | |||||
| ddclient_additional_configuration_blocks: [] | |||||
| # Holds the configurations (the domains to update DNS for, the providers they use, etc.) | |||||
| # | |||||
| # Example: | |||||
| # ddclient_domain_configurations: | |||||
| # - provider: domains.google.com | |||||
| # protocol: dyndn2 | |||||
| # username: XXXXXXXXXXXXXXXX | |||||
| # password: XXXXXXXXXXXXXXXX | |||||
| # domain: "{{ matrix_domain }}" | |||||
| ddclient_domain_configurations: [] | |||||
| @@ -1,26 +0,0 @@ | |||||
| # SPDX-FileCopyrightText: 2020 Scott Crossen | |||||
| # SPDX-FileCopyrightText: 2022 - 2023 Slavi Pantaleev | |||||
| # SPDX-FileCopyrightText: 2022 Marko Weltzer | |||||
| # | |||||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||||
| --- | |||||
| - tags: | |||||
| - setup-all | |||||
| - setup-dynamic-dns | |||||
| - install-all | |||||
| - install-dynamic-dns | |||||
| block: | |||||
| - when: ddclient_enabled | bool | |||||
| ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" | |||||
| - when: ddclient_enabled | bool | |||||
| ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml" | |||||
| - tags: | |||||
| - setup-all | |||||
| - setup-dynamic-dns | |||||
| block: | |||||
| - when: not ddclient_enabled | bool | |||||
| ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" | |||||
| @@ -1,79 +0,0 @@ | |||||
| # SPDX-FileCopyrightText: 2020 - 2024 Slavi Pantaleev | |||||
| # SPDX-FileCopyrightText: 2020 Scott Crossen | |||||
| # SPDX-FileCopyrightText: 2022 Marko Weltzer | |||||
| # SPDX-FileCopyrightText: 2022 Nikita Chernyi | |||||
| # SPDX-FileCopyrightText: 2022 Sebastian Gumprich | |||||
| # SPDX-FileCopyrightText: 2024 David Mehren | |||||
| # | |||||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||||
| --- | |||||
| - name: Ensure Dynamic DNS image is pulled | |||||
| community.docker.docker_image: | |||||
| name: "{{ ddclient_docker_image }}" | |||||
| source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" | |||||
| force_source: "{{ ddclient_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | |||||
| force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else ddclient_docker_image_force_pull }}" | |||||
| when: ddclient_enabled | bool and not ddclient_container_image_self_build | |||||
| register: result | |||||
| retries: "{{ devture_playbook_help_container_retries_count }}" | |||||
| delay: "{{ devture_playbook_help_container_retries_delay }}" | |||||
| until: result is not failed | |||||
| - name: Ensure Dynamic DNS paths exist | |||||
| ansible.builtin.file: | |||||
| path: "{{ item.path }}" | |||||
| state: directory | |||||
| mode: 0751 | |||||
| owner: "{{ matrix_user_name }}" | |||||
| group: "{{ matrix_group_name }}" | |||||
| with_items: | |||||
| - {path: "{{ ddclient_base_path }}", when: true} | |||||
| - {path: "{{ ddclient_config_path }}", when: true} | |||||
| - {path: "{{ ddclient_docker_src_files_path }}", when: "{{ ddclient_container_image_self_build }}"} | |||||
| when: ddclient_enabled | bool and item.when | bool | |||||
| - name: Ensure Dynamic DNS repository is present on self build | |||||
| ansible.builtin.git: | |||||
| repo: "{{ ddclient_container_image_self_build_repo }}" | |||||
| version: "{{ ddclient_container_image_self_build_repo_branch }}" | |||||
| dest: "{{ ddclient_docker_src_files_path }}" | |||||
| force: "yes" | |||||
| become: true | |||||
| become_user: "{{ matrix_user_name }}" | |||||
| register: ddclient_git_pull_results | |||||
| when: "ddclient_enabled | bool and ddclient_container_image_self_build | bool" | |||||
| - name: Ensure Dynamic DNS Docker image is built | |||||
| community.docker.docker_image: | |||||
| name: "{{ ddclient_docker_image }}" | |||||
| source: build | |||||
| force_source: "{{ ddclient_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | |||||
| force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else ddclient_git_pull_results.changed }}" | |||||
| build: | |||||
| dockerfile: Dockerfile | |||||
| path: "{{ ddclient_docker_src_files_path }}" | |||||
| pull: true | |||||
| when: "ddclient_enabled | bool and ddclient_container_image_self_build | bool" | |||||
| - name: Ensure Dynamic DNS ddclient.conf installed | |||||
| ansible.builtin.template: | |||||
| src: "{{ role_path }}/templates/ddclient.conf.j2" | |||||
| dest: "{{ ddclient_config_path }}/ddclient.conf" | |||||
| mode: 0644 | |||||
| owner: "{{ matrix_user_name }}" | |||||
| group: "{{ matrix_group_name }}" | |||||
| - name: Ensure matrix-dynamic-dns container network is created | |||||
| community.general.docker_network: | |||||
| enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}" | |||||
| name: "{{ ddclient_container_network }}" | |||||
| driver: bridge | |||||
| driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}" | |||||
| - name: Ensure matrix-dynamic-dns.service installed | |||||
| ansible.builtin.template: | |||||
| src: "{{ role_path }}/templates/systemd/matrix-dynamic-dns.service.j2" | |||||
| dest: "/etc/systemd/system/matrix-dynamic-dns.service" | |||||
| mode: 0644 | |||||
| @@ -1,26 +0,0 @@ | |||||
| # SPDX-FileCopyrightText: 2020 - 2022 Slavi Pantaleev | |||||
| # SPDX-FileCopyrightText: 2020 Scott Crossen | |||||
| # SPDX-FileCopyrightText: 2022 Marko Weltzer | |||||
| # | |||||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||||
| --- | |||||
| - name: Check existence of matrix-dynamic-dns service | |||||
| ansible.builtin.stat: | |||||
| path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-dynamic-dns.service" | |||||
| register: ddclient_service_stat | |||||
| - when: ddclient_service_stat.stat.exists | bool | |||||
| block: | |||||
| - name: Ensure matrix-dynamic-dns is stopped | |||||
| ansible.builtin.service: | |||||
| name: matrix-dynamic-dns | |||||
| state: stopped | |||||
| enabled: false | |||||
| daemon_reload: true | |||||
| - name: Ensure matrix-dynamic-dns.service doesn't exist | |||||
| ansible.builtin.file: | |||||
| path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-dynamic-dns.service" | |||||
| state: absent | |||||
| @@ -1,29 +0,0 @@ | |||||
| # SPDX-FileCopyrightText: 2020 - 2025 Slavi Pantaleev | |||||
| # SPDX-FileCopyrightText: 2020 Scott Crossen | |||||
| # | |||||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||||
| --- | |||||
| - name: Fail if no matrix-dynamic-dns configurations specified | |||||
| ansible.builtin.fail: | |||||
| msg: >- | |||||
| You need to define at least one configuration in `ddclient_domain_configurations` for using matrix-dynamic-dns. | |||||
| when: "ddclient_domain_configurations | length == 0" | |||||
| - name: Fail if required matrix-dynamic-dns settings not defined in configuration blocks | |||||
| ansible.builtin.fail: | |||||
| msg: >- | |||||
| One of the configurations in ddclient_domain_configurations is missing a required key (domain, protocol). | |||||
| when: "'domain' not in configuration or 'protocol' not in configuration" | |||||
| with_items: "{{ ddclient_domain_configurations }}" | |||||
| loop_control: | |||||
| loop_var: configuration | |||||
| - name: Fail if required matrix-dynamic-dns settings not defined | |||||
| ansible.builtin.fail: | |||||
| msg: >- | |||||
| You need to define a required configuration setting (`{{ item.name }}`). | |||||
| when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" | |||||
| with_items: | |||||
| - {'name': 'ddclient_container_network', when: true} | |||||
| @@ -1,78 +0,0 @@ | |||||
| {# | |||||
| SPDX-FileCopyrightText: 2020 Scott Crossen | |||||
| SPDX-FileCopyrightText: 2022 Slavi Pantaleev | |||||
| SPDX-License-Identifier: AGPL-3.0-or-later | |||||
| #} | |||||
| daemon={{ ddclient_daemon_interval }} | |||||
| syslog=no | |||||
| pid=/var/run/ddclient/ddclient.pid | |||||
| ssl=yes | |||||
| use={{ ddclient_use }} | |||||
| web='{{ ddclient_web }}' | |||||
| {% if ddclient_web_skip %} | |||||
| web-skip='{{ ddclient_web_skip }}' | |||||
| {% endif %} | |||||
| {% for ddclient_additional_configuration in ddclient_additional_configuration_blocks %} | |||||
| {{ ddclient_additional_configuration }} | |||||
| {% endfor %} | |||||
| {% for dynamic_dns_domain_configuration in ddclient_domain_configurations %} | |||||
| protocol={{ dynamic_dns_domain_configuration.protocol }} | |||||
| {% if 'apikey' in dynamic_dns_domain_configuration %} | |||||
| apikey={{ dynamic_dns_domain_configuration.apikey }} | |||||
| {% endif %} | |||||
| {% if 'secretapikey' in dynamic_dns_domain_configuration %} | |||||
| secretapikey={{ dynamic_dns_domain_configuration.secretapikey }} | |||||
| {% endif %} | |||||
| {% if 'rootdomain' in dynamic_dns_domain_configuration %} | |||||
| root-domain={{ dynamic_dns_domain_configuration.rootdomain }} | |||||
| {% endif %} | |||||
| {% if 'provider' in dynamic_dns_domain_configuration %} | |||||
| server={{ dynamic_dns_domain_configuration.provider }} | |||||
| {% endif %} | |||||
| {% if 'username' in dynamic_dns_domain_configuration %} | |||||
| login='{{ dynamic_dns_domain_configuration.username }}' | |||||
| {% endif %} | |||||
| {% if 'password' in dynamic_dns_domain_configuration %} | |||||
| password='{{ dynamic_dns_domain_configuration.password }}' | |||||
| {% endif %} | |||||
| {% if 'static' in dynamic_dns_domain_configuration %} | |||||
| static=yes | |||||
| {% endif %} | |||||
| {% if 'custom' in dynamic_dns_domain_configuration %} | |||||
| custom=yes | |||||
| {% endif %} | |||||
| {% if 'zone' in dynamic_dns_domain_configuration %} | |||||
| zone={{ dynamic_dns_domain_configuration.zone }} | |||||
| {% endif %} | |||||
| {% if 'ttl' in dynamic_dns_domain_configuration %} | |||||
| ttl={{ dynamic_dns_domain_configuration.ttl }} | |||||
| {% endif %} | |||||
| {% if 'mx' in dynamic_dns_domain_configuration %} | |||||
| mx={{ dynamic_dns_domain_configuration.mx }} | |||||
| {% endif %} | |||||
| {% if 'wildcard' in dynamic_dns_domain_configuration %} | |||||
| wildcard=yes | |||||
| {% endif %} | |||||
| {% if 'script' in dynamic_dns_domain_configuration %} | |||||
| script={{ dynamic_dns_domain_configuration.script }} | |||||
| {% endif %} | |||||
| {{ dynamic_dns_domain_configuration.domain }} | |||||
| {% endfor %} | |||||
| @@ -1,46 +0,0 @@ | |||||
| #jinja2: lstrip_blocks: True | |||||
| [Unit] | |||||
| Description=Matrix Dynamic DNS | |||||
| {% for service in ddclient_systemd_required_services_list %} | |||||
| Requires={{ service }} | |||||
| After={{ service }} | |||||
| {% endfor %} | |||||
| {% for service in ddclient_systemd_wanted_services_list %} | |||||
| Wants={{ service }} | |||||
| {% endfor %} | |||||
| DefaultDependencies=no | |||||
| [Service] | |||||
| Type=simple | |||||
| Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}" | |||||
| ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-dynamic-dns 2>/dev/null || true' | |||||
| ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-dynamic-dns 2>/dev/null || true' | |||||
| ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ | |||||
| --rm \ | |||||
| --name=matrix-dynamic-dns \ | |||||
| --log-driver=none \ | |||||
| --network={{ ddclient_container_network }} \ | |||||
| -e PUID={{ matrix_user_uid }} \ | |||||
| -e PGID={{ matrix_user_gid }} \ | |||||
| --mount type=bind,src={{ ddclient_config_path }},dst=/config \ | |||||
| {% for arg in ddclient_container_extra_arguments %} | |||||
| {{ arg }} \ | |||||
| {% endfor %} | |||||
| {{ ddclient_docker_image }} | |||||
| {% for network in ddclient_container_additional_networks %} | |||||
| ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-dynamic-dns | |||||
| {% endfor %} | |||||
| ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-dynamic-dns | |||||
| ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-dynamic-dns 2>/dev/null || true' | |||||
| ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-dynamic-dns 2>/dev/null || true' | |||||
| Restart=always | |||||
| RestartSec=30 | |||||
| SyslogIdentifier=matrix-dynamic-dns | |||||
| [Install] | |||||
| WantedBy=multi-user.target | |||||
| @@ -1,4 +0,0 @@ | |||||
| SPDX-FileCopyrightText: 2020 - 2025 Slavi Pantaleev | |||||
| SPDX-FileCopyrightText: 2020 Scott Crossen | |||||
| SPDX-License-Identifier: AGPL-3.0-or-later | |||||