2022-05-24 09:34:39 +00:00
|
|
|
---
|
|
|
|
- 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 }}"
|
2022-06-23 13:35:58 +00:00
|
|
|
notify: restart podman ddclient
|
2022-05-24 09:34:39 +00:00
|
|
|
|
|
|
|
- name: Copy Kvps.key for {{ ddclient_namespace }}
|
|
|
|
copy:
|
|
|
|
dest: "/opt/{{ ddclient_namespace }}/Kvps.key"
|
|
|
|
content: "{{ ddclient_tsig_public_key_base64 | b64decode }}"
|
|
|
|
notify: restart podman ddclient
|
|
|
|
|
|
|
|
- name: Copy Kvps.private for {{ ddclient_namespace }}
|
|
|
|
copy:
|
|
|
|
dest: "/opt/{{ ddclient_namespace }}/Kvps.private"
|
|
|
|
content: "{{ ddclient_tsig_private_key_base64 | b64decode }}"
|
|
|
|
notify: restart podman ddclient
|
|
|
|
|
|
|
|
- name: Start ddclient with podman for {{ ddclient_namespace }}
|
|
|
|
containers.podman.podman_container:
|
|
|
|
name: "{{ ddclient_container_name }}"
|
|
|
|
hostname: "{{ ddclient_container_name }}"
|
|
|
|
network: "{{ ddclient_network_mode }}"
|
|
|
|
image: "{{ ddclient_container_registry }}/{{ ddclient_image_name }}:{{ ddclient_image_tag }}"
|
|
|
|
state: present
|
|
|
|
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"
|
|
|
|
|
|
|
|
- name: Generate container systemd unit
|
|
|
|
shell: "podman generate systemd {{ ddclient_container_name }}"
|
|
|
|
register: ddclient_systemd_unit
|
|
|
|
changed_when: False
|
|
|
|
|
|
|
|
- name: Create ddclient systemd unit
|
|
|
|
copy:
|
|
|
|
dest: "/etc/systemd/system/{{ ddclient_systemd_unit_name }}"
|
|
|
|
content: "{{ ddclient_systemd_unit.stdout | regex_replace('^#.*', multiline=True) | trim }}"
|
|
|
|
|
|
|
|
- name: Enable ddclient systemd unit
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: "{{ ddclient_systemd_unit_name }}"
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
|
|
|
daemon_reload: yes
|