ansible/roles/ddclient/handlers/main.yml
2022-05-23 14:59:39 +03:00

43 lines
1.4 KiB
YAML

---
- name: start ddclient
systemd:
name: ddclient
state: started
enabled: yes
- name: restart ddclient
systemd:
name: ddclient
state: restarted
enabled: yes
- name: restart docker ddclient
community.general.docker_container:
name: "{{ ddclient_container_name }}"
image: "{{ ddclient_container_registry }}/{{ ddclient_image_name }}:{{ ddclient_image_tag }}"
state: started
restart: yes
container_default_behavior: no_defaults
detach: true
restart_policy: unless-stopped
volumes:
- "/opt/{{ ddclient_namespace }}/ddclient.conf:/config/ddclient.conf"
- "/opt/{{ ddclient_namespace }}/Kvps.key:/config/Kvps.key"
- "/opt/{{ ddclient_namespace }}/Kvps.private:/config/Kvps.private"
when: ddclient_container_engine == 'docker'
- name: restart podman ddclient
community.general.docker_container:
name: "{{ ddclient_container_name }}"
hostname: "{{ ddclient_container_name }}"
network: "{{ ddclient_network_mode }}"
image: "{{ ddclient_container_registry }}/{{ ddclient_image_name }}:{{ ddclient_image_tag }}"
state: started
restart: yes
volumes:
- "/opt/{{ ddclient_namespace }}/ddclient.conf:/config/ddclient.conf"
- "/opt/{{ ddclient_namespace }}/Kvps.key:/config/Kvps.key"
- "/opt/{{ ddclient_namespace }}/Kvps.private:/config/Kvps.private"
when: ddclient_container_engine == 'podman'