Skip to content

Instantly share code, notes, and snippets.

@hatifnatt
Created April 14, 2017 19:22
Show Gist options
  • Save hatifnatt/6e8e9d875e1055b0e313ce7aa9139204 to your computer and use it in GitHub Desktop.
Save hatifnatt/6e8e9d875e1055b0e313ce7aa9139204 to your computer and use it in GitHub Desktop.
Pillar
acme_sh:
hatifnatt:
userconf:
accountemail: [email protected]
test: True
certconf:
domain.tld:
altnames:
- www.domain.tld
- web.domain.tld
Part of state:
# Add main domain to commandline
{%- set certcmd = certcmd ~ " -d " ~ domain %}
before_loop_{{ username }}_{{ domain }}:
test.ping:
- name:
- {{ certcmd }}
# BEGIN rotate altnames
{%- if 'altnames' in certconf and certconf['altnames']|length > 0 %}
{%- for altname in certconf.get('altnames', []) %}
{%- set certcmd = certcmd ~ " -d " ~ altname %}
loop_{{ loop.index0 }}_{{ username }}_{{ domain }}:
test.ping:
- name:
- {{ certcmd }}
- {{ altname }}
{%- endfor %}
{%- endif %}
# END rotate altnames
after_loop_{{ username }}_{{ domain }}:
test.ping:
- name:
- {{ certcmd }}
YAML output:
before_loop_hatifnatt_domain.tld:
__env__: dev
__sls__: role.acme_sh.config
test:
- name:
- /home/hatifnatt/.acme.sh/acme.sh --issue --standalone --httpport 80 -d domain.tld
- ping
- order: 10003
loop_0_hatifnatt_domain.tld:
__env__: dev
__sls__: role.acme_sh.config
test:
- name:
- /home/hatifnatt/.acme.sh/acme.sh --issue --standalone --httpport 80 -d domain.tld -d www.domain.tld
- www.domain.tld
- ping
- order: 10004
loop_1_hatifnatt_domain.tld:
__env__: dev
__sls__: role.acme_sh.config
test:
- name:
- /home/hatifnatt/.acme.sh/acme.sh --issue --standalone --httpport 80 -d domain.tld -d web.domain.tld
- web.domain.tld
- ping
- order: 10005
after_loop_hatifnatt_domain.tld:
__env__: dev
__sls__: role.acme_sh.config
test:
- name:
- /home/hatifnatt/.acme.sh/acme.sh --issue --standalone --httpport 80 -d domain.tld
- ping
- order: 10006
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment