updated acme state
This commit is contained in:
parent
41d28c1a40
commit
5b28b1c382
@ -4,25 +4,27 @@
|
||||
import os
|
||||
import requests
|
||||
|
||||
URL=os.environ("URL")
|
||||
DOMAINS=os.environ("DOMAINS")
|
||||
FULLCERTFILE=os.environ("FULLCERTFILE")
|
||||
KEYFILE=os.environ("KEYFILE")
|
||||
USERNAME=os.environ("USERNAME")
|
||||
PASSWORD=os.environ("PASSWORD")
|
||||
URL=os.environ.get("URL")
|
||||
DOMAINS=os.environ.get("DOMAINS")
|
||||
FULLCERTFILE=os.environ.get("FULLCERTFILE")
|
||||
KEYFILE=os.environ.get("KEYFILE")
|
||||
USERNAME=os.environ.get("USERNAME")
|
||||
PASSWORD=os.environ.get("PASSWORD")
|
||||
|
||||
def main():
|
||||
res = requests.request(method="GET", url=f"{URL}/domain/{DOMAINS}", auth=(USERNAME, PASSWORD))
|
||||
resj = res.json()
|
||||
|
||||
try:
|
||||
with open(FULLCERTFILE) as fcf:
|
||||
os.write(ffcf, resj["certificate"])
|
||||
if "certificate" in resj.keys():
|
||||
with open(FULLCERTFILE, "w") as fcf:
|
||||
fcf.write(resj["certificate"])
|
||||
|
||||
with open(KEYFILE) as fkf:
|
||||
os.write(fkf, resj["privatekey"])
|
||||
if "privatekey" in resj.keys():
|
||||
with open(KEYFILE, "w") as fkf:
|
||||
fkf.write(resj["privatekey"])
|
||||
except Exception as e:
|
||||
return e
|
||||
print(e)
|
||||
|
||||
return
|
||||
|
||||
|
@ -13,9 +13,10 @@ pkic-run:
|
||||
- name: /etc/acme/pkic.py
|
||||
- env:
|
||||
- URL: '{{ acme.provider.pki.url }}'
|
||||
- DOMAINS: '{{ acme.domains|join(',') }}'
|
||||
- FULLCERTFILE: '{{ acme.fullcertfile }}'
|
||||
- KEYFILE: '{{ acme.keyfile }}'
|
||||
- USERNAME: '{{ acme.provider.pki.username }}'
|
||||
- PASSWORD: '{{ acme.provider.pki.password }}'
|
||||
- require:
|
||||
- cmd: pkic-install
|
||||
- file: pkic-install
|
||||
|
Loading…
Reference in New Issue
Block a user