Skip to content

Commit

Permalink
fix: change rendering of domains.txt to template
Browse files Browse the repository at this point in the history
  • Loading branch information
24367dfa committed Nov 14, 2023
1 parent 791b72a commit a08304d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tasks/domains.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- name: Ensure domain directories are present.
file:
ansible.builtin.file:
name: "{{ dehydrated_certs_dir }}/{{ item.name }}"
state: directory
with_items: "{{ dehydrated_domains }}"

- name: Render hook script templates.
template:
ansible.builtin.template:
src: hook.sh.j2
dest: "{{ dehydrated_certs_dir }}/{{ item.name }}/hook.sh"
mode: '755'
Expand All @@ -21,8 +21,7 @@
with_items: "{{ dehydrated_domains }}"

- name: Ensure Domains are in domains.txt
lineinfile:
path: "{{ dehydrated_config_dir }}/domains.txt"
line: "{{ item.name }}{% if 'alternate_names' in item %}{% for an in item.alternate_names %} {{ an|default(omit) }}{% endfor %}{% endif %}"
with_items: "{{ dehydrated_domains }}"
ansible.builtin.template:
src: domains.txt.j2
dest: "{{ dehydrated_config_dir }}/domains.txt"
notify: dehydrated run
2 changes: 2 additions & 0 deletions templates/domains.txt.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% for domain in dehydrated_domains %}{{ domain.name }}{% if 'alternate_names' in domain %}{% for an in domain.alternate_names %} {{ an|default(omit) }}{% endfor %}{% endif %}
{% endfor %}

0 comments on commit a08304d

Please sign in to comment.