ansible/roles/ddclient/tasks/docker.yml
2021-01-09 20:54:42 +03:00

36 lines
1.1 KiB
YAML

---
- name: Create configuration dir for {{ namespace }}
file:
name: "/opt/{{ namespace }}"
state: directory
- name: Copy ddclient configuration for {{ namespace }}
copy:
dest: "/opt/{{ namespace }}/ddclient.conf"
content: "{{ ddclient_conf }}"
notify: restart docker ddclient
- name: Copy Kvps.key for {{ namespace }}
copy:
dest: "/opt/{{ namespace }}/Kvps.key"
content: "{{ ddclient_tsig_public_key_base64 | b64decode }}"
notify: restart docker ddclient
- name: Copy Kvps.private for {{ namespace }}
copy:
dest: "/opt/{{ namespace }}/Kvps.private"
content: "{{ ddclient_tsig_private_key_base64 | b64decode }}"
notify: restart docker ddclient
- name: Start ddclient in docker for {{ namespace }}
docker_container:
name: "{{ namespace }}-ddclient"
image: "{{ docker_registry }}/ddclient:{{ ddclient_image_tag }}"
state: started
container_default_behavior: no_defaults
restart_policy: unless-stopped
volumes:
- "/opt/{{ namespace }}/ddclient.conf:/config/ddclient.conf"
- "/opt/{{ namespace }}/Kvps.key:/config/Kvps.key"
- "/opt/{{ namespace }}/Kvps.private:/config/Kvps.private"