Refactor filter_plugins

This commit is contained in:
Tobias Reisinger 2026-02-08 19:34:58 +01:00
parent 8ee096949d
commit bdf1f8891b
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
14 changed files with 34 additions and 30 deletions

View file

@ -0,0 +1,18 @@
class FilterModule(object):
def filters(self):
return {
'lego_from_acmedns': self.from_acmedns,
}
def from_acmedns(self, acmedns_registered):
result = {}
for (key, value) in acmedns_registered.items():
result[key] = {
"fulldomain": value["subd"] + "." + value["host"],
"subdomain": value["subd"],
"username": value["user"],
"password": value["pass"],
"server_url": "https://" + value["host"]
}
return result

View file

@ -10,7 +10,7 @@
- name: Create the acme-dns-accounts
ansible.builtin.copy:
dest: "{{ (lego_config_path, 'acme-dns-accounts.json') | path_join }}"
content: '{{ lego_acmedns_registered | acmedns_to_lego | to_json }}'
content: '{{ lego_acmedns_registered | lego_from_acmedns | to_json }}'
mode: "0644"
- name: Copy the hook script
ansible.builtin.copy:

View file

@ -21,7 +21,7 @@
- name: Generate systemd timer names
ansible.builtin.set_fact:
lego_systemd_timers: "{{ lego_host_certificates | list_prefix_suffix('lego@', '.timer') }}"
lego_systemd_timers: "{{ lego_host_certificates | utils_list_prefix_suffix('lego@', '.timer') }}"
- name: Disable unused system timers
ansible.builtin.systemd_service: