Merging and Deploying Let’s Encrypt Certificates with Salt

Easy way to merge two files on the fly. The storage backend can be any supported by SaltStack.

HAProxy certificate merge using Salt Jinja template

{%- if global_config['domains'] is defined %}
{%- for domain in global_config['domains'] %}

/etc/haproxy/crt/{{ domain }}.pem:
  file.managed:
    - contents: |
        {{ salt['cp.get_file_str']('salt://letsencrypt/live/' + domain + '/fullchain.pem') | indent(8) }}
        {{ salt['cp.get_file_str']('salt://letsencrypt/live/' + domain + '/privkey.pem') | indent(8) }}

{%- endfor %}
{%- endif %}
Human Logic, AI Syntax... Note on Content: I'm a Systems Engineer, not a native English writer. To ensure my technical ideas are clear and accessible, I use AI tools to polish the grammar and style. The workflow is simple: I provide the logic, the code, and the real-world experience. The AI handles the "English-to-Human" translation layer. If you find a bug, that's on me. If you find a perfectly placed comma, that's probably the AI.

Comments

Popular posts from this blog

FreeRadius with Google Workspace LDAP

Fixing pssh (parallel-ssh) Problems on Debian 10 with Python 3.7