ansible/roles/ddclient/tasks/docker.yml
2022-06-23 19:57:52 +03:00

37 lines
1.3 KiB
YAML

---
- name: Create configuration dir for {{ ddclient_namespace }}
file:
name: "/opt/{{ ddclient_namespace }}"
state: directory
- name: Copy ddclient configuration for {{ ddclient_namespace }}
copy:
dest: "/opt/{{ ddclient_namespace }}/ddclient.conf"
content: "{{ ddclient_conf }}"
notify: restart docker ddclient
- name: Copy Kvps.key for {{ ddclient_namespace }}
copy:
dest: "/opt/{{ ddclient_namespace }}/Kvps.key"
content: "{{ ddclient_tsig_public_key_base64 | b64decode }}"
notify: restart docker ddclient
- name: Copy Kvps.private for {{ ddclient_namespace }}
copy:
dest: "/opt/{{ ddclient_namespace }}/Kvps.private"
content: "{{ ddclient_tsig_private_key_base64 | b64decode }}"
notify: restart docker ddclient
- name: Start ddclient in docker for {{ ddclient_namespace }}
docker_container:
name: "{{ ddclient_container_name }}"
image: "{{ ddclient_container_registry }}/{{ ddclient_image_name }}:{{ ddclient_image_tag }}"
network_mode: "{{ ddclient_network_mode }}"
state: started
container_default_behavior: no_defaults
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"